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_StringRef16;
00039
00043 class CL_API_CORE CL_StringData16
00044 {
00045 public:
00046 typedef unsigned int size_type;
00047 static const size_type npos;
00048 typedef wchar_t char_type;
00049 typedef wchar_t *iterator;
00050 typedef const wchar_t *const_iterator;
00051
00052 CL_StringData16();
00053
00058 CL_StringData16(const wchar_t *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 wchar_t &operator[](size_type n) const { return *(data_ptr + n); }
00086 wchar_t &operator[](size_type n) { return *(data_ptr + n); }
00087
00088 const wchar_t *data() const { return data_ptr; }
00089
00093 wchar_t *data() { return data_ptr; }
00094
00098 operator std::wstring() const;
00099
00103 operator CL_StringRef16() 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_StringData16 &s, size_type pos = 0) const;
00127
00135 size_type find(const wchar_t *s, size_type pos, size_type n) const;
00136
00143 size_type find(const wchar_t *s, size_type pos = 0) const;
00144
00151 size_type find(wchar_t c, size_type pos = 0) const;
00152
00159 size_type rfind(const CL_StringData16 &s, size_type pos = npos) const;
00160
00168 size_type rfind(const wchar_t *s, size_type pos, size_type n) const;
00169
00176 size_type rfind(const wchar_t *s, size_type pos = npos) const;
00177
00184 size_type rfind(wchar_t c, size_type pos = npos) const;
00185
00192 size_type find_first_of(const CL_StringData16 &s, size_type pos = 0) const;
00193
00201 size_type find_first_of(const wchar_t *s, size_type pos, size_type n) const;
00202
00209 size_type find_first_of(const wchar_t *s, size_type pos = 0) const;
00210
00217 size_type find_first_of(wchar_t c, size_type pos = 0) const;
00218
00225 size_type find_first_not_of(const CL_StringData16 &s, size_type pos = 0) const;
00226
00234 size_type find_first_not_of(const wchar_t *s, size_type pos, size_type n) const;
00235
00242 size_type find_first_not_of(const wchar_t *s, size_type pos = 0) const;
00243
00250 size_type find_first_not_of(wchar_t c, size_type pos = 0) const;
00251
00258 size_type find_last_of(const CL_StringData16 &s, size_type pos = npos) const;
00259
00267 size_type find_last_of(const wchar_t *s, size_type pos, size_type n) const;
00268
00275 size_type find_last_of(const wchar_t *s, size_type pos = npos) const;
00276
00283 size_type find_last_of(wchar_t c, size_type pos = npos) const;
00284
00291 size_type find_last_not_of(const CL_StringData16 &s, size_type pos = npos) const;
00292
00300 size_type find_last_not_of(const wchar_t *s, size_type pos, size_type n) const;
00301
00308 size_type find_last_not_of(const wchar_t *s, size_type pos = npos) const;
00309
00316 size_type find_last_not_of(wchar_t c, size_type pos = npos) const;
00317
00324 CL_StringRef16 substr(size_type pos = 0, size_type n = npos) const;
00325
00331 int compare(const CL_StringData16 &s) const;
00332
00340 int compare(size_type pos, size_type n, const CL_StringData16 &s) const;
00341
00351 int compare(size_type pos, size_type n, const CL_StringData16 &s, size_type pos1, size_type n1) const;
00352
00358 int compare(const wchar_t *s) const;
00359
00368 int compare(size_type pos, size_type n, const wchar_t *s, size_type len = npos) const;
00369
00370 protected:
00371 mutable wchar_t *data_ptr;
00372 mutable size_type data_length;
00373 };
00374
00375 CL_API_CORE bool operator==(const CL_StringData16 &s1, const CL_StringData16 &s2);
00376 CL_API_CORE bool operator==(const wchar_t *s1, const CL_StringData16 &s2);
00377 CL_API_CORE bool operator==(const CL_StringData16 &s1, const wchar_t *s2);
00378 CL_API_CORE bool operator!=(const CL_StringData16 &s1, const CL_StringData16 &s2);
00379 CL_API_CORE bool operator!=(const wchar_t *s1, const CL_StringData16 &s2);
00380 CL_API_CORE bool operator!=(const CL_StringData16 &s1, const wchar_t *s2);
00381 CL_API_CORE bool operator<(const CL_StringData16 &s1, const CL_StringData16 &s2);
00382 CL_API_CORE bool operator<(const wchar_t *s1, const CL_StringData16 &s2);
00383 CL_API_CORE bool operator<(const CL_StringData16 &s1, const wchar_t *s2);
00384 CL_API_CORE bool operator>(const CL_StringData16 &s1, const CL_StringData16 &s2);
00385 CL_API_CORE bool operator>(const wchar_t *s1, const CL_StringData16 &s2);
00386 CL_API_CORE bool operator>(const CL_StringData16 &s1, const wchar_t *s2);
00387