1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
10 #include <stdint.h> // For intptr_t.
13 #include "fx_memory.h"
19 typedef int FX_STRSIZE;
21 // An immutable string with caller-provided storage which must outlive the
26 typedef FX_CHAR value_type;
34 CFX_ByteStringC(FX_LPCBYTE ptr, FX_STRSIZE size)
40 CFX_ByteStringC(FX_LPCSTR ptr)
42 m_Ptr = (FX_LPCBYTE)ptr;
43 m_Length = ptr ? (FX_STRSIZE)FXSYS_strlen(ptr) : 0;
46 // |ch| must be an lvalue that outlives the the CFX_ByteStringC. However,
47 // the use of char rvalues are not caught at compile time. They are
48 // implicitly promoted to CFX_ByteString (see below) and then the
49 // CFX_ByteStringC is constructed from the CFX_ByteString via the alternate
50 // constructor below. The CFX_ByteString then typically goes out of scope
51 // and |m_Ptr| may be left pointing to invalid memory. Beware.
52 // TODO(tsepez): Mark single-argument string constructors as explicit.
53 CFX_ByteStringC(FX_CHAR& ch)
55 m_Ptr = (FX_LPCBYTE)&ch;
59 CFX_ByteStringC(FX_LPCSTR ptr, FX_STRSIZE len)
61 m_Ptr = (FX_LPCBYTE)ptr;
63 m_Length = (FX_STRSIZE)FXSYS_strlen(ptr);
69 CFX_ByteStringC(const CFX_ByteStringC& src)
72 m_Length = src.m_Length;
75 CFX_ByteStringC(const CFX_ByteString& src);
77 CFX_ByteStringC& operator = (FX_LPCSTR src)
79 m_Ptr = (FX_LPCBYTE)src;
80 m_Length = m_Ptr ? (FX_STRSIZE)FXSYS_strlen(src) : 0;
84 CFX_ByteStringC& operator = (const CFX_ByteStringC& src)
87 m_Length = src.m_Length;
91 CFX_ByteStringC& operator = (const CFX_ByteString& src);
93 bool operator== (const char* ptr) const {
94 return (FX_STRSIZE)FXSYS_strlen(ptr) == m_Length &&
95 FXSYS_memcmp32(ptr, m_Ptr, m_Length) == 0;
97 bool operator== (const CFX_ByteStringC& other) const {
98 return other.m_Length == m_Length &&
99 FXSYS_memcmp32(other.m_Ptr, m_Ptr, m_Length) == 0;
101 bool operator!= (const char* ptr) const { return !(*this == ptr); }
102 bool operator!= (const CFX_ByteStringC& other) const {
103 return !(*this == other);
106 FX_DWORD GetID(FX_STRSIZE start_pos = 0) const;
108 FX_LPCBYTE GetPtr() const
113 FX_LPCSTR GetCStr() const
115 return (FX_LPCSTR)m_Ptr;
118 FX_STRSIZE GetLength() const
125 return m_Length == 0;
128 FX_BYTE GetAt(FX_STRSIZE index) const
133 CFX_ByteStringC Mid(FX_STRSIZE index, FX_STRSIZE count = -1) const
138 if (index > m_Length) {
139 return CFX_ByteStringC();
141 if (count < 0 || count > m_Length - index) {
142 count = m_Length - index;
144 return CFX_ByteStringC(m_Ptr + index, count);
147 const FX_BYTE& operator[] (size_t index) const
152 bool operator< (const CFX_ByteStringC& that) const
154 int result = memcmp(m_Ptr, that.m_Ptr, std::min(m_Length, that.m_Length));
155 return result < 0 || (result == 0 && m_Length < that.m_Length);
163 void* operator new (size_t) throw()
168 inline bool operator== (const char* lhs, const CFX_ByteStringC& rhs) {
171 inline bool operator!= (const char* lhs, const CFX_ByteStringC& rhs) {
174 typedef const CFX_ByteStringC& FX_BSTR;
175 #define FX_BSTRC(str) CFX_ByteStringC(str, sizeof str-1)
176 #define FXBSTR_ID(c1, c2, c3, c4) ((c1 << 24) | (c2 << 16) | (c3 << 8) | (c4))
178 // To ensure ref counts do not overflow, consider the worst possible case:
179 // the entire address space contains nothing but pointers to this object.
180 // Since the count increments with each new pointer, the largest value is
181 // the number of pointers that can fit into the address space. The size of
182 // the address space itself is a good upper bound on it; we need not go
184 struct CFX_StringData {
185 intptr_t m_nRefs; // Would prefer ssize_t, but no windows support.
186 FX_STRSIZE m_nDataLength;
187 FX_STRSIZE m_nAllocLength;
191 // A mutable string with shared buffers using copy-on-write semantics that
192 // avoids the cost of std::string's iterator stability guarantees.
196 typedef FX_CHAR value_type;
203 CFX_ByteString(const CFX_ByteString& str);
205 CFX_ByteString(char ch);
207 CFX_ByteString(FX_LPCSTR ptr)
208 : CFX_ByteString(ptr, ptr ? FXSYS_strlen(ptr) : 0) { }
210 CFX_ByteString(FX_LPCSTR ptr, FX_STRSIZE len);
212 CFX_ByteString(FX_LPCBYTE ptr, FX_STRSIZE len);
214 CFX_ByteString(FX_BSTR bstrc);
215 CFX_ByteString(FX_BSTR bstrc1, FX_BSTR bstrc2);
219 static CFX_ByteString FromUnicode(FX_LPCWSTR ptr, FX_STRSIZE len = -1);
221 static CFX_ByteString FromUnicode(const CFX_WideString& str);
223 // Explicit conversion to raw string
224 FX_LPCSTR c_str() const
226 return m_pData ? m_pData->m_String : "";
229 // Implicit conversion to C-style string -- deprecated
230 operator FX_LPCSTR() const
232 return m_pData ? m_pData->m_String : "";
235 operator FX_LPCBYTE() const
237 return m_pData ? (FX_LPCBYTE)m_pData->m_String : NULL;
240 FX_STRSIZE GetLength() const
242 return m_pData ? m_pData->m_nDataLength : 0;
250 int Compare(FX_BSTR str) const;
253 bool Equal(const char* ptr) const;
254 bool Equal(const CFX_ByteStringC& str) const;
255 bool Equal(const CFX_ByteString& other) const;
257 bool EqualNoCase(FX_BSTR str) const;
259 bool operator== (const char* ptr) const { return Equal(ptr); }
260 bool operator== (const CFX_ByteStringC& str) const { return Equal(str); }
261 bool operator== (const CFX_ByteString& other) const { return Equal(other); }
263 bool operator!= (const char* ptr) const { return !(*this == ptr); }
264 bool operator!= (const CFX_ByteStringC& str) const {
265 return !(*this == str);
267 bool operator!= (const CFX_ByteString& other) const {
268 return !(*this == other);
271 bool operator< (const CFX_ByteString& str) const
273 int result = FXSYS_memcmp32(c_str(), str.c_str(), std::min(GetLength(), str.GetLength()));
274 return result < 0 || (result == 0 && GetLength() < str.GetLength());
279 const CFX_ByteString& operator = (FX_LPCSTR str);
281 const CFX_ByteString& operator = (FX_BSTR bstrc);
283 const CFX_ByteString& operator = (const CFX_ByteString& stringSrc);
285 const CFX_ByteString& operator = (const CFX_BinaryBuf& buf);
287 void Load(FX_LPCBYTE str, FX_STRSIZE len);
289 const CFX_ByteString& operator += (FX_CHAR ch);
291 const CFX_ByteString& operator += (FX_LPCSTR str);
293 const CFX_ByteString& operator += (const CFX_ByteString& str);
295 const CFX_ByteString& operator += (FX_BSTR bstrc);
297 FX_BYTE GetAt(FX_STRSIZE nIndex) const
299 return m_pData ? m_pData->m_String[nIndex] : 0;
302 FX_BYTE operator[](FX_STRSIZE nIndex) const
304 return m_pData ? m_pData->m_String[nIndex] : 0;
307 void SetAt(FX_STRSIZE nIndex, FX_CHAR ch);
309 FX_STRSIZE Insert(FX_STRSIZE index, FX_CHAR ch);
311 FX_STRSIZE Delete(FX_STRSIZE index, FX_STRSIZE count = 1);
314 void Format(FX_LPCSTR lpszFormat, ... );
316 void FormatV(FX_LPCSTR lpszFormat, va_list argList);
319 void Reserve(FX_STRSIZE len);
321 FX_LPSTR GetBuffer(FX_STRSIZE len);
323 void ReleaseBuffer(FX_STRSIZE len = -1);
325 CFX_ByteString Mid(FX_STRSIZE first) const;
327 CFX_ByteString Mid(FX_STRSIZE first, FX_STRSIZE count) const;
329 CFX_ByteString Left(FX_STRSIZE count) const;
331 CFX_ByteString Right(FX_STRSIZE count) const;
333 FX_STRSIZE Find(FX_BSTR lpszSub, FX_STRSIZE start = 0) const;
335 FX_STRSIZE Find(FX_CHAR ch, FX_STRSIZE start = 0) const;
337 FX_STRSIZE ReverseFind(FX_CHAR ch) const;
345 void TrimRight(FX_CHAR chTarget);
347 void TrimRight(FX_BSTR lpszTargets);
351 void TrimLeft(FX_CHAR chTarget);
353 void TrimLeft(FX_BSTR lpszTargets);
355 FX_STRSIZE Replace(FX_BSTR lpszOld, FX_BSTR lpszNew);
357 FX_STRSIZE Remove(FX_CHAR ch);
359 CFX_WideString UTF8Decode() const;
361 void ConvertFrom(const CFX_WideString& str, CFX_CharMap* pCharMap = NULL);
363 FX_DWORD GetID(FX_STRSIZE start_pos = 0) const;
365 #define FXFORMAT_SIGNED 1
366 #define FXFORMAT_HEX 2
367 #define FXFORMAT_CAPITAL 4
369 static CFX_ByteString FormatInteger(int i, FX_DWORD flags = 0);
371 static CFX_ByteString FormatFloat(FX_FLOAT f, int precision = 0);
374 struct CFX_StringData* m_pData;
375 void AllocCopy(CFX_ByteString& dest, FX_STRSIZE nCopyLen, FX_STRSIZE nCopyIndex) const;
376 void AssignCopy(FX_STRSIZE nSrcLen, FX_LPCSTR lpszSrcData);
377 void ConcatCopy(FX_STRSIZE nSrc1Len, FX_LPCSTR lpszSrc1Data, FX_STRSIZE nSrc2Len, FX_LPCSTR lpszSrc2Data);
378 void ConcatInPlace(FX_STRSIZE nSrcLen, FX_LPCSTR lpszSrcData);
379 void CopyBeforeWrite();
380 void AllocBeforeWrite(FX_STRSIZE nLen);
382 inline CFX_ByteStringC::CFX_ByteStringC(const CFX_ByteString& src)
384 m_Ptr = (FX_LPCBYTE)src;
385 m_Length = src.GetLength();
387 inline CFX_ByteStringC& CFX_ByteStringC::operator = (const CFX_ByteString& src)
389 m_Ptr = (FX_LPCBYTE)src;
390 m_Length = src.GetLength();
394 inline bool operator== (const char* lhs, const CFX_ByteString& rhs) {
397 inline bool operator== (const CFX_ByteStringC& lhs, const CFX_ByteString& rhs) {
400 inline bool operator!= (const char* lhs, const CFX_ByteString& rhs) {
403 inline bool operator!= (const CFX_ByteStringC& lhs, const CFX_ByteString& rhs) {
407 inline CFX_ByteString operator + (FX_BSTR str1, FX_BSTR str2)
409 return CFX_ByteString(str1, str2);
411 inline CFX_ByteString operator + (FX_BSTR str1, FX_LPCSTR str2)
413 return CFX_ByteString(str1, str2);
415 inline CFX_ByteString operator + (FX_LPCSTR str1, FX_BSTR str2)
417 return CFX_ByteString(str1, str2);
419 inline CFX_ByteString operator + (FX_BSTR str1, FX_CHAR ch)
421 return CFX_ByteString(str1, CFX_ByteStringC(ch));
423 inline CFX_ByteString operator + (FX_CHAR ch, FX_BSTR str2)
425 return CFX_ByteString(ch, str2);
427 inline CFX_ByteString operator + (const CFX_ByteString& str1, const CFX_ByteString& str2)
429 return CFX_ByteString(str1, str2);
431 inline CFX_ByteString operator + (const CFX_ByteString& str1, FX_CHAR ch)
433 return CFX_ByteString(str1, CFX_ByteStringC(ch));
435 inline CFX_ByteString operator + (FX_CHAR ch, const CFX_ByteString& str2)
437 return CFX_ByteString(ch, str2);
439 inline CFX_ByteString operator + (const CFX_ByteString& str1, FX_LPCSTR str2)
441 return CFX_ByteString(str1, str2);
443 inline CFX_ByteString operator + (FX_LPCSTR str1, const CFX_ByteString& str2)
445 return CFX_ByteString(str1, str2);
447 inline CFX_ByteString operator + (const CFX_ByteString& str1, FX_BSTR str2)
449 return CFX_ByteString(str1, str2);
451 inline CFX_ByteString operator + (FX_BSTR str1, const CFX_ByteString& str2)
453 return CFX_ByteString(str1, str2);
455 class CFX_WideStringC
458 typedef FX_WCHAR value_type;
466 CFX_WideStringC(FX_LPCWSTR ptr)
469 m_Length = ptr ? (FX_STRSIZE)FXSYS_wcslen(ptr) : 0;
472 CFX_WideStringC(FX_WCHAR& ch)
478 CFX_WideStringC(FX_LPCWSTR ptr, FX_STRSIZE len)
482 m_Length = (FX_STRSIZE)FXSYS_wcslen(ptr);
488 CFX_WideStringC(const CFX_WideStringC& src)
491 m_Length = src.m_Length;
494 CFX_WideStringC(const CFX_WideString& src);
496 CFX_WideStringC& operator = (FX_LPCWSTR src)
499 m_Length = (FX_STRSIZE)FXSYS_wcslen(src);
503 CFX_WideStringC& operator = (const CFX_WideStringC& src)
506 m_Length = src.m_Length;
510 CFX_WideStringC& operator = (const CFX_WideString& src);
512 bool operator== (const wchar_t* ptr) const {
513 return (FX_STRSIZE)FXSYS_wcslen(ptr) == m_Length &&
514 wmemcmp(ptr, m_Ptr, m_Length) == 0;
516 bool operator== (const CFX_WideStringC& str) const {
517 return str.m_Length == m_Length &&
518 wmemcmp(str.m_Ptr, m_Ptr, m_Length) == 0;
520 bool operator!= (const wchar_t* ptr) const { return !(*this == ptr); }
521 bool operator!= (const CFX_WideStringC& str) const {
522 return !(*this == str);
525 FX_LPCWSTR GetPtr() const
530 FX_STRSIZE GetLength() const
537 return m_Length == 0;
540 FX_WCHAR GetAt(FX_STRSIZE index) const
545 CFX_WideStringC Left(FX_STRSIZE count) const
548 return CFX_WideStringC();
550 if (count > m_Length) {
553 return CFX_WideStringC(m_Ptr, count);
556 CFX_WideStringC Mid(FX_STRSIZE index, FX_STRSIZE count = -1) const
561 if (index > m_Length) {
562 return CFX_WideStringC();
564 if (count < 0 || count > m_Length - index) {
565 count = m_Length - index;
567 return CFX_WideStringC(m_Ptr + index, count);
570 CFX_WideStringC Right(FX_STRSIZE count) const
573 return CFX_WideStringC();
575 if (count > m_Length) {
578 return CFX_WideStringC(m_Ptr + m_Length - count, count);
581 const FX_WCHAR& operator[] (size_t index) const
586 bool operator< (const CFX_WideStringC& that) const
588 int result = wmemcmp(m_Ptr, that.m_Ptr, std::min(m_Length, that.m_Length));
589 return result < 0 || (result == 0 && m_Length < that.m_Length);
597 void* operator new (size_t) throw()
602 inline bool operator== (const wchar_t* lhs, const CFX_WideStringC& rhs) {
605 inline bool operator!= (const wchar_t* lhs, const CFX_WideStringC& rhs) {
608 typedef const CFX_WideStringC& FX_WSTR;
609 #define FX_WSTRC(wstr) CFX_WideStringC(wstr, FX_ArraySize(wstr) - 1)
611 struct CFX_StringDataW {
612 intptr_t m_nRefs; // Would prefer ssize_t, but no windows support.
613 FX_STRSIZE m_nDataLength;
614 FX_STRSIZE m_nAllocLength;
615 FX_WCHAR m_String[1];
618 // A mutable string with shared buffers using copy-on-write semantics that
619 // avoids the cost of std::string's iterator stability guarantees.
623 typedef FX_WCHAR value_type;
630 CFX_WideString(const CFX_WideString& str);
632 CFX_WideString(FX_LPCWSTR ptr)
633 : CFX_WideString(ptr, ptr ? FXSYS_wcslen(ptr) : 0) { }
635 CFX_WideString(FX_LPCWSTR ptr, FX_STRSIZE len);
637 CFX_WideString(FX_WCHAR ch);
639 CFX_WideString(const CFX_WideStringC& str);
641 CFX_WideString(const CFX_WideStringC& str1, const CFX_WideStringC& str2);
645 static CFX_WideString FromLocal(const char* str, FX_STRSIZE len = -1);
647 static CFX_WideString FromUTF8(const char* str, FX_STRSIZE len);
649 static CFX_WideString FromUTF16LE(const unsigned short* str, FX_STRSIZE len);
651 static FX_STRSIZE WStringLength(const unsigned short* str);
653 // Explicit conversion to raw string
654 FX_LPCWSTR c_str() const
656 return m_pData ? m_pData->m_String : L"";
659 // Implicit conversion to C-style wide string -- deprecated
660 operator FX_LPCWSTR() const
662 return m_pData ? m_pData->m_String : L"";
668 FX_BOOL IsEmpty() const
673 FX_STRSIZE GetLength() const
675 return m_pData ? m_pData->m_nDataLength : 0;
678 const CFX_WideString& operator = (FX_LPCWSTR str);
680 const CFX_WideString& operator =(const CFX_WideString& stringSrc);
682 const CFX_WideString& operator =(const CFX_WideStringC& stringSrc);
684 const CFX_WideString& operator += (FX_LPCWSTR str);
686 const CFX_WideString& operator += (FX_WCHAR ch);
688 const CFX_WideString& operator += (const CFX_WideString& str);
690 const CFX_WideString& operator += (const CFX_WideStringC& str);
692 bool operator== (const wchar_t* ptr) const { return Equal(ptr); }
693 bool operator== (const CFX_WideStringC& str) const { return Equal(str); }
694 bool operator== (const CFX_WideString& other) const { return Equal(other); }
696 bool operator!= (const wchar_t* ptr) const { return !(*this == ptr); }
697 bool operator!= (const CFX_WideStringC& str) const {
698 return !(*this == str);
700 bool operator!= (const CFX_WideString& other) const {
701 return !(*this == other);
704 bool operator< (const CFX_WideString& str) const {
705 int result = wmemcmp(c_str(), str.c_str(), std::min(GetLength(), str.GetLength()));
706 return result < 0 || (result == 0 && GetLength() < str.GetLength());
709 FX_WCHAR GetAt(FX_STRSIZE nIndex) const
711 return m_pData ? m_pData->m_String[nIndex] : 0;
714 FX_WCHAR operator[](FX_STRSIZE nIndex) const
716 return m_pData ? m_pData->m_String[nIndex] : 0;
719 void SetAt(FX_STRSIZE nIndex, FX_WCHAR ch);
721 int Compare(FX_LPCWSTR str) const;
723 int Compare(const CFX_WideString& str) const;
725 int CompareNoCase(FX_LPCWSTR str) const;
727 bool Equal(const wchar_t* ptr) const;
728 bool Equal(const CFX_WideStringC& str) const;
729 bool Equal(const CFX_WideString& other) const;
731 CFX_WideString Mid(FX_STRSIZE first) const;
733 CFX_WideString Mid(FX_STRSIZE first, FX_STRSIZE count) const;
735 CFX_WideString Left(FX_STRSIZE count) const;
737 CFX_WideString Right(FX_STRSIZE count) const;
739 FX_STRSIZE Insert(FX_STRSIZE index, FX_WCHAR ch);
741 FX_STRSIZE Delete(FX_STRSIZE index, FX_STRSIZE count = 1);
743 void Format(FX_LPCWSTR lpszFormat, ... );
745 void FormatV(FX_LPCWSTR lpszFormat, va_list argList);
753 void TrimRight(FX_WCHAR chTarget);
755 void TrimRight(FX_LPCWSTR lpszTargets);
759 void TrimLeft(FX_WCHAR chTarget);
761 void TrimLeft(FX_LPCWSTR lpszTargets);
763 void Reserve(FX_STRSIZE len);
765 FX_LPWSTR GetBuffer(FX_STRSIZE len);
767 void ReleaseBuffer(FX_STRSIZE len = -1);
769 int GetInteger() const;
771 FX_FLOAT GetFloat() const;
773 FX_STRSIZE Find(FX_LPCWSTR lpszSub, FX_STRSIZE start = 0) const;
775 FX_STRSIZE Find(FX_WCHAR ch, FX_STRSIZE start = 0) const;
777 FX_STRSIZE Replace(FX_LPCWSTR lpszOld, FX_LPCWSTR lpszNew);
779 FX_STRSIZE Remove(FX_WCHAR ch);
781 CFX_ByteString UTF8Encode() const;
783 CFX_ByteString UTF16LE_Encode() const;
785 void ConvertFrom(const CFX_ByteString& str, CFX_CharMap* pCharMap = NULL);
788 void CopyBeforeWrite();
789 void AllocBeforeWrite(FX_STRSIZE nLen);
790 void ConcatInPlace(FX_STRSIZE nSrcLen, FX_LPCWSTR lpszSrcData);
791 void ConcatCopy(FX_STRSIZE nSrc1Len, FX_LPCWSTR lpszSrc1Data, FX_STRSIZE nSrc2Len, FX_LPCWSTR lpszSrc2Data);
792 void AssignCopy(FX_STRSIZE nSrcLen, FX_LPCWSTR lpszSrcData);
793 void AllocCopy(CFX_WideString& dest, FX_STRSIZE nCopyLen, FX_STRSIZE nCopyIndex) const;
795 CFX_StringDataW* m_pData;
797 inline CFX_WideStringC::CFX_WideStringC(const CFX_WideString& src)
800 m_Length = src.GetLength();
802 inline CFX_WideStringC& CFX_WideStringC::operator = (const CFX_WideString& src)
805 m_Length = src.GetLength();
809 inline CFX_WideString operator + (const CFX_WideStringC& str1, const CFX_WideStringC& str2)
811 return CFX_WideString(str1, str2);
813 inline CFX_WideString operator + (const CFX_WideStringC& str1, FX_LPCWSTR str2)
815 return CFX_WideString(str1, str2);
817 inline CFX_WideString operator + (FX_LPCWSTR str1, const CFX_WideStringC& str2)
819 return CFX_WideString(str1, str2);
821 inline CFX_WideString operator + (const CFX_WideStringC& str1, FX_WCHAR ch)
823 return CFX_WideString(str1, CFX_WideStringC(ch));
825 inline CFX_WideString operator + (FX_WCHAR ch, const CFX_WideStringC& str2)
827 return CFX_WideString(ch, str2);
829 inline CFX_WideString operator + (const CFX_WideString& str1, const CFX_WideString& str2)
831 return CFX_WideString(str1, str2);
833 inline CFX_WideString operator + (const CFX_WideString& str1, FX_WCHAR ch)
835 return CFX_WideString(str1, CFX_WideStringC(ch));
837 inline CFX_WideString operator + (FX_WCHAR ch, const CFX_WideString& str2)
839 return CFX_WideString(ch, str2);
841 inline CFX_WideString operator + (const CFX_WideString& str1, FX_LPCWSTR str2)
843 return CFX_WideString(str1, str2);
845 inline CFX_WideString operator + (FX_LPCWSTR str1, const CFX_WideString& str2)
847 return CFX_WideString(str1, str2);
849 inline CFX_WideString operator + (const CFX_WideString& str1, const CFX_WideStringC& str2)
851 return CFX_WideString(str1, str2);
853 inline CFX_WideString operator + (const CFX_WideStringC& str1, const CFX_WideString& str2)
855 return CFX_WideString(str1, str2);
857 inline bool operator== (const wchar_t* lhs, const CFX_WideString& rhs) {
860 inline bool operator== (const CFX_WideStringC& lhs, const CFX_WideString& rhs) {
863 inline bool operator!= (const wchar_t* lhs, const CFX_WideString& rhs) {
866 inline bool operator!= (const CFX_WideStringC& lhs, const CFX_WideString& rhs) {
869 FX_FLOAT FX_atof(FX_BSTR str);
870 void FX_atonum(FX_BSTR str, FX_BOOL& bInteger, void* pData);
871 FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_LPSTR buf);
872 CFX_ByteString FX_UTF8Encode(FX_LPCWSTR pwsStr, FX_STRSIZE len);
873 inline CFX_ByteString FX_UTF8Encode(FX_WSTR wsStr)
875 return FX_UTF8Encode(wsStr.GetPtr(), wsStr.GetLength());
877 inline CFX_ByteString FX_UTF8Encode(const CFX_WideString &wsStr)
879 return FX_UTF8Encode(wsStr.c_str(), wsStr.GetLength());