PageRenderTime 27ms CodeModel.GetById 17ms app.highlight 7ms RepoModel.GetById 2ms app.codeStats 0ms

/prelude/geordi.hpp

http://github.com/Eelis/geordi
C++ Header | 53 lines | 42 code | 10 blank | 1 comment | 0 complexity | 2b1a43ac68ab8e43e329329a0e2162e7 MD5 | raw file
 1#ifndef GEORDI_HPP
 2#define GEORDI_HPP
 3
 4#include <cstdio>
 5#include <cstdlib>
 6#include <string>
 7#include <map>
 8#include <iostream>
 9#include <sys/utsname.h>
10
11namespace geordi
12{
13  namespace
14  {
15    char const parsep[] = "\342\200\251";
16      // UTF-8 encoding of PARAGRAPH SEPARATOR (U+2029). See "Output separators" in notes.txt.
17
18    char const compiler_description[] =
19      #ifdef __clang__
20        "Clang " __clang_version__;
21      #else
22        "GCC " __VERSION__;
23      #endif
24  }
25
26  struct error
27  {
28    error() { std::printf("%serror: ", parsep); }
29    ~error() { std::abort(); }
30    std::ostream & operator()() const { return std::cout; }
31  };
32
33  utsname uname();
34
35  template <typename> struct is_character { enum { value = false }; };
36  #define YES(T) template <> struct is_character<T> { enum { value = true }; };
37  YES(char) YES(wchar_t)
38  #if __cplusplus >= 201103
39    YES(char16_t) YES(char32_t)
40  #endif
41  #undef YES
42
43  char const * demangle(char const *);
44
45  std::map<std::string, std::string> depersist();
46  void persist(std::string key, std::string value);
47}
48
49std::ostream & operator<<(std::ostream &, wchar_t);
50std::ostream & operator<<(std::ostream &, wchar_t const *);
51std::ostream & operator<<(std::ostream &, std::wstring const &);
52
53#endif // header guard