33 #ifndef GOOGLE_PROTOBUF_STUBS_STRUTIL_H__
34 #define GOOGLE_PROTOBUF_STUBS_STRUTIL_H__
44 #define strtoll _strtoi64
45 #define strtoull _strtoui64
46 #elif defined(__DECCXX) && defined(__osf__)
48 #define strtoll strtol
49 #define strtoull strtoul
63 return (
'a' <= c && c <=
'z') ||
64 (
'A' <= c && c <=
'Z') ||
65 (
'0' <= c && c <=
'9');
69 return (
'0' <= c && c <=
'9');
81 const string& prefix) {
82 return str.size() >= prefix.size() &&
83 str.compare(0, prefix.size(), prefix) == 0;
88 return str.substr(prefix.size());
103 const string& suffix) {
104 return str.size() >= suffix.size() &&
105 str.compare(str.size() - suffix.size(), suffix.size(), suffix) == 0;
110 return str.substr(0, str.size() - suffix.size());
137 string::iterator end = s->end();
138 for (string::iterator i = s->begin(); i != end; ++i) {
140 if (
'A' <= *i && *i <=
'Z') *i +=
'a' -
'A';
145 string::iterator end = s->end();
146 for (string::iterator i = s->begin(); i != end; ++i) {
148 if (
'a' <= *i && *i <=
'z') *i +=
'A' -
'a';
152 inline string ToUpper(
const string& s) {
167 const string& newsub,
bool replace_all);
176 vector<string>* res);
188 vector<string>* result);
194 inline vector<string>
Split(
195 const string& full,
const char* delim,
bool skip_empty =
true) {
196 vector<string> result;
214 const char* delim,
string* result);
216 inline string JoinStrings(
const vector<string>& components,
256 vector<string> *errors);
275 vector<string> *errors);
289 char* dest,
int dest_len);
323 inline int32 strto32(
const char *nptr,
char **endptr,
int base) {
324 if (
sizeof(
int32) ==
sizeof(
long))
325 return strtol(nptr, endptr, base);
330 inline uint32 strtou32(
const char *nptr,
char **endptr,
int base) {
331 if (
sizeof(
uint32) ==
sizeof(
unsigned long))
332 return strtoul(nptr, endptr, base);
339 inline int64 strto64(
const char *nptr,
char **endptr,
int base) {
341 sizeof_int64_is_not_sizeof_long_long);
342 return strtoll(nptr, endptr, base);
345 inline uint64 strtou64(
const char *nptr,
char **endptr,
int base) {
347 sizeof_uint64_is_not_sizeof_long_long);
348 return strtoull(nptr, endptr, base);
396 return (
sizeof(i) == 4 ?
400 return (
sizeof(i) == 4 ?
404 return (
sizeof(i) == 4 ?
408 return (
sizeof(i) == 4 ?
504 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5>
506 const T1& a,
const T2& b,
const T3& c,
const T4& d,
const T5& e) {
511 template <
typename T1,
typename T2,
typename T3,
typename T4>
513 const T1& a,
const T2& b,
const T3& c,
const T4& d) {
518 template <
typename T1,
typename T2,
typename T3>
524 template <
typename T1,
typename T2>
534 template <
typename Iterator>
535 void Join(Iterator start, Iterator end,
536 const char* delim,
string* result) {
537 for (Iterator it = start; it != end; ++it) {
539 result->append(delim);
545 template <
typename Range>
546 string Join(
const Range& components,
549 Join(components.begin(), components.end(), delim, &result);
562 #endif // GOOGLE_PROTOBUF_STUBS_STRUTIL_H__
string StrCat(const T1 &a, const T2 &b, const T3 &c, const T4 &d, const T5 &e)
Definition: strutil.h:505
LIBPROTOBUF_EXPORT string CEscape(const string &src)
string StripPrefixString(const string &str, const string &prefix)
Definition: strutil.h:86
bool ascii_isalnum(char c)
Definition: strutil.h:62
string ToUpper(const string &s)
Definition: strutil.h:152
char * FastUIntToBuffer(unsigned int i, char *buffer)
Definition: strutil.h:399
LIBPROTOBUF_EXPORT string SimpleFtoa(float value)
int64_t int64
Definition: Define.h:145
#define T4
Definition: Crypto_md5.cpp:156
LIBPROTOBUF_EXPORT char * FastInt32ToBuffer(int32 i, char *buffer)
LIBPROTOBUF_EXPORT string Utf8SafeCEscape(const string &src)
LIBPROTOBUF_EXPORT int CEscapeString(const char *src, int src_len, char *dest, int dest_len)
LIBPROTOBUF_EXPORT void SplitStringUsing(const string &full, const char *delim, vector< string > *res)
LIBPROTOBUF_EXPORT void SplitStringAllowEmpty(const string &full, const char *delim, vector< string > *result)
LIBPROTOBUF_EXPORT char * FloatToBuffer(float i, char *buffer)
uint32 strtou32(const char *nptr, char **endptr, int base)
Definition: strutil.h:330
LIBPROTOBUF_EXPORT char * FastHex64ToBuffer(uint64 i, char *buffer)
int32 strto32(const char *nptr, char **endptr, int base)
Definition: strutil.h:323
char * FastUInt64ToBuffer(uint64 i, char *buffer)
Definition: strutil.h:438
LIBPROTOBUF_EXPORT int32 strto32_adaptor(const char *nptr, char **endptr, int base)
#define T1
Definition: Crypto_md5.cpp:153
LIBPROTOBUF_EXPORT char * FastInt64ToBufferLeft(int64 i, char *buffer)
int32_t int32
Definition: common.h:172
LIBPROTOBUF_EXPORT char * FastUInt64ToBufferLeft(uint64 i, char *buffer)
char * FastLongToBuffer(long i, char *buffer)
Definition: strutil.h:403
LIBPROTOBUF_EXPORT bool safe_int(string text, int32 *value_p)
int64 strto64(const char *nptr, char **endptr, int base)
Definition: strutil.h:339
LIBPROTOBUF_EXPORT void StripString(string *s, const char *remove, char replacewith)
string ToString(int i)
Definition: strutil.h:491
LIBPROTOBUF_EXPORT string ToHex(uint64 num)
#define T3
Definition: Crypto_md5.cpp:155
static const int kFastToBufferSize
Definition: strutil.h:384
void UpperString(string *s)
Definition: strutil.h:144
#define T2
Definition: Crypto_md5.cpp:154
void Join(Iterator start, Iterator end, const char *delim, string *result)
Definition: strutil.h:535
char * FastUInt32ToBuffer(uint32 i, char *buffer)
Definition: strutil.h:434
LIBPROTOBUF_EXPORT char * FastInt64ToBuffer(int64 i, char *buffer)
void LowerString(string *s)
Definition: strutil.h:136
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: common.h:177
uint32_t uint32
Definition: Define.h:150
LIBPROTOBUF_EXPORT string CHexEscape(const string &src)
static const int kFloatToBufferSize
Definition: strutil.h:485
uint64_t uint64
Definition: Define.h:149
bool ascii_isdigit(char c)
Definition: strutil.h:68
LIBPROTOBUF_EXPORT char * FastInt32ToBufferLeft(int32 i, char *buffer)
uint64_t uint64
Definition: common.h:178
LIBPROTOBUF_EXPORT string StringReplace(const string &s, const string &oldsub, const string &newsub, bool replace_all)
LIBPROTOBUF_EXPORT string SimpleItoa(int i)
LIBPROTOBUF_EXPORT int UnescapeCEscapeSequences(const char *source, char *dest)
LIBPROTOBUF_EXPORT char * DoubleToBuffer(double i, char *buffer)
#define T5
Definition: Crypto_md5.cpp:157
Definition: document.h:390
#define LIBPROTOBUF_EXPORT
Definition: common.h:105
bool safe_strto32(string text, int32 *value)
Definition: strutil.h:356
bool HasPrefixString(const string &str, const string &prefix)
Definition: strutil.h:80
LIBPROTOBUF_EXPORT string SimpleDtoa(double value)
#define GOOGLE_COMPILE_ASSERT(expr, msg)
Definition: common.h:380
vector< string > Split(const string &full, const char *delim, bool skip_empty=true)
Definition: strutil.h:194
LIBPROTOBUF_EXPORT char * FastHex32ToBuffer(uint32 i, char *buffer)
int64_t int64
Definition: common.h:173
uint64 strtou64(const char *nptr, char **endptr, int base)
Definition: strutil.h:345
Definition: BnetFileGenerator.h:47
char * FastULongToBuffer(unsigned long i, char *buffer)
Definition: strutil.h:407
const FieldDescriptor value
Definition: descriptor.h:1522
bool HasSuffixString(const string &str, const string &suffix)
Definition: strutil.h:102
LIBPROTOBUF_EXPORT char * FastUInt32ToBufferLeft(uint32 i, char *buffer)
LIBPROTOBUF_EXPORT char * FastHexToBuffer(int i, char *buffer)
LIBPROTOBUF_EXPORT uint32 strtou32_adaptor(const char *nptr, char **endptr, int base)
static const int kDoubleToBufferSize
Definition: strutil.h:484
LIBPROTOBUF_EXPORT void JoinStrings(const vector< string > &components, const char *delim, string *result)
string StripSuffixString(const string &str, const string &suffix)
Definition: strutil.h:108
char * FastIntToBuffer(int i, char *buffer)
Definition: strutil.h:395
LIBPROTOBUF_EXPORT int UnescapeCEscapeString(const string &src, string *dest)