00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _IAIUNICODESTRING_H_
00024 #define _IAIUNICODESTRING_H_
00025
00026 #include "AITypes.h"
00027 #include "AICharacterEncoding.h"
00028 #include "IAIAutoBuffer.h"
00029
00030 #include <string>
00031 #include <iterator>
00032 #include <stdexcept>
00033
00034 #if defined(MAC_ENV)
00035 #import <CoreFoundation/CFString.h>
00036 #if defined _UTF16_BASIC_STRING_EXPORT_H_
00037 #include _UTF16_BASIC_STRING_EXPORT_H_
00038 #endif
00039 #endif // defined(MAC_ENV)
00040
00041
00044 class CAIUnicodeStringImpl;
00045
00049 #define kUnicodeStringBadIndex 'US!I'
00050
00053 #define kUnicodeStringLengthError 'US#L'
00054
00057 #define kUnicodeStringMalformedError 'US!F'
00058
00059
00060 namespace ai {
00061
00063 class const_PStr
00064 {
00065 public:
00069 explicit const_PStr(const unsigned char* pascalString) : fConstStr(pascalString) {};
00071 virtual ~const_PStr() {}
00075 const_PStr(const const_PStr& p) : fConstStr(p.fConstStr) {};
00078 const unsigned char* get() const
00079 { return fConstStr; }
00082 const unsigned char& operator[] (size_t i) const
00083 { return fConstStr[i]; }
00084 protected:
00085 const unsigned char* fConstStr;
00086 const_PStr& operator=(const const_PStr&);
00087
00088 };
00089
00091 class PStr : public const_PStr
00092 {
00093 public:
00097 explicit PStr(unsigned char* pascalString) : const_PStr(pascalString) {};
00101 PStr(const PStr& p) : const_PStr(p) {};
00104 unsigned char* get() const
00105 { return const_cast<unsigned char*>(fConstStr); }
00108 unsigned char& operator[] (size_t i) const
00109 { return get()[i]; }
00111
00112
00113 };
00114
00115
00116 #if defined(WIN_ENV)
00117
00118 class UnicodeString;
00119
00129 class WCHARStr
00130 {
00131 public:
00133 typedef wchar_t WCHAR;
00135 typedef const WCHAR* LPCWSTR;
00137 typedef WCHAR* LPWSTR;
00138
00139 public:
00143 WCHARStr () : fConstStr() {}
00148 WCHARStr (const ai::UnicodeString& string);
00149
00150 #if defined(_NATIVE_WCHAR_T_DEFINED)
00151
00152
00158 WCHARStr (LPCWSTR wcharString);
00159 #endif // defined(_NATIVE_WCHAR_T_DEFINED)
00160
00166 WCHARStr (const ASUnicode* string);
00167
00171 WCHARStr (const WCHARStr& p) : fConstStr(p.fConstStr) {}
00172
00173 #if defined(AI_HAS_RVALUE_REFERENCES) && defined(AI_HAS_DEFAULTED_FUNCTIONS)
00174
00175 WCHARStr (WCHARStr&&) = default;
00176 #endif
00177
00179 virtual ~WCHARStr() {}
00180
00181
00183 WCHARStr& operator= (const WCHARStr& rhs)
00184 {
00185 fConstStr = rhs.fConstStr;
00186 return *this;
00187 }
00188
00189 #if defined(AI_HAS_RVALUE_REFERENCES) && defined(AI_HAS_DEFAULTED_FUNCTIONS)
00190
00191 WCHARStr& operator= (WCHARStr&&) = default;
00192 #endif
00193
00198 LPCWSTR as_LPCWSTR () const
00199 {
00200 return fConstStr.c_str();
00201 }
00202
00207 const ASUnicode* as_ASUnicode () const;
00208
00212 size_t length() const;
00213
00214
00215 #if defined(_NATIVE_WCHAR_T_DEFINED)
00216
00217 operator LPCWSTR () const
00218 {
00219 return as_LPCWSTR();
00220 }
00221 #endif //defined(_NATIVE_WCHAR_T_DEFINED)
00222
00223 operator const ASUnicode* () const
00224 {
00225 return as_ASUnicode();
00226 }
00227
00228 protected:
00229 std::basic_string<WCHAR> fConstStr;
00230 };
00231
00232 #endif
00233
00243 class UnicodeString {
00244 public:
00246 typedef ai::sizediff_t offset_type;
00248 typedef size_t size_type;
00250 typedef ASUInt32 UTF32TextChar;
00252 typedef ASUnicode UTF16Char;
00253
00254 typedef UTF32TextChar value_type;
00255
00256
00258 static const size_type npos;
00259
00262 enum NormalizedForm {
00264 kForm_NFD = 0,
00266 kForm_NFC,
00268 kForm_NFKD,
00270 kForm_NFKC,
00271
00273 kForm_DummyValue = 0xFFFFFFFF
00274 };
00275
00277 class Collator;
00278
00279
00280
00281
00282 class const_iterator;
00283 friend class const_iterator;
00284
00285 public:
00286 class const_iterator
00287 : public std::iterator<std::random_access_iterator_tag, UnicodeString::value_type>
00288 {
00289 public:
00290 typedef const_iterator self_type;
00291 typedef UnicodeString::size_type size_type;
00292 typedef const UnicodeString* container_type;
00293
00294
00295
00296 const_iterator() : fIndex(0), fStringContainer(nullptr)
00297 {
00298 }
00299
00300
00301 const_iterator(size_type index, container_type container)
00302 : fIndex(index), fStringContainer(container)
00303 {
00304 }
00305
00306 const_iterator(const self_type& rhs) = default;
00307 self_type& operator=(const self_type& rhs) = default;
00308
00309 value_type operator*() const
00310 {
00311 if (!fStringContainer || fIndex >= fStringContainer->size())
00312 {
00313 throw std::out_of_range{"string iterator not dereferencable"};
00314 }
00315
00316 return (*fStringContainer)[fIndex];
00317 }
00318
00319 self_type& operator++()
00320 {
00321 ++fIndex;
00322 return (*this);
00323 }
00324
00325 self_type operator++(int)
00326 {
00327 auto temp = *this;
00328 ++(*this);
00329 return temp;
00330 }
00331
00332 self_type& operator--()
00333 {
00334 --fIndex;
00335 return (*this);
00336 }
00337
00338 self_type operator--(int)
00339 {
00340 auto temp = *this;
00341 --(*this);
00342 return temp;
00343 }
00344
00345 self_type& operator+=(difference_type offset)
00346 {
00347 fIndex += offset;
00348 return (*this);
00349 }
00350
00351 self_type operator+(difference_type offset) const
00352 {
00353 self_type temp = *this;
00354 return (temp += offset);
00355 }
00356
00357 self_type& operator-=(difference_type offset)
00358 {
00359 fIndex -= offset;
00360 return (*this);
00361 }
00362
00363 self_type operator-(difference_type offset) const
00364 {
00365 self_type temp = *this;
00366 return (temp -= offset);
00367 }
00368
00369 difference_type operator-(const self_type& rhs) const
00370 {
00371 return (fIndex - rhs.fIndex);
00372 }
00373
00374 bool operator==(const self_type& rhs) const
00375 {
00376 return (fIndex == rhs.fIndex);
00377 }
00378
00379 bool operator!=(const self_type& rhs) const
00380 {
00381 return !(*this == rhs);
00382 }
00383
00384 bool operator<(const self_type& rhs) const
00385 {
00386 return (fIndex < rhs.fIndex);
00387 }
00388
00389 bool operator>(const self_type& rhs) const
00390 {
00391 return (rhs < *this);
00392 }
00393
00394 bool operator<=(const self_type& rhs) const
00395 {
00396 return (!(rhs < *this));
00397 }
00398
00399 bool operator>=(const self_type& rhs) const
00400 {
00401 return (!(*this < rhs));
00402 }
00403
00404 private:
00405 bool compatible(const self_type& rhs) const
00406 {
00407 return (fStringContainer->fImpl == rhs.fStringContainer->fImpl);
00408 }
00409
00410 private:
00411 size_type fIndex = 0;
00412 container_type fStringContainer;
00413 };
00414
00415
00417
00419
00421 explicit UnicodeString () AINOTHROW;
00428 explicit UnicodeString (const char* string, offset_type srcByteLen,
00429 AICharacterEncoding encoding = kAIPlatformCharacterEncoding);
00430
00435 explicit UnicodeString (size_type count, UTF32TextChar ch);
00436
00441 explicit UnicodeString (const char* string, AICharacterEncoding encoding = kAIPlatformCharacterEncoding);
00442
00447 explicit UnicodeString (const std::string& string, AICharacterEncoding encoding = kAIPlatformCharacterEncoding);
00448
00453 explicit UnicodeString (const ASUnicode* string);
00454
00458 explicit UnicodeString (const ZRef zStringKey);
00459
00465 explicit UnicodeString (const ASUnicode* string, size_type srcUTF16Count);
00466
00471 explicit UnicodeString (const std::basic_string<ASUnicode>& string);
00472
00476 UnicodeString (const UnicodeString& s);
00477
00478 #ifdef AI_HAS_RVALUE_REFERENCES
00479
00482 UnicodeString(UnicodeString&& other) AINOEXCEPT;
00483 #endif // AI_HAS_RVALUE_REFERENCES
00484
00486 ~UnicodeString ();
00488
00489
00491
00493
00499 static UnicodeString FromRoman (const char* string, size_type count);
00500
00506 static UnicodeString FromRoman (const char* string);
00507
00513 static UnicodeString FromRoman (const std::string& string);
00514
00520 static UnicodeString FromRoman (const const_PStr& pascalString);
00521
00528 static UnicodeString FromPlatform (const char* string, size_type count);
00529
00535 static UnicodeString FromPlatform (const char* string);
00536
00542 static UnicodeString FromPlatform (const std::string& string);
00543
00549 static UnicodeString FromPlatform (const const_PStr& pascalString);
00550
00556 static UnicodeString FromUTF8 (const char* string);
00557
00563 static UnicodeString FromUTF8 (const std::string& string);
00564
00570 static UnicodeString FromUTF8 (const const_PStr& pascalString);
00571
00573
00574
00575
00580 UnicodeString& append (const UnicodeString& str);
00581
00588 UnicodeString& append (const UnicodeString& str, size_type startOffset,
00589 size_type count);
00590
00596 UnicodeString& append (size_type count, UTF32TextChar ch)
00597 { return append(UnicodeString(count, ch)); }
00598
00603 UnicodeString& assign (const UnicodeString& str);
00604
00611 UnicodeString& assign (const UnicodeString& str, size_type offset,
00612 size_type count)
00613 { return assign(str.substr(offset, count)); }
00614
00620 UTF32TextChar at (size_type offset) const;
00621
00627 void clear ();
00628
00638 ai::int32 compare (const UnicodeString& str) const;
00639
00651 ai::int32 compare (size_type pos, size_type num, const UnicodeString& str) const;
00652
00666 ai::int32 compare (size_type pos, size_type num, const UnicodeString& str,
00667 size_type startOffset, size_type count) const;
00668
00672 size_type length () const;
00673
00677 bool empty () const;
00678
00684 UnicodeString& erase (size_type pos=0, size_type count = npos);
00685
00691 const_iterator erase (const_iterator position)
00692 {
00693 size_type index = position - begin();
00694 erase(index, 1);
00695 return (begin() + index);
00696 }
00697
00703 const_iterator erase (const_iterator first, const_iterator last)
00704 {
00705 size_type index = first - begin();
00706 erase(index, last - first);
00707 return (begin() + index);
00708 }
00709
00717 size_type find (UTF32TextChar ch, size_type startOffset = 0 ) const;
00718
00727 size_type find (const UnicodeString& target, size_type startOffset = 0) const;
00728
00737 size_type find (const UnicodeString& target, size_type startOffset, size_type count) const;
00738
00745 size_type caseFind (UTF32TextChar ch, size_type startOffset = 0 ) const
00746 { return caseFind(ai::UnicodeString(1, ch), startOffset, 1); }
00747
00755 size_type caseFind (const UnicodeString& target, size_type startOffset = 0) const
00756 { return caseFind(target, startOffset, target.length()); }
00757
00766 size_type caseFind (const UnicodeString& target, size_type startOffset, size_type count) const;
00767
00775 size_type rfind (UTF32TextChar ch, size_type startOffset = npos ) const;
00776
00785 size_type rfind (const UnicodeString& target, size_type startOffset = npos) const;
00786
00796 size_type rfind (const UnicodeString& target, size_type startOffset, size_type count) const;
00797
00805 size_type find_first_of (const UnicodeString& target, size_type startOffset = 0) const
00806 { return find_first_of(target, startOffset, npos); }
00807
00816 size_type find_first_of (const UnicodeString& target, size_type startOffset, size_type count) const;
00817
00825 size_type find_last_of (const UnicodeString& target, size_type startOffset = npos) const
00826 { return find_last_of(target, startOffset, npos); }
00827
00836 size_type find_last_of (const UnicodeString& target, size_type startOffset, size_type count) const;
00837
00845 size_type find_first_not_of (const UnicodeString& target, size_type startOffset = 0) const
00846 { return find_first_not_of(target, startOffset, npos); }
00847
00856 size_type find_first_not_of (const UnicodeString& target, size_type startOffset, size_type count) const;
00857
00865 size_type find_last_not_of (const UnicodeString& target, size_type startOffset = npos) const
00866 { return find_last_not_of (target, startOffset, npos); }
00867
00876 size_type find_last_not_of (const UnicodeString& target, size_type startOffset, size_type count) const;
00877
00884 UnicodeString& replace (size_type pos, size_type num, const UnicodeString& str)
00885 { return replace(pos, num, str, 0, npos); }
00886
00894 UnicodeString& replace (size_type pos, size_type num, const UnicodeString& str, size_type count)
00895 { return replace(pos, num, str, 0, count); }
00896
00905 UnicodeString& replace (size_type pos, size_type num, const UnicodeString& str,
00906 size_type startOffset, size_type count);
00907
00914 UnicodeString& insert (size_type insertOffset, const UnicodeString& str)
00915 { return insert(insertOffset, str, 0, npos); }
00916
00926 UnicodeString& insert (size_type insertOffset, const UnicodeString& str,
00927 size_type offset, size_type count);
00928
00936 UnicodeString& insert (size_type insertOffset, size_type count,
00937 UTF32TextChar ch)
00938 { return insert(insertOffset, UnicodeString(count, ch), 0, count); }
00939
00944 void push_back(UTF32TextChar ch)
00945 { (void) append(1, ch); }
00946
00953 void resize (size_type count, UTF32TextChar ch = UTF32TextChar());
00954
00959 ai::UnicodeString::size_type capacity () const;
00960
00968 void reserve (size_type count);
00969
00974 ai::UnicodeString::size_type size () const
00975 { return length(); }
00976
00983 UnicodeString substr (size_type offset = 0, size_type count = npos) const;
00984
00989 void swap (UnicodeString& str) AINOEXCEPT;
00990
00991
00992
00997 UnicodeString& operator= (const UnicodeString& rhs);
00998
00999 #ifdef AI_HAS_RVALUE_REFERENCES
01000
01004 UnicodeString& operator= (UnicodeString&& rhs) AINOEXCEPT;
01005 #endif // AI_HAS_RVALUE_REFERENCES
01006
01011 UnicodeString& operator+= (UTF32TextChar ch)
01012 { return append(1, ch); }
01013
01018 UnicodeString& operator+= (const UnicodeString& rhs)
01019 { return append(rhs); }
01020
01030 UTF32TextChar operator[] (size_type offset) const;
01031
01037 bool operator== (const UnicodeString& rhs) const
01038 { return compare(rhs) == 0; }
01039
01045 bool operator!= (const UnicodeString& rhs) const
01046 { return !(operator==(rhs)); }
01047
01053 bool operator< (const UnicodeString& rhs) const
01054 { return compare(rhs) < 0; }
01055
01059 const_iterator begin() const
01060 {
01061 return const_iterator(0, this);
01062 }
01063
01067 const_iterator end() const
01068 {
01069 return const_iterator(this->size(), this);
01070 }
01071
01072
01073
01078 UnicodeString& toLower();
01079
01085 UnicodeString& toUpper();
01086
01097 ai::int32 caseCompare (const UnicodeString& str) const
01098 { return caseCompare(0, npos, str, 0, npos); }
01099
01112 ai::int32 caseCompare (size_type pos, size_type num, const UnicodeString& str) const
01113 { return caseCompare(pos, num, str, 0, npos); }
01114
01131 ai::int32 caseCompare (size_type pos, size_type num, const UnicodeString& str,
01132 size_type startOffset, size_type count) const;
01133
01149 ai::int32 canonicalCompare (const UnicodeString& str) const;
01150
01166 ai::int32 canonicalCaseCompare (const UnicodeString& str) const;
01167
01175 UnicodeString& normalize (NormalizedForm form);
01176
01180 bool hasSurrogates () const;
01181
01192 size_type utf_16 (const UTF16Char*& buffer) const;
01193
01198 std::basic_string<ASUnicode> as_ASUnicode ( ) const;
01199
01203 std::string as_UTF8 ( ) const;
01204
01207 std::string as_Platform () const;
01208
01211 std::string as_Roman () const;
01212
01222 size_type getToBuffer ( char* buffer, size_type bufferMax, AICharacterEncoding encoding ) const;
01223
01232 size_type getToBuffer ( const PStr& pascalString, size_type bufferMax, AICharacterEncoding encoding ) const;
01233
01242 size_type as_ASUnicode (ASUnicode* buffer, size_type bufferMax ) const;
01243
01251 size_type as_Platform ( const PStr& pascalString, size_type bufferMax ) const;
01252
01260 size_type as_Platform ( char* buffer, size_type bufferMax ) const;
01261
01269 size_type as_Roman ( char* buffer, size_type bufferMax ) const;
01270
01278 size_type as_Roman ( const PStr& pascalString, size_type bufferMax ) const;
01279
01285 std::string getInStdString (AICharacterEncoding encoding) const;
01286
01293 size_type getAs (AICharacterEncoding encoding, ai::AutoBuffer<char>& b) const;
01294
01295 #if defined(MAC_ENV)
01296
01297
01299
01301
01304 explicit UnicodeString (const CFStringRef& cfString);
01305
01311 CFStringRef as_CFString (CFAllocatorRef alloc) const;
01313 #endif // defined(MAC_ENV)
01314
01315 #if defined(WIN_ENV)
01316
01317
01319
01321
01324 explicit UnicodeString (const WCHARStr& string);
01325
01329 WCHARStr as_WCHARStr () const;
01330
01339 size_type as_WCHARStr (WCHARStr::LPWSTR buffer, size_type bufferMax ) const;
01340
01342 #endif // defined(WIN_ENV)
01343
01344
01345 public:
01346 void deleteImpl();
01347
01348 protected:
01349 explicit UnicodeString(class CAIUnicodeStringImpl* impl);
01350
01351 private:
01352 mutable CAIUnicodeStringImpl* fImpl;
01353 };
01354
01360 inline UnicodeString operator+(UnicodeString lhs, const UnicodeString& rhs)
01361 {
01362 return lhs.append(rhs);
01363 }
01364
01366
01367
01368
01369
01371
01373
01374 inline void UnicodeString::swap(UnicodeString& str) AINOEXCEPT
01375 {
01376 std::swap(fImpl, str.fImpl);
01377 }
01378
01379 #ifdef AI_HAS_RVALUE_REFERENCES
01380
01381
01382 inline UnicodeString::UnicodeString(UnicodeString&& other) AINOEXCEPT
01383 : fImpl{other.fImpl}
01384 {
01385 other.fImpl = nullptr;
01386 }
01387
01388
01389 inline UnicodeString& UnicodeString::operator=(UnicodeString&& rhs) AINOEXCEPT
01390 {
01391 swap(rhs);
01392 return *this;
01393 }
01394
01395 #endif // AI_HAS_RVALUE_REFERENCES
01396
01397 inline UnicodeString& UnicodeString::insert (size_type insertOffset, const UnicodeString& str,
01398 size_type offset, size_type count)
01399 {
01400 if ( insertOffset > length() || offset > str.length() )
01401 throw ai::Error(kUnicodeStringBadIndex);
01402 UnicodeString result = substr(0, insertOffset);
01403 result.append(str, offset, count);
01404 result.append(substr(insertOffset));
01405
01406 *this = result;
01407 return *this;
01408 }
01409
01410 inline UnicodeString& UnicodeString::replace (size_type pos, size_type num, const UnicodeString& str,
01411 size_type startOffset, size_type count)
01412 {
01413 if ( pos > length() || startOffset > str.length() )
01414 throw ai::Error(kUnicodeStringBadIndex);
01415 erase(pos, num);
01416 insert(pos, str, startOffset, count);
01417
01418 return *this;
01419 }
01420
01421 inline std::string UnicodeString::as_UTF8 ( ) const
01422 {
01423 return getInStdString(kAIUTF8CharacterEncoding);
01424 }
01425
01426 inline std::string UnicodeString::as_Platform () const
01427 {
01428 return getInStdString(kAIPlatformCharacterEncoding);
01429 }
01430
01431 inline std::string UnicodeString::as_Roman () const
01432 {
01433 return getInStdString(kAIRomanCharacterEncoding);
01434 }
01435
01436 inline UnicodeString::size_type UnicodeString::as_ASUnicode ( ASUnicode* buffer, size_type bufferMax ) const
01437 {
01438 const UTF16Char* bufPtr = 0;
01439 const size_type kThisUTF16Len = utf_16(bufPtr) + 1;
01440 const size_type kCopyMax = (bufferMax < kThisUTF16Len ? bufferMax : kThisUTF16Len) - 1;
01441 memcpy(buffer, bufPtr, kCopyMax*sizeof(UTF16Char));
01442 buffer[kCopyMax] = 0;
01443
01444 return kThisUTF16Len;
01445 }
01446
01447 #if defined(WIN_ENV)
01448
01449 inline UnicodeString::size_type UnicodeString::as_WCHARStr ( WCHARStr::LPWSTR buffer, size_type bufferMax ) const
01450 {
01451 AI_STATIC_CHECK(sizeof(WCHARStr::WCHAR) == sizeof(ai::UnicodeString::UTF16Char), WCHAR_size_does_not_match_unsigned_short_size);
01452 return as_ASUnicode( reinterpret_cast<ASUnicode*>(buffer), bufferMax );
01453 }
01454
01455 #endif // defined(WIN_ENV)
01456
01457 inline UnicodeString::size_type UnicodeString::as_Platform ( char* buffer, size_type bufferMax ) const
01458 {
01459 return getToBuffer( buffer, bufferMax, kAIPlatformCharacterEncoding);
01460 }
01461
01462 inline UnicodeString::size_type UnicodeString::as_Roman ( char* buffer, size_type bufferMax ) const
01463 {
01464 return getToBuffer( buffer, bufferMax, kAIRomanCharacterEncoding);
01465 }
01466
01467 inline UnicodeString::size_type UnicodeString::as_Platform ( const ai::PStr& pascalString, size_type bufferMax ) const
01468 {
01469 return getToBuffer( pascalString, bufferMax, kAIPlatformCharacterEncoding );
01470 }
01471
01472 inline UnicodeString::size_type UnicodeString::as_Roman ( const ai::PStr& pascalString, size_type bufferMax ) const
01473 {
01474 return getToBuffer( pascalString, bufferMax, kAIRomanCharacterEncoding );
01475 }
01476
01477
01478
01479 #if defined(WIN_ENV)
01480
01482
01484
01485 inline WCHARStr::WCHARStr (const UnicodeString& string) : fConstStr()
01486 {
01487 AI_STATIC_CHECK(sizeof(WCHAR) == sizeof(ai::UnicodeString::UTF16Char), WCHAR_size_does_not_match_unsigned_short_size);
01488
01489 const std::basic_string<ASUnicode>& cInput = string.as_ASUnicode();
01490 const size_t cLen = cInput.length();
01491
01492 if ( cLen > 0 )
01493 fConstStr = std::basic_string<WCHAR>(reinterpret_cast<LPCWSTR>(cInput.data()), cLen);
01494 };
01495
01496 #if defined(_NATIVE_WCHAR_T_DEFINED)
01497
01498 inline WCHARStr::WCHARStr (WCHARStr::LPCWSTR wcharString) : fConstStr( wcharString )
01499 {
01500 }
01501 #endif // defined(_NATIVE_WCHAR_T_DEFINED)
01502
01503 inline WCHARStr::WCHARStr (const ASUnicode* string)
01504 {
01505 if ( string && *string )
01506 {
01507 AI_STATIC_CHECK(sizeof(WCHARStr::WCHAR) == sizeof(ai::UnicodeString::UTF16Char), WCHAR_size_does_not_match_unsigned_short_size);
01508 fConstStr.assign(reinterpret_cast<LPCWSTR>(string));
01509 }
01510 }
01511
01512 inline const ASUnicode* WCHARStr::as_ASUnicode () const
01513 {
01514 AI_STATIC_CHECK(sizeof(WCHARStr::WCHAR) == sizeof(ai::UnicodeString::UTF16Char), WCHAR_size_does_not_match_unsigned_short_size);
01515 return reinterpret_cast<const ASUnicode*>(this->as_LPCWSTR());
01516 }
01517
01518 inline size_t WCHARStr::length() const
01519 {
01520 return fConstStr.length();
01521 }
01522
01523 #endif // defined(WIN_ENV)
01524
01525 }
01526
01527 #endif // _IAIUNICODESTRING_H_