Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef CUPT_COMMON_SEEN
00019 #define CUPT_COMMON_SEEN
00020
00022 #define CUPT_API __attribute__ ((visibility("default")))
00023 #define CUPT_LOCAL __attribute__ ((visibility("hidden")))
00024
00025
00028 #include <string>
00029 #include <vector>
00030 #include <memory>
00031 #include <stdexcept>
00032
00034 namespace cupt {
00035
00036 CUPT_API extern const char* const libraryVersion;
00037
00038 using std::vector;
00039 using std::string;
00040
00042
00045 class CUPT_API Exception: public std::runtime_error
00046 {
00047 public:
00049
00054 Exception(const char* message)
00055 : std::runtime_error(message)
00056 {}
00058
00061 Exception(const string& message)
00062 : std::runtime_error(message)
00063 {}
00064 };
00065
00066 using std::pair;
00067
00068 using std::shared_ptr;
00069 using std::static_pointer_cast;
00070 using std::dynamic_pointer_cast;
00071
00073
00077 CUPT_API extern int messageFd;
00078
00079
00081 void CUPT_API fatal(const char* format, ...);
00083 void CUPT_API warn(const char* format, ...);
00085 void CUPT_API debug(const char* format, ...);
00087 void CUPT_API simulate(const char* format, ...);
00088
00090 CUPT_API string sf(const string& format, ...);
00091 CUPT_API string join(const string& joiner, const vector< string >& parts);
00092 CUPT_API string humanReadableSizeString(uint64_t bytes);
00094
00096
00100 string CUPT_API __(const char* message);
00101
00103
00120 void CUPT_API consumePackageName(string::const_iterator begin, string::const_iterator end,
00121 string::const_iterator& resultEnd);
00122
00124
00129 bool CUPT_API checkPackageName(const string& packageName, bool throwOnError = true);
00130
00132
00135 bool CUPT_API checkVersionString(const string& versionString, bool throwOnError = true);
00136
00138
00147 int CUPT_API compareVersionStrings(const string& left, const string& right);
00148
00149 }
00150
00151 #include <cupt/format2.hpp>
00152
00153 #endif
00154