3 #ifndef SPECTMORPH_UTIL_HH 4 #define SPECTMORPH_UTIL_HH 17 #error "unsupported platform" 26 #error "unsupported compiler" 33 typedef uint8_t uint8;
34 typedef uint32_t uint32;
35 typedef int64_t int64;
36 typedef uint64_t uint64;
37 typedef unsigned int uint;
39 #define SPECTMORPH_CLASS_NON_COPYABLE(Class) private: Class (const Class&); Class& operator= (const Class&); 42 #define SPECTMORPH_PRINTF(format_idx, arg_idx) __attribute__ ((__format__ (gnu_printf, format_idx, arg_idx))) 44 #define SPECTMORPH_PRINTF(format_idx, arg_idx) __attribute__ ((__format__ (__printf__, format_idx, arg_idx))) 47 std::string string_printf (
const char *format, ...) SPECTMORPH_PRINTF (1, 2);
48 std::
string string_vprintf (const
char *format, va_list vargs);
50 std::
string string_locale_printf (const
char *format, ...) SPECTMORPH_PRINTF (1, 2);
52 void sm_printf (const
char *format, ...) SPECTMORPH_PRINTF (1, 2);
57 INSTALL_DIR_TEMPLATES,
58 INSTALL_DIR_INSTRUMENTS,
62 std::string sm_get_install_dir (InstallDir p);
65 void sm_set_pkg_data_dir (
const std::string& data_dir);
74 std::string sm_get_user_dir (UserDir p);
75 std::string sm_get_default_plan();
76 std::string sm_get_cache_dir();
79 std::string sm_mac_documents_dir();
84 DOCUMENTS_DIR_INSTRUMENTS
87 std::string sm_get_documents_dir (DocumentsDir p);
109 case Code::FILE_NOT_FOUND:
110 m_message =
"No such file, device or directory";
113 case Code::FORMAT_INVALID:
114 m_message =
"Invalid format";
117 case Code::PARSE_ERROR:
118 m_message =
"Parsing error";
122 m_message =
"Unknown error";
126 Error (
const std::string& message) :
140 return m_message.c_str();
144 return m_code != Code::NONE;
148 std::string m_message;
152 std::string sm_resolve_link (
const std::string& link_file);
155 std::string sha1_hash (
const unsigned char *data,
size_t len);
156 std::string sha1_hash (
const std::string& str);
160 std::string to_utf8 (
const std::u32string& str);
161 std::u32string to_utf32 (
const std::string& utf8);
163 Error read_dir (
const std::string& dirname, std::vector<std::string>& files);
168 #include "smdebug.hh"
Definition: smutils.hh:89
Definition: smadsrenvelope.hh:8