40 class CFX_ByteStringL;
41 class CFX_WideStringL;
74 #ifndef _NO_LPCSTR_SUPPORT_ 121 m_Length = src.m_Length;
153 m_Length = src.m_Length;
174 return str.m_Length == m_Length &&
FXSYS_memcmp32(str.m_Ptr, m_Ptr, m_Length) == 0;
185 return str.m_Length != m_Length ||
FXSYS_memcmp32(str.m_Ptr, m_Ptr, m_Length) != 0;
189 #define FXBSTR_ID(c1, c2, c3, c4) ((c1 << 24) | (c2 << 16) | (c3 << 8) | (c4)) 233 bool IsEmpty()
const {
return m_Length == 0; }
265 if (index < 0) index = 0;
267 if (count < 0 || count > m_Length - index) count = m_Length - index;
281 void*
operator new (size_t)
throw() {
return NULL; }
296 #define FX_BSTRC(str) CFX_ByteStringC(str, sizeof str-1) 447 #ifndef _NO_LPCSTR_SUPPORT_ 477 #ifndef _NO_LPCSTR_SUPPORT_ 891 #define FXFORMAT_SIGNED 1 893 #define FXFORMAT_HEX 2 895 #define FXFORMAT_CAPITAL 4 933 void CopyBeforeWrite();
973 #ifndef _NO_LPCSTR_SUPPORT_ 1043 #ifndef _NO_LPCSTR_SUPPORT_ 1177 template<FX_STRSIZE limit>
1217 #ifndef _NO_LPCSTR_SUPPORT_ 1264 m_Length = src.m_Length;
1296 m_Length = src.m_Length;
1369 if (count > m_Length) count = m_Length;
1383 if (index < 0) index = 0;
1385 if (count < 0 || count > m_Length - index) count = m_Length - index;
1399 if (count > m_Length) count = m_Length;
1413 void*
operator new (size_t)
throw() {
return NULL; }
1428 #define FX_WSTRC(wstr) CFX_WideStringC((FX_LPCWSTR)wstr, sizeof(wstr) / sizeof(FX_WCHAR) - 1) 1956 void CopyBeforeWrite();
2001 #ifndef _NO_LPCSTR_SUPPORT_ 2067 #ifndef _NO_LPCSTR_SUPPORT_ 2291 #define FXWCHAR_LTR 0 2293 #define FXWCHAR_RTL 1 2295 #define FXWCHAR_UNKNOWN 2 2354 return ((first & 0xFC00) == 0xD800 && (second & 0xFC00) == 0xDC00);
2371 const FX_DWORD mask = (1 << 10) - 1;
2372 return (((first & mask) << 10) | (second & mask)) + 0x10000;
2386 ~CFX_ByteStringL() {}
2402 ~CFX_WideStringL() {}
2408 int GetInteger()
const;
2418 #endif // _FX_STRING_H_ unsigned char FX_BYTE
Byte (8 bits).
Definition: fx_system.h:643
bool operator<(const CFX_ByteString &rhs) const
Comparison(<) operator overload. case-sensitive.
void MakeLower()
Change case of English letters to lower.
unsigned long FX_DWORD
32-bit unsigned integer.
Definition: fx_system.h:702
bool operator==(const CFX_WideStringC &str) const
Comparison(==) operator overload. Case-sensitive.
Definition: fx_string.h:1315
CFX_ByteString UTF16LE_Encode(FX_BOOL bTerminate=true) const
Do UTF16LE encoding.
CFX_WideStringC(FX_LPCWSTR ptr)
Construct from a character string.
Definition: fx_string.h:1224
CFX_WideStringC(const CFX_WideStringC &src)
Copy constructor.
Definition: fx_string.h:1261
FX_WCHAR operator[](FX_STRSIZE nIndex) const
Subscript([]) operator overload. It retrieves a wide character specified by the zero-based index in n...
Definition: fx_string.h:1645
void Format(FX_LPCSTR lpszFormat,...)
Format a number of parameters into this byte string.
FX_STRSIZE GetLength() const
Get number of bytes in the byte string (not counting any possible terminator).
Definition: fx_string.h:402
FX_INT32 FXSYS_memcmp32(const void *buf1, const void *buf2, size_t size)
Compare data in two buffers.
FX_STRSIZE m_nAllocLength
Length of allocation.
Definition: fx_string.h:1441
FX_STRSIZE Replace(FX_BSTR lpszOld, FX_BSTR lpszNew)
Replace all patterns in the string with a new sub-string.
CFX_ByteStringC(const FX_CHAR &ch)
Construct from a single character.
Definition: fx_string.h:94
FX_CHAR m_Buffer[limit]
The fixed string buffer.
Definition: fx_string.h:1191
CFX_ByteString Mid(FX_STRSIZE first) const
Extracts a substring from this CFX_ByteString object, starting at position nFirst (zero-based) to las...
FX_CHAR m_String[1]
Real data (actually a variable-sized array).
Definition: fx_string.h:311
wchar_t FX_WCHAR
Compiler dependant Unicode character (16-bit for Microsoft Compiler, 32-bit for gcc).
Definition: fx_system.h:708
bool Equal(const CFX_WideStringC &str) const
Check if current string is equal to another.
void Reserve(FX_STRSIZE len)
Reserve a buffer that can hold specific number of bytes.
void MakeLower()
Change case of English letters to lower.
void SetAt(FX_STRSIZE nIndex, FX_CHAR ch)
Overwrites a single byte specified by an index number.
CFX_ByteStringC(FX_LPCBYTE ptr, FX_STRSIZE size)
Constructs from a byte string.
Definition: fx_string.h:68
CFX_ByteStringC(const CFX_ByteStringC &src)
Copy constructor.
Definition: fx_string.h:118
CFX_WideString UTF8Decode() const
Decode a UTF-8 unicode string (assume this byte string is UTF-8 encoded).
void MakeUpper()
Change case of English letters to upper.
FX_STRSIZE Insert(FX_STRSIZE index, FX_CHAR ch)
Insert a character before specific position.
static CFX_ByteString FromUnicode(FX_LPCWSTR ptr, FX_STRSIZE len=-1)
Create a CFX_ByteString object from a Unicode string. Convert from Unicode to system multi-byte chars...
FX_WCHAR FXWCHAR_GetUpper(FX_WCHAR wchar)
Convert to upper-case letter.
void Reserve(FX_STRSIZE len)
Reserve a buffer that can hold specific number of characters.
FX_STRSIZE Find(FX_BSTR lpszSub, FX_STRSIZE start=0) const
Find a sub-string, from specific position. Only first occurrence is found.
const CFX_ByteString & operator=(FX_LPCSTR str)
Assignment(=) operator overload. From a character string.
#define FXSYS_strlen
Get the length of a ANSIC string.
Definition: fx_system.h:854
void Append(FX_BSTR str)
Append a non-buffered byte string.
const CFX_WideString & operator+=(FX_LPCWSTR str)
Concatenation(+=) operator overload. Concatenate a wide character string.
FX_STRSIZE GetLength() const
Get the length of the byte string.
Definition: fx_string.h:227
bool Equal(FX_BSTR str) const
Check if current string is equal to another one. Case-sensitive.
void ReleaseBuffer(FX_STRSIZE len=-1)
Release the buffer fetched by function CFX_ByteString::GetBuffer or CFX_ByteString::LockBuffer,...
void * FXSYS_memset32(void *dst, FX_INT32 v, size_t size)
Set buffer data to specified value.
int FX_STRSIZE
String size is limited to 2^31-1.
Definition: fx_string.h:35
void FormatV(FX_LPCSTR lpszFormat, va_list argList)
Format a number of parameters into this byte string, using va_list.
CFX_ByteString FX_UTF8Encode(FX_LPCWSTR pwsStr, FX_STRSIZE len)
Encode a wide string into a UTF-8 string.
FX_STRSIZE ReverseFind(FX_CHAR ch) const
Find a character from end of the string.
FX_BOOL FXWCHAR_IsWordBreak(FX_WCHAR wchar)
Check if the unicode can break a word.
void ConvertFrom(const CFX_WideString &str, CFX_CharMap *pCharMap=NULL)
Load unicode data into this byte string, using specified character mapper. If no character mapper spe...
FX_STRSIZE GetLength() const
Get the length of the byte string.
Definition: fx_string.h:1342
CONSTANT WIDE STRING CLASS.
Definition: fx_string.h:1205
char FX_CHAR
8-bit Windows (ANSI) character.
Definition: fx_system.h:679
FX_LPCWSTR GetPtr() const
Get a constant wide string pointer to the wide string.
Definition: fx_string.h:1336
void FX_atonum(FX_BSTR str, FX_BOOL &bInteger, void *pData, int sizeOfData=4)
Convert a non-buffered byte string to a number.
CFX_ByteStringC()
Constructs a null constant string.
Definition: fx_string.h:57
static CFX_WideString FromLocal(const char *str, FX_STRSIZE len=-1)
Create a wide string from system multi-byte charset.
FX_STRSIZE Delete(FX_STRSIZE index, FX_STRSIZE count=1)
Delete one or more wide characters starting from specific position.
wchar_t * FX_LPWSTR
Pointer to Unicode characters.
Definition: fx_system.h:710
CFX_ByteStringC Mid(FX_STRSIZE index, FX_STRSIZE count=-1) const
This method extracts a substring of length count bytes from this CFX_ByteStringC object,...
Definition: fx_string.h:263
CFX_WideStringC & operator=(FX_LPCWSTR src)
Assignment(=) operator overload. From a character string.
Definition: fx_string.h:1280
static CFX_ByteString LoadFromFile(FX_BSTR file_path)
Load the whole content of a file.
This class represents the data of a byte string object.
Definition: fx_string.h:302
static CFX_WideString FromUTF16BE(const unsigned short *str, FX_STRSIZE len=-1)
Create a wide string from UTF16BE encoded string.
char * FX_LPSTR
Pointer to 8-bit Windows (ANSI) characters.
Definition: fx_system.h:681
CFX_ByteString()
Construct a null byte string.
Definition: fx_string.h:323
int GetInteger() const
Convert to other data type.
FX_STRSIZE m_nDataLength
Length of data (excluding terminator).
Definition: fx_string.h:307
void Format(FX_LPCWSTR lpszFormat,...)
Format a number of parameters into this wide string.
bool operator !=(const CFX_ByteStringC &str) const
Comparison(!=) operator overload. case-sensitive.
Definition: fx_string.h:183
CFX_WideString Left(FX_STRSIZE count) const
Extracts the first (leftmost) count wide characters from this CFX_WideString object as a sub-string.
const CFX_WideString & operator=(FX_LPCWSTR str)
Assignment(=) operator overload. From a wide character string.
CFX_ByteString GetString() const
Get a buffered byte string.
Definition: fx_string.h:1164
#define FXSYS_wcslen
Get the length of a wide-character string.
Definition: fx_system.h:1003
CFX_WideString()
Construct a null wide string.
Definition: fx_string.h:1458
FX_CHAR * GetPtr() const
Get a C-style string pointer to the string buffer.
Definition: fx_string.h:1108
int FX_INT32
32-bit signed integer.
Definition: fx_system.h:661
This class represents the data of a wide string object.
Definition: fx_string.h:1434
bool operator==(const CFX_WideString &s1, const CFX_WideString &s2)
Comparison(==) operator overload. Case-sensitive.
bool IsEmpty() const
Check whether current string object is empty.
Definition: fx_string.h:233
static CFX_ByteString FormatInteger(FX_INT32 i, FX_DWORD flags=0)
Convert from Integer.
void FormatV(FX_LPCWSTR lpszFormat, va_list argList)
Format a number of parameters into this wide string. using va_list.
bool operator==(FX_LPCSTR str) const
Comparison(==) operator overload. case-sensitive.
Definition: fx_string.h:456
FX_LPWSTR LockBuffer()
Lock and get the current string buffer, so the caller can modify the returned buffer....
bool operator !=(FX_LPCSTR str) const
Comparison(!=) operator overload. case-sensitive.
Definition: fx_string.h:486
void Empty()
Set this string to be empty.
BYTE STRING CLASS.
Definition: fx_string.h:317
CFX_WideString Mid(FX_STRSIZE first) const
Extracts a substring from this CFX_WideString object, starting at position nFirst (zero-based) to las...
Foxit allocator interface.
Definition: fx_memory.h:960
static CFX_WideString FromUTF16LE(const unsigned short *str, FX_STRSIZE len=-1)
Create a wide string from UTF16LE encoded string.
void TrimLeft()
Trim white spaces from the left side of the byte string.
wchar_t const * FX_LPCWSTR
Pointer to constant Unicode characters.
Definition: fx_system.h:712
FX_WCHAR m_String[1]
Real data (actually a variable-sized array).
Definition: fx_string.h:1443
FX_WCHAR GetAt(FX_STRSIZE index) const
Retrieves a single byte specified by an index number.
Definition: fx_string.h:1357
FX_WCHAR GetAt(FX_STRSIZE nIndex) const
Retrieves a single wide character specified by an index number.
Definition: fx_string.h:1637
FX_STRSIZE Delete(FX_STRSIZE index, FX_STRSIZE count=1)
Delete one or more characters starting from specific position.
FX_STRSIZE Insert(FX_STRSIZE index, FX_WCHAR ch)
Insert a wide character before specific position.
FX_BYTE operator[](FX_STRSIZE nIndex) const
Subscript([]) operator overload. It retrieves a single byte specified by the zero-based index in nInd...
Definition: fx_string.h:614
bool operator==(const CFX_ByteStringC &str) const
Comparison(==) operator overload. case-sensitive.
Definition: fx_string.h:172
CFX_StringBufTemplate()
A constructor.
Definition: fx_string.h:1184
FX_FLOAT GetFloat() const
Convert to other data type.
FX_BOOL FXWCHAR_IsSpace(FX_WCHAR wchar)
Check if the unicode is space.
CFX_ByteString UTF8Encode() const
Do UTF8 encoding.
bool operator !=(const CFX_WideStringC &str) const
Comparison(!=) operator overload. Case-sensitive.
Definition: fx_string.h:1326
bool operator<(const CFX_WideString &lhs, const CFX_WideString &rhs)
Comparison(<) operator overload. Case-sensitive.
FX_LPCBYTE GetPtr() const
Get a constant byte string pointer to the byte string.
Definition: fx_string.h:215
FX_BYTE GetAt(FX_STRSIZE nIndex) const
Get a single byte specified by an index number.
Definition: fx_string.h:606
FX_DWORD GetID(FX_STRSIZE start_pos=0) const
Get a DWORD identifier of the string, from a particular position.
A fixed string buffer holding up to certain number of characters.
Definition: fx_string.h:1093
FX_BOOL IsEmpty() const
Check whether current string object is empty.
Definition: fx_string.h:1561
void Load(FX_LPCBYTE str, FX_STRSIZE len)
Load from a byte string.
CFX_WideStringC(FX_WCHAR &ch)
Construct from a single character.
Definition: fx_string.h:1237
CFX_ByteString operator+(FX_BSTR str1, FX_BSTR str2)
Concatenate a non-buffered byte string and a non-buffered byte string.
Definition: fx_string.h:971
FX_BYTE GetAt(FX_STRSIZE index) const
This method retrieves a single byte specified by an index number.
Definition: fx_string.h:252
Definition: fx_basic.h:947
void ConvertFrom(const CFX_ByteString &str, CFX_CharMap *pCharMap=NULL)
Load MBCS data into this wide string, using specified character mapper.
char const * FX_LPCSTR
Pointer to constant 8-bit Windows (ANSI) characters.
Definition: fx_system.h:683
int CompareNoCase(FX_LPCWSTR str) const
Compare the the string with a wide character string. No case-insensitive.
CFX_ByteStringC(FX_LPCSTR ptr)
Construct from a character string.
Definition: fx_string.h:81
unsigned char const * FX_LPCBYTE
Pointer to a constant FX_BYTE.
Definition: fx_system.h:647
FX_WCHAR FXWCHAR_GetLower(FX_WCHAR wchar)
Convert to lower-case letter.
CFX_WideString Right(FX_STRSIZE count) const
Extracts the last (rightmost) count wide characters from this CFX_WideString object as a sub-string.
int Compare(FX_BSTR str) const
Compare the the string with another. Case-sensitive.
FX_STRSIZE GetLength() const
Get number of characters, not bytes. Trailing zero not counted.
Definition: fx_string.h:1568
bool EqualNoCase(FX_BSTR str) const
Check if current string is equal to another one, not considering case.
CFX_StringBufBase(FX_STRSIZE limit)
A Constructor.
Definition: fx_string.h:1101
bool IsEmpty() const
Determines whether current string object is empty.
Definition: fx_string.h:1348
CFX_ByteString Right(FX_STRSIZE count) const
Extracts the last (rightmost) count bytes from this CFX_ByteString object as a sub-string.
Dynamic binary buffers designed for more efficient appending.
Definition: fx_basic.h:52
FX_STRSIZE m_nDataLength
Length of data (excluding terminator).
Definition: fx_string.h:1439
CFX_WideStringC Mid(FX_STRSIZE index, FX_STRSIZE count=-1) const
Extracts a substring of length count bytes from this CFX_WideStringC object, starting at position ind...
Definition: fx_string.h:1381
float FX_FLOAT
32-bit floating-point number.
Definition: fx_system.h:663
FX_STRSIZE Remove(FX_WCHAR ch)
Remove all occurrence of a particular character.
static CFX_WideString FromUTF8(const char *str, FX_STRSIZE len=-1)
Create a wide string from UTF-8 string (ASCII string compatible).
FX_LPWSTR GetBuffer(FX_STRSIZE len)
Get a buffer with specific number of characters allocated.
CFX_WideStringC()
Constructs a null constant string.
Definition: fx_string.h:1211
const CFX_WideStringC & FX_WSTR
Type definition for a reference to a constant CFX_WideStringC object.
Definition: fx_string.h:1417
FX_LPSTR LockBuffer()
Lock and get the current string buffer, so the caller can modify the returned buffer.
int FXWCHAR_GetDirection(FX_WCHAR wchar)
Get text direction.
CFX_WideString(FX_LPCWSTR ptr, FX_STRSIZE len=-1)
Construct from a wide character string.
Definition: fx_string.h:1471
bool IsEmpty() const
Check whether current string object is empty.
Definition: fx_string.h:409
void TrimLeft()
Trim white spaces from the left side of the wide string.
long m_nRefs
Reference count.
Definition: fx_string.h:305
#define NULL
The null-pointer value.
Definition: fx_system.h:767
const CFX_ByteStringC & FX_BSTR
A reference to a constant CFX_ByteStringC object.
Definition: fx_string.h:285
FX_STRSIZE Find(FX_LPCWSTR lpszSub, FX_STRSIZE start=0) const
Find a sub-string, from specific position. Only first occurrence is found.
FX_STRSIZE Replace(FX_LPCWSTR lpszOld, FX_LPCWSTR lpszNew)
Replace all patterns in the string with a new sub-string.
CFX_WideStringC(FX_LPCWSTR ptr, FX_STRSIZE len)
Construct from a character string.
Definition: fx_string.h:1248
void MakeUpper()
Change case of English letters to upper.
int FX_BOOL
Boolean variable (should be TRUE or FALSE).
Definition: fx_system.h:669
CFX_WideStringC Left(FX_STRSIZE count) const
Extracts the first (leftmost) count wide characters from this CFX_WideStringC object as a sub-string.
Definition: fx_string.h:1366
long m_nRefs
Reference count.
Definition: fx_string.h:1437
void TrimRight()
Trim white spaces from the right side of the wide string.
static FX_STRSIZE WStringLength(const unsigned short *str)
Length of string.
void TrimRight()
Trim white spaces from the right side of the byte string.
CFX_ByteStringC & operator=(FX_LPCSTR src)
Assignment(=) operator overload. From a character string.
Definition: fx_string.h:137
bool operator!=(const CFX_WideString &s1, const CFX_WideString &s2)
Comparison(!=) operator overload. Case-sensitive.
FX_STRSIZE Remove(FX_CHAR ch)
Remove all occurrence of a particular character.
void ReleaseBuffer(FX_STRSIZE len=-1)
Release the buffer fetched by function CFX_WideString::GetBuffer or CFX_WideString::LockBuffer,...
FX_LPCSTR GetCStr() const
Get a constant character string pointer to the byte string.
Definition: fx_string.h:221
FX_FLOAT FX_atof(FX_BSTR str)
Convert a non-buffered byte string to a floating-point number.
FX_BOOL FX_IsUtf16SurrogatePair(FX_WCHAR first, FX_WCHAR second)
Determines if the arguments constitute UTF-16 surrogate pair.
Definition: fx_string.h:2352
FX_DWORD FX_CreateCodePointFromUtf16SurrogatePair(FX_WCHAR first, FX_WCHAR second)
Creates a Unicode code point from UTF16 surrogate pair.
Definition: fx_string.h:2368
CFX_WideStringC Right(FX_STRSIZE count) const
Extracts the last (rightmost) count wide characters from this CFX_WideStringC object as a sub-string.
Definition: fx_string.h:1396
void SetAt(FX_STRSIZE nIndex, FX_WCHAR ch)
Overwrites a single wide character specified by an index number.
~CFX_WideString()
The Destructor.
void Empty()
Set this string to be empty.
Definition: fx_string.h:1121
FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_LPSTR buf)
Convert float to byte string.
static CFX_ByteString FormatFloat(FX_FLOAT f, int precision=0)
Convert from floating-point number.
const CFX_ByteString & operator+=(FX_CHAR ch)
Concatenation(+=) operator overload. Concatenate a single character.
void Empty()
Set this string to be empty.
CFX_ByteString Left(FX_STRSIZE count) const
Extracts the first (leftmost) count bytes from this CFX_ByteString object as a sub-string.
WIDE STRING CLASS.
Definition: fx_string.h:1452
FX_STRSIZE GetSize() const
Gets the length of the string.
Definition: fx_string.h:1114
A fixed string buffer template.
Definition: fx_string.h:1178
void Copy(FX_BSTR str)
Copy from a non-buffered byte string.
int Compare(FX_LPCWSTR str) const
Compare current string with a wide character string. Case-sensitive.
CFX_ByteStringC(FX_LPCSTR ptr, FX_STRSIZE len)
Construct from a character string.
Definition: fx_string.h:105
FX_STRSIZE m_nAllocLength
Length of allocation.
Definition: fx_string.h:309
CFX_ByteStringC GetStringC() const
Get a non-buffered byte string.
Definition: fx_string.h:1158
FX_LPSTR GetBuffer(FX_STRSIZE len)
Get a buffer with specific number of bytes allocated.
FX_DWORD GetID(FX_STRSIZE start_pos=0) const
Get a DWORD identifier of the string. See function CFX_ByteStringC::GetID for details.
CONSTANT BYTE STRING CLASS.
Definition: fx_string.h:51
CFX_StringBufTemplate< 256 > CFX_StringBuf256
A fixed 256-byte string buffer.
Definition: fx_string.h:1195