3 #ifndef SPECTMORPH_UTIL_HH 4 #define SPECTMORPH_UTIL_HH 16 #error "unsupported platform" 25 #error "unsupported compiler" 32 typedef uint8_t uint8;
33 typedef uint32_t uint32;
34 typedef int64_t int64;
35 typedef uint64_t uint64;
36 typedef unsigned int uint;
38 #define SPECTMORPH_CLASS_NON_COPYABLE(Class) private: Class (const Class&); Class& operator= (const Class&); 41 #define SPECTMORPH_PRINTF(format_idx, arg_idx) __attribute__ ((__format__ (gnu_printf, format_idx, arg_idx))) 43 #define SPECTMORPH_PRINTF(format_idx, arg_idx) __attribute__ ((__format__ (__printf__, format_idx, arg_idx))) 46 std::string string_printf (
const char *format, ...) SPECTMORPH_PRINTF (1, 2);
47 std::
string string_vprintf (const
char *format, va_list vargs);
49 std::
string string_locale_printf (const
char *format, ...) SPECTMORPH_PRINTF (1, 2);
51 void sm_printf (const
char *format, ...) SPECTMORPH_PRINTF (1, 2);
56 INSTALL_DIR_TEMPLATES,
57 INSTALL_DIR_INSTRUMENTS
60 std::string sm_get_install_dir (InstallDir p);
63 void sm_set_pkg_data_dir (
const std::string& data_dir);
72 std::string sm_get_user_dir (UserDir p);
73 std::string sm_get_default_plan();
74 std::string sm_get_cache_dir();
77 std::string sm_mac_documents_dir();
82 DOCUMENTS_DIR_INSTRUMENTS
85 std::string sm_get_documents_dir (DocumentsDir p);
107 case Code::FILE_NOT_FOUND:
108 m_message =
"No such file, device or directory";
111 case Code::FORMAT_INVALID:
112 m_message =
"Invalid format";
115 case Code::PARSE_ERROR:
116 m_message =
"Parsing error";
120 m_message =
"Unknown error";
124 Error (
const std::string& message) :
138 return m_message.c_str();
142 return m_code != Code::NONE;
146 std::string m_message;
150 std::string sm_resolve_link (
const std::string& link_file);
153 std::string sha1_hash (
const unsigned char *data,
size_t len);
154 std::string sha1_hash (
const std::string& str);
158 std::string to_utf8 (
const std::u32string& str);
159 std::u32string to_utf32 (
const std::string& utf8);
164 #include "smdebug.hh"
Definition: smutils.hh:87
Definition: smadsrenvelope.hh:8