File: util.hh

package info (click to toggle)
sqlsmith 1.4-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 540 kB
  • sloc: cpp: 3,221; sql: 175; makefile: 33; sh: 1
file content (27 lines) | stat: -rw-r--r-- 462 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#ifndef UTIL_HH
#define UTIL_HH
#include <typeinfo>
#include <string>
#include <sstream>

using namespace std;

/* TODO: The strings are implementation-defined.  How do they look in
   clang? */

inline std::string pretty_type(const char *raw)
{
  ostringstream os;
  os << raw;
  string s = os.str();
  while(s[0] <= '9')
    s.erase(s.begin());
  return s;
}

inline std::string pretty_type(struct prod *p)
{
  return pretty_type(typeid(*p).name());
}

#endif