00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00032
00033 #pragma once
00034
00035 #include "../api_core.h"
00036 #include <string>
00037
00038 class CL_StringRef8;
00039
00043 class CL_API_CORE CL_StringData8
00044 {
00045 public:
00046 typedef unsigned int size_type;
00047 static const size_type npos;
00048 typedef char char_type;
00049 typedef char *iterator;
00050 typedef const char *const_iterator;
00051
00052 CL_StringData8();
00053
00058 CL_StringData8(const char *ptr, size_type length);
00059
00063 iterator begin() { return (iterator) data_ptr; }
00064
00068 iterator end() { return begin() + data_length; }
00069
00073 const_iterator begin() const { return (const_iterator) data_ptr; }
00074
00078 const_iterator end() const { return begin() + data_length; }
00079
00080
00081
00082
00083
00084
00085 const char &operator[](size_type n) const { return *(data_ptr + n); }
00086 char &operator[](size_type n) { return *(data_ptr + n); }
00087
00088 const char *data() const { return data_ptr; }
00089
00093 char *data() { return data_ptr; }
00094
00098 operator std::string() const;
00099
00103 operator CL_StringRef8() const;
00104
00108 size_type size() const { return data_length; }
00109
00113 size_type length() const { return data_length; }
00114
00118 bool empty() const { return data_length == 0; }
00119
00126 size_type find(const CL_StringData8 &s, size_type pos = 0) const;
00127
00135 size_type find(const char *s, size_type pos, size_type n) const;
00136
00143 size_type find(const char *s, size_type pos = 0) const;
00144
00151 size_type find(char c, size_type pos = 0) const;
00152
00159 size_type rfind(const CL_StringData8 &s, size_type pos = npos) const;
00160
00168 size_type rfind(const char *s, size_type pos, size_type n) const;
00169
00176 size_type rfind(const char *s, size_type pos = npos) const;
00177
00184 size_type rfind(char c, size_type pos = npos) const;
00185
00192 size_type find_first_of(const CL_StringData8 &s, size_type pos = 0) const;
00193
00201 size_type find_first_of(const char *s, size_type pos, size_type n) const;
00202
00209 size_type find_first_of(const char *s, size_type pos = 0) const;
00210
00217 size_type find_first_of(char c, size_type pos = 0) const;
00218
00225 size_type find_first_not_of(const CL_StringData8 &s, size_type pos = 0) const;
00226
00234 size_type find_first_not_of(const char *s, size_type pos, size_type n) const;
00235
00242 size_type find_first_not_of(const char *s, size_type pos = 0) const;
00243
00250 size_type find_first_not_of(char c, size_type pos = 0) const;
00251
00258 size_type find_last_of(const CL_StringData8 &s, size_type pos = npos) const;
00259
00267 size_type find_last_of(const char *s, size_type pos, size_type n) const;
00268
00275 size_type find_last_of(const char *s, size_type pos = npos) const;
00276
00283 size_type find_last_of(char c, size_type pos = npos) const;
00284
00291 size_type find_last_not_of(const CL_StringData8 &s, size_type pos = npos) const;
00292
00300 size_type find_last_not_of(const char *s, size_type pos, size_type n) const;
00301
00308 size_type find_last_not_of(const char *s, size_type pos = npos) const;
00309
00316 size_type find_last_not_of(char c, size_type pos = npos) const;
00317
00324 CL_StringRef8 substr(size_type pos = 0, size_type n = npos) const;
00325
00331 int compare(const CL_StringData8 &s) const;
00332
00340 int compare(size_type pos, size_type n, const CL_StringData8 &s) const;
00341
00351 int compare(size_type pos, size_type n, const CL_StringData8 &s, size_type pos1, size_type n1) const;
00352
00358 int compare(const char *s) const;
00359
00368 int compare(size_type pos, size_type n, const char *s, size_type len = npos) const;
00369
00370
00371 size_type utf8_length() const;
00372 protected:
00373 mutable char *data_ptr;
00374 mutable size_type data_length;
00375 };
00376
00377 CL_API_CORE bool operator==(const CL_StringData8 &s1, const CL_StringData8 &s2);
00378 CL_API_CORE bool operator==(const char *s1, const CL_StringData8 &s2);
00379 CL_API_CORE bool operator==(const CL_StringData8 &s1, const char *s2);
00380 CL_API_CORE bool operator!=(const CL_StringData8 &s1, const CL_StringData8 &s2);
00381 CL_API_CORE bool operator!=(const char *s1, const CL_StringData8 &s2);
00382 CL_API_CORE bool operator!=(const CL_StringData8 &s1, const char *s2);
00383 CL_API_CORE bool operator<(const CL_StringData8 &s1, const CL_StringData8 &s2);
00384 CL_API_CORE bool operator<(const char *s1, const CL_StringData8 &s2);
00385 CL_API_CORE bool operator<(const CL_StringData8 &s1, const char *s2);
00386 CL_API_CORE bool operator>(const CL_StringData8 &s1, const CL_StringData8 &s2);
00387 CL_API_CORE bool operator>(const char *s1, const CL_StringData8 &s2);
00388 CL_API_CORE bool operator>(const CL_StringData8 &s1, const char *s2);
00389