9 #ifndef __libutilxx__sella__util__String_H__
10 #define __libutilxx__sella__util__String_H__
12 #include "../../common.h"
13 #include "RegexException.h"
14 #include "CompressionException.h"
15 #include "CryptException.h"
25 #include <boost/regex.hpp>
38 typedef const boost::regex_constants::syntax_option_type REFlag;
39 typedef const boost::regex_constants::match_flag_type MatchFlag;
41 static REFlag& DefaultREFlags(
void) {
static REFlag v = boost::regex_constants::normal;
return v; }
42 static MatchFlag& DefaultMatchFlags(
void) {
static MatchFlag v = boost::regex_constants::match_default;
return v; }
44 static const int DefaultLevel = 6;
45 static const std::string& DefaultSalt(
void) {
static std::string v(CRYPT_SALT_DEF);
return v; }
47 enum Algo : uint8_t { Auto, Zlib, LZ4, Gzip };
49 static const std::string& AlphaNumericMixedCase(
void) {
static std::string v(
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
return v; }
50 static const std::string& AlphaNumbericUpperCase(
void) {
static std::string v(
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ");
return v; }
51 static const std::string& AlphaNumbericLowerCase(
void) {
static std::string v(
"0123456789abcdefghijklmnopqrstuvwxyz");
return v; }
52 static const std::string& Whitespace(
void) {
static std::string v(
" \t\r\n\v\f");
return v; }
53 static const std::string& Delim(
void) {
static std::string v(
" ,;:");
return v; }
54 static const std::string& nil(
void) {
static std::string v;
return v; }
55 static const char* RadixLookup(
void) {
static char v[] =
"0123456789abcdef";
return v; }
58 static std::string sprintf(
const char* format, ...)
throw ();
59 static std::string sprintf(
const std::string &format, ...)
throw ();
60 static std::string vsprintf(
const char* format, va_list args)
throw ();
61 static std::string vsprintf(
const std::string &format, va_list args)
throw ();
63 static int strcmp(
const std::string &a,
const std::string &b)
throw ();
64 static int strcasecmp(
const std::string &a,
const std::string &b)
throw ();
66 static int strncmp(
const std::string &a,
const std::string &b,
size_t len)
throw ();
67 static int strncasecmp(
const std::string &a,
const std::string &b,
size_t len)
throw ();
69 static bool str_imatch(
const std::string &a,
const std::string &b)
throw ();
71 static std::string substr_replace(
const std::string &src,
const std::string &search,
const std::string &replace = nil(),
bool global =
true)
throw ();
72 static std::string& substr_replace(std::string &src,
const std::string &search,
const std::string &replace = nil(),
bool global =
true)
throw ();
74 static std::string substr_ireplace(
const std::string &src,
const std::string &search,
const std::string &replace = nil(),
bool global =
true)
throw ();
75 static std::string& substr_ireplace(std::string &src,
const std::string &search,
const std::string &replace = nil(),
bool global =
true)
throw ();
77 static std::string escape_percent(
const std::string &src)
throw ();
78 static std::string escape(
const std::string &src,
const std::string &chars =
"\"",
const std::string &escape =
"\\")
throw ();
80 static std::string regex_replace(
const std::string &src,
const boost::regex ®ex,
const std::string &replace = nil(), MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
81 static std::string regex_replace(
const std::string &src,
const std::string ®ex,
const std::string &replace = nil(), REFlag reFlags = DefaultREFlags(), MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
82 static std::string& regex_replace(std::string &src,
const boost::regex ®ex,
const std::string &replace = nil(), MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
83 static std::string& regex_replace(std::string &src,
const std::string ®ex,
const std::string &replace = nil(), REFlag reFlags = DefaultREFlags(), MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
85 static std::string regex_ireplace(
const std::string &src,
const boost::regex ®ex,
const std::string &replace = nil(), MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
86 static std::string regex_ireplace(
const std::string &src,
const std::string ®ex,
const std::string &replace = nil(), REFlag reFlags = DefaultREFlags(), MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
87 static std::string& regex_ireplace(std::string &src,
const boost::regex ®ex,
const std::string &replace = nil(), MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
88 static std::string& regex_ireplace(std::string &src,
const std::string ®ex,
const std::string &replace = nil(), REFlag reFlags = DefaultREFlags(), MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
90 static bool regex_match(
const std::string &src,
const boost::regex ®ex, MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
91 static bool regex_match(
const std::string &src,
const std::string ®ex, REFlag reFlags = DefaultREFlags(), MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
92 static bool regex_match(
const std::string &src,
const boost::regex ®ex, boost::cmatch &matches, MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
93 static bool regex_match(
const std::string &src,
const std::string ®ex, boost::cmatch &matches, REFlag reFlags = DefaultREFlags(), MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
94 static bool regex_match(
const std::string &src,
const boost::regex ®ex, std::string &match, MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
95 static bool regex_match(
const std::string &src,
const std::string ®ex, std::string &match, REFlag reFlags = DefaultREFlags(), MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
96 static bool regex_match(
const std::string &src,
const boost::regex ®ex, std::vector<std::string> &matches, MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
97 static bool regex_match(
const std::string &src,
const std::string ®ex, std::vector<std::string> &matches, REFlag reFlags = DefaultREFlags(), MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
99 static bool regex_imatch(
const std::string &src,
const boost::regex ®ex, MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
100 static bool regex_imatch(
const std::string &src,
const std::string ®ex, REFlag reFlags = DefaultREFlags(), MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
101 static bool regex_imatch(
const std::string &src,
const boost::regex ®ex, boost::cmatch &matches, MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
102 static bool regex_imatch(
const std::string &src,
const std::string ®ex, boost::cmatch &matches, REFlag reFlags = DefaultREFlags(), MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
103 static bool regex_imatch(
const std::string &src,
const boost::regex ®ex, std::string &match, MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
104 static bool regex_imatch(
const std::string &src,
const std::string ®ex, std::string &match, REFlag reFlags = DefaultREFlags(), MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
105 static bool regex_imatch(
const std::string &src,
const boost::regex ®ex, std::vector<std::string> &matches, MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
106 static bool regex_imatch(
const std::string &src,
const std::string ®ex, std::vector<std::string> &matches, REFlag reFlags = DefaultREFlags(), MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
108 static bool regex_search(
const std::string &src,
const boost::regex ®ex, MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
109 static bool regex_search(
const std::string &src,
const std::string ®ex, REFlag reFlags = DefaultREFlags(), MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
110 static bool regex_search(
const std::string &src,
const boost::regex ®ex, boost::cmatch &matches, MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
111 static bool regex_search(
const std::string &src,
const std::string ®ex, boost::cmatch &matches, REFlag reFlags = DefaultREFlags(), MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
112 static bool regex_search(
const std::string &src,
const boost::regex ®ex, std::string &match, MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
113 static bool regex_search(
const std::string &src,
const std::string ®ex, std::string &match, REFlag reFlags = DefaultREFlags(), MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
114 static bool regex_search(
const std::string &src,
const boost::regex ®ex, std::vector<std::string> &matches,
bool global =
true,
bool subexp =
true, MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
115 static bool regex_search(
const std::string &src,
const std::string ®ex, std::vector<std::string> &matches,
bool global =
true,
bool subexp =
true, REFlag reFlags = DefaultREFlags(), MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
116 static bool regex_search(
const std::string &src,
const boost::regex ®ex, std::set<std::string> &matches,
bool global =
true,
bool subexp =
true, MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
117 static bool regex_search(
const std::string &src,
const std::string ®ex, std::set<std::string> &matches,
bool global =
true,
bool subexp =
true, REFlag reFlags = DefaultREFlags(), MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
119 static bool regex_search_sub(
const std::string &src,
const boost::regex ®ex, std::vector<std::string> &matches,
bool global =
true, MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
120 static bool regex_search_sub(
const std::string &src,
const std::string ®ex, std::vector<std::string> &matches,
bool global =
true, REFlag reFlags = DefaultREFlags(), MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
121 static bool regex_search_sub(
const std::string &src,
const boost::regex ®ex, std::set<std::string> &matches,
bool global =
true, MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
122 static bool regex_search_sub(
const std::string &src,
const std::string ®ex, std::set<std::string> &matches,
bool global =
true, REFlag reFlags = DefaultREFlags(), MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
124 static bool regex_isearch(
const std::string &src,
const boost::regex ®ex, MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
125 static bool regex_isearch(
const std::string &src,
const std::string ®ex, REFlag reFlags = DefaultREFlags(), MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
126 static bool regex_isearch(
const std::string &src,
const boost::regex ®ex, boost::cmatch &matches, MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
127 static bool regex_isearch(
const std::string &src,
const std::string ®ex, boost::cmatch &matches, REFlag reFlags = DefaultREFlags(), MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
128 static bool regex_isearch(
const std::string &src,
const boost::regex ®ex, std::string &match, MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
129 static bool regex_isearch(
const std::string &src,
const std::string ®ex, std::string &match, REFlag reFlags = DefaultREFlags(), MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
130 static bool regex_isearch(
const std::string &src,
const boost::regex ®ex, std::vector<std::string> &matches,
bool global =
true,
bool subexp =
true, MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
131 static bool regex_isearch(
const std::string &src,
const std::string ®ex, std::vector<std::string> &matches,
bool global =
true,
bool subexp =
true, REFlag reFlags = DefaultREFlags(), MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
132 static bool regex_isearch(
const std::string &src,
const boost::regex ®ex, std::set<std::string> &matches,
bool global =
true,
bool subexp =
true, MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
133 static bool regex_isearch(
const std::string &src,
const std::string ®ex, std::set<std::string> &matches,
bool global =
true,
bool subexp =
true, REFlag reFlags = DefaultREFlags(), MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
135 static bool regex_isearch_sub(
const std::string &src,
const boost::regex ®ex, std::vector<std::string> &matches,
bool global =
true, MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
136 static bool regex_isearch_sub(
const std::string &src,
const std::string ®ex, std::vector<std::string> &matches,
bool global =
true, REFlag reFlags = DefaultREFlags(), MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
137 static bool regex_isearch_sub(
const std::string &src,
const boost::regex ®ex, std::set<std::string> &matches,
bool global =
true, MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
138 static bool regex_isearch_sub(
const std::string &src,
const std::string ®ex, std::set<std::string> &matches,
bool global =
true, REFlag reFlags = DefaultREFlags(), MatchFlag mFlags = DefaultMatchFlags())
throw (RegexException);
140 static std::vector<std::string> regex_split(
const std::string &str,
const boost::regex &delim,
bool empty =
true,
size_t limit = -1)
throw (RegexException);
141 static std::vector<std::string> regex_split(
const std::string &str,
const std::string ®ex,
bool empty =
true,
size_t limit = -1, REFlag reFlags = DefaultREFlags())
throw (RegexException);
143 static std::vector<std::string> regex_isplit(
const std::string &str,
const boost::regex &delim,
bool empty =
true,
size_t limit = -1)
throw (RegexException);
144 static std::vector<std::string> regex_isplit(
const std::string &str,
const std::string ®ex,
bool empty =
true,
size_t limit = -1, REFlag reFlags = DefaultREFlags())
throw (RegexException);
146 static std::vector<std::string> split(
const std::string &str,
const std::string &delim = Delim(),
bool exact =
false,
bool empty =
true,
size_t limit = -1)
throw ();
147 static std::vector<std::string> split(
const std::string &str,
char delim,
bool empty =
true,
size_t limit = -1)
throw ();
148 static std::vector<std::string> split(
const std::string &str,
const boost::regex &delim,
bool empty =
true,
size_t limit = -1)
throw ();
150 static std::vector<std::string> split_csv(
const std::string &line,
const std::string &delim,
bool empty =
true,
size_t limit = -1)
throw ();
152 static std::string join(
const std::vector<std::string> &src,
const std::string &delim,
char quote =
'\0',
const std::string &empty = nil(),
const std::string &lbr = nil(),
const std::string &rbr = nil(),
size_t threshold = 1)
throw ();
153 static std::string join(
const std::vector<std::string> &src,
char delim =
',',
char quote =
'\0',
const std::string &empty = nil(),
const std::string &lbr = nil(),
const std::string &rbr = nil(),
size_t threshold = 1)
throw ();
154 static std::string join(
const std::list<std::string> &src,
const std::string &delim,
char quote =
'\0',
const std::string &empty = nil(),
const std::string &lbr = nil(),
const std::string &rbr = nil(),
size_t threshold = 1)
throw ();
155 static std::string join(
const std::list<std::string> &src,
char delim =
',',
char quote =
'\0',
const std::string &empty = nil(),
const std::string &lbr = nil(),
const std::string &rbr = nil(),
size_t threshold = 1)
throw ();
156 static std::string join(
const std::set<std::string> &src,
const std::string &delim,
char quote =
'\0',
const std::string &empty = nil(),
const std::string &lbr = nil(),
const std::string &rbr = nil(),
size_t threshold = 1)
throw ();
157 static std::string join(
const std::set<std::string> &src,
char delim =
',',
char quote =
'\0',
const std::string &empty = nil(),
const std::string &lbr = nil(),
const std::string &rbr = nil(),
size_t threshold = 1)
throw ();
158 static std::string join(
const std::vector<variant::Variant> &src,
const std::string &delim,
char quote =
'\0',
const std::string &empty = nil(),
const std::string &lbr = nil(),
const std::string &rbr = nil(),
size_t threshold = 1)
throw ();
159 static std::string join(
const std::vector<variant::Variant> &src,
char delim =
',',
char quote =
'\0',
const std::string &empty = nil(),
const std::string &lbr = nil(),
const std::string &rbr = nil(),
size_t threshold = 1)
throw ();
161 static std::string trim(
const std::string &str,
const std::string &space = Whitespace())
throw ();
162 static std::string trim(
const std::string &str,
char space)
throw ();
163 static std::string& trim(std::string &str,
const std::string &space = Whitespace())
throw ();
164 static std::string& trim(std::string &str,
char space)
throw ();
165 static std::string rtrim(
const std::string &str,
const std::string &space = Whitespace())
throw ();
166 static std::string rtrim(
const std::string &str,
char space)
throw ();
167 static std::string& rtrim(std::string &str,
const std::string &space = Whitespace())
throw ();
168 static std::string& rtrim(std::string &str,
char space)
throw ();
169 static std::string ltrim(
const std::string &str,
const std::string &space = Whitespace())
throw ();
170 static std::string ltrim(
const std::string &str,
char space)
throw ();
171 static std::string& ltrim(std::string &str,
const std::string &space = Whitespace())
throw ();
172 static std::string& ltrim(std::string &str,
char space)
throw ();
174 static std::string lower(
const std::string &src)
throw ();
175 static std::string& lower(std::string &src)
throw ();
176 static std::string upper(
const std::string &src)
throw ();
177 static std::string& upper(std::string &src)
throw ();
178 static std::string ucfirst(
const std::string &src)
throw ();
179 static std::string& ucfirst(std::string &src)
throw ();
180 static std::string ucword(
const std::string &src)
throw ();
181 static std::string& ucword(std::string &src)
throw ();
183 static std::string itoa(int64_t src,
int base = 10)
throw ();
184 static std::string itoa(uint64_t src,
int base = 10)
throw ();
186 static std::string itoa(
int src,
int base = 10)
throw () {
return itoa((int64_t) src, base); }
187 static std::string itoa(
unsigned int src,
int base = 10)
throw () {
return itoa((int64_t) src, base); }
188 static std::string itoa(
long long src,
int base = 10)
throw () {
return itoa((int64_t) src, base); }
189 static std::string itoa(
unsigned long long src,
int base = 10)
throw () {
return itoa((uint64_t) src, base); }
191 static std::string itoa(
long src,
int base = 10)
throw () {
return itoa((int64_t) src, base); }
192 static std::string itoa(
unsigned long src,
int base = 10)
throw () {
return itoa((uint64_t) src, base); }
194 static char* itoa(int64_t src,
char *dst,
size_t &len,
int base = 10)
throw ();
195 static char* itoa(uint64_t src,
char *dst,
size_t &len,
int base = 10)
throw ();
197 static char* itoa(
int src,
char *dst,
size_t &len,
int base = 10)
throw () {
return itoa((int64_t) src, dst, len, base); }
198 static char* itoa(
unsigned int src,
char *dst,
size_t &len,
int base = 10)
throw () {
return itoa((uint64_t) src, dst, len, base); }
199 static char* itoa(
long long src,
char *dst,
size_t &len,
int base = 10)
throw () {
return itoa((int64_t) src, dst, len, base); }
200 static char* itoa(
unsigned long long src,
char *dst,
size_t &len,
int base = 10)
throw () {
return itoa((uint64_t) src, dst, len, base); }
202 static char* itoa(
long src,
char *dst,
size_t &len,
int base = 10)
throw () {
return itoa((int64_t) src, dst, len, base); }
203 static char* itoa(
unsigned long src,
char *dst,
size_t &len,
int base = 10)
throw () {
return itoa((uint64_t) src, dst, len, base); }
206 static std::string bandwidth(int64_t bps,
int decimals = 0)
throw ();
207 static std::string bandwidth(uint64_t bps,
int decimals = 0)
throw ();
209 static std::string bandwidth(
int bps,
int decimals = 0)
throw () {
return bandwidth((int64_t) bps, decimals); }
210 static std::string bandwidth(
unsigned int bps,
int decimals = 0)
throw () {
return bandwidth((uint64_t) bps, decimals); }
211 static std::string bandwidth(
long long bps,
int decimals = 0)
throw () {
return bandwidth((int64_t) bps, decimals); }
212 static std::string bandwidth(
unsigned long long bps,
int decimals = 0)
throw () {
return bandwidth((uint64_t) bps, decimals); }
214 static std::string bandwidth(
long bps,
int decimals = 0)
throw () {
return bandwidth((int64_t) bps, decimals); }
215 static std::string bandwidth(
unsigned long bps,
int decimals = 0)
throw () {
return bandwidth((uint64_t) bps, decimals); }
218 static std::string rate(int64_t bps,
int decimals = 0,
const std::string &suffix =
"s")
throw ();
219 static std::string rate(uint64_t bps,
int decimals = 0,
const std::string &suffix =
"s")
throw ();
221 static std::string rate(
int bps,
int decimals = 0,
const std::string &suffix =
"s")
throw () {
return rate((int64_t) bps, decimals, suffix); }
222 static std::string rate(
unsigned int bps,
int decimals = 0,
const std::string &suffix =
"s")
throw () {
return rate((uint64_t) bps, decimals, suffix); }
223 static std::string rate(
long long bps,
int decimals = 0,
const std::string &suffix =
"s")
throw () {
return rate((int64_t) bps, decimals, suffix); }
224 static std::string rate(
unsigned long long bps,
int decimals = 0,
const std::string &suffix =
"s")
throw () {
return rate((uint64_t) bps, decimals, suffix); }
226 static std::string rate(
long bps,
int decimals = 0,
const std::string &suffix =
"s")
throw () {
return rate((int64_t) bps, decimals, suffix); }
227 static std::string rate(
unsigned long bps,
int decimals = 0,
const std::string &suffix =
"s")
throw () {
return rate((uint64_t) bps, decimals, suffix); }
230 static std::string dataSize(int64_t bytes,
int decimals = 0)
throw ();
231 static std::string dataSize(uint64_t bytes,
int decimals = 0)
throw ();
233 static std::string dataSize(
int bytes,
int decimals = 0)
throw () {
return dataSize((int64_t) bytes, decimals); }
234 static std::string dataSize(
unsigned int bytes,
int decimals = 0)
throw () {
return dataSize((uint64_t) bytes, decimals); }
235 static std::string dataSize(
long long bytes,
int decimals = 0)
throw () {
return dataSize((int64_t) bytes, decimals); }
236 static std::string dataSize(
unsigned long long bytes,
int decimals = 0)
throw () {
return dataSize((uint64_t) bytes, decimals); }
238 static std::string dataSize(
long bytes,
int decimals = 0)
throw () {
return dataSize((int64_t) bytes, decimals); }
239 static std::string dataSize(
unsigned long bytes,
int decimals = 0)
throw () {
return dataSize((uint64_t) bytes, decimals); }
242 static uint64_t dataSize(
const std::string &dataSize)
throw ();
244 static std::string dataRate(int64_t bps,
int decimals = 0)
throw ();
245 static std::string dataRate(uint64_t bps,
int decimals = 0)
throw ();
247 static std::string dataRate(
int bps,
int decimals = 0)
throw () {
return dataRate((uint64_t) bps, decimals); }
248 static std::string dataRate(
unsigned int bps,
int decimals = 0)
throw () {
return dataRate((uint64_t) bps, decimals); }
249 static std::string dataRate(
long long bps,
int decimals = 0)
throw () {
return dataRate((uint64_t) bps, decimals); }
250 static std::string dataRate(
unsigned long long bps,
int decimals = 0)
throw () {
return dataRate((uint64_t) bps, decimals); }
252 static std::string dataRate(
long bps,
int decimals = 0)
throw () {
return dataRate((int64_t) bps, decimals); }
253 static std::string dataRate(
unsigned long bps,
int decimals = 0)
throw () {
return dataRate((uint64_t) bps, decimals); }
256 static uint64_t dataRate(
const std::string &dataRate)
throw ();
258 static std::string duration(int64_t usec,
int decimals = 0)
throw ();
259 static std::string duration(uint64_t usec,
int decimals = 0)
throw ();
261 static std::string duration(
int usec,
int decimals = 0)
throw () {
return duration((int64_t) usec, decimals); }
262 static std::string duration(
unsigned int usec,
int decimals = 0)
throw () {
return duration((uint64_t) usec, decimals); }
263 static std::string duration(
long long usec,
int decimals = 0)
throw () {
return duration((int64_t) usec, decimals); }
264 static std::string duration(
unsigned long long usec,
int decimals = 0)
throw () {
return duration((uint64_t) usec, decimals); }
266 static std::string duration(
long usec,
int decimals = 0)
throw () {
return duration((int64_t) usec, decimals); }
267 static std::string duration(
unsigned long usec,
int decimals = 0)
throw () {
return duration((uint64_t) usec, decimals); }
270 static std::string scale(int64_t value,
int decimals = 0)
throw ();
271 static std::string scale(uint64_t value,
int decimals = 0)
throw ();
273 static std::string scale(
int value,
int decimals = 0)
throw () {
return scale((int64_t) value, decimals); }
274 static std::string scale(
unsigned int value,
int decimals = 0)
throw () {
return scale((uint64_t) value, decimals); }
275 static std::string scale(
long long value,
int decimals = 0)
throw () {
return scale((int64_t) value, decimals); }
276 static std::string scale(
unsigned long long value,
int decimals = 0)
throw () {
return scale((uint64_t) value, decimals); }
278 static std::string scale(
long value,
int decimals = 0)
throw () {
return scale((int64_t) value, decimals); }
279 static std::string scale(
unsigned long value,
int decimals = 0)
throw () {
return scale((uint64_t) value, decimals); }
282 static std::string deflate(
const std::string &src, Algo algo = Zlib,
int level = DefaultLevel)
throw (CompressionException);
283 static std::vector<char> deflate(
const std::vector<char> &src, Algo algo = Zlib,
int level = DefaultLevel,
size_t size = 0)
throw (CompressionException);
284 static std::string inflate(
const std::string &src, Algo algo = Auto)
throw (CompressionException);
285 static std::vector<char> inflate(
const std::vector<char> &src, Algo algo = Auto,
size_t size = 0)
throw (CompressionException);
287 static std::string encrypt(
const std::string &src,
const std::string &password,
const std::string &salt = DefaultSalt(), uint32_t seed = 0)
throw (CryptException);
288 static std::string& encrypt(std::string &src,
const std::string &password,
const std::string &salt = DefaultSalt(), uint32_t seed = 0)
throw (CryptException);
289 static std::string decrypt(
const std::string &src,
const std::string &password,
const std::string &salt = DefaultSalt(), uint32_t seed = 0)
throw (CryptException);
290 static std::string& decrypt(std::string &src,
const std::string &password,
const std::string &salt = DefaultSalt(), uint32_t seed = 0)
throw (CryptException);
292 static std::string random(
size_t len,
const std::string &charset = AlphaNumericMixedCase(), uint32_t seed = 0)
throw ();
294 static std::string base64_encode(
unsigned char const *src,
unsigned int in_len,
bool standard =
true)
throw ();
295 static std::string base64_encode(
const std::string &src,
bool standard =
true)
throw ();
296 static std::string base64_decode(
const std::string &src,
bool standard =
true)
throw ();
298 static bool isPrintable(
const std::string &src)
throw ();