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) 446 #ifndef _NO_LPCSTR_SUPPORT_ 476 #ifndef _NO_LPCSTR_SUPPORT_ 888 #define FXFORMAT_SIGNED 1 890 #define FXFORMAT_HEX 2 892 #define FXFORMAT_CAPITAL 4 939 void CopyBeforeWrite();
979 #ifndef _NO_LPCSTR_SUPPORT_ 1049 #ifndef _NO_LPCSTR_SUPPORT_ 1182 template<FX_STRSIZE limit>
1222 #ifndef _NO_LPCSTR_SUPPORT_ 1269 m_Length = src.m_Length;
1301 m_Length = src.m_Length;
1374 if (count > m_Length) count = m_Length;
1388 if (index < 0) index = 0;
1390 if (count < 0 || count > m_Length - index) count = m_Length - index;
1404 if (count > m_Length) count = m_Length;
1418 void*
operator new (size_t)
throw() {
return NULL; }
1433 #define FX_WSTRC(wstr) CFX_WideStringC((FX_LPCWSTR)wstr, sizeof(wstr) / sizeof(FX_WCHAR) - 1) 1960 void CopyBeforeWrite();
2005 #ifndef _NO_LPCSTR_SUPPORT_ 2071 #ifndef _NO_LPCSTR_SUPPORT_ 2296 #define FXWCHAR_LTR 0 2298 #define FXWCHAR_RTL 1 2300 #define FXWCHAR_UNKNOWN 2 2365 return ((first & 0xFC00) == 0xD800 && (second & 0xFC00) == 0xDC00);
2382 const FX_DWORD mask = (1 << 10) - 1;
2383 return (((first & mask) << 10) | (second & mask)) + 0x10000;
2403 if (unicode < 0x10000 || unicode > 0x10FFFF)
2407 first = (
FX_WCHAR)(0xD800 - (0x10000 >> 10) + ((unicode) >> 10));
2409 second = (
FX_WCHAR)(0xDC00 + ((unicode)&0x3FF));
2422 ~CFX_ByteStringL() {}
2438 ~CFX_WideStringL() {}
2445 int GetInteger()
const;
2455 #endif // _FX_STRING_H_ bool operator<(const CFX_WideString &lhs, const CFX_WideString &rhs)
比较(<)操作符重载。区分大小写。
FX_BYTE GetAt(FX_STRSIZE nIndex) const
获取由索引号指定的单个字节。
Definition: fx_string.h:605
CFX_ByteStringC(FX_LPCBYTE ptr, FX_STRSIZE size)
从字节字符串构造。
Definition: fx_string.h:68
为更高效追加而设计的动态二进制缓冲区。
Definition: fx_basic.h:52
int CompareNoCase(FX_LPCWSTR str) const
将字符串与宽字符字符串进行比较。不区分大小写。
CFX_ByteStringC GetStringC() const
获取非缓冲字节字符串。
Definition: fx_string.h:1164
FX_STRSIZE m_nAllocLength
分配长度。
Definition: fx_string.h:1446
FX_WCHAR GetAt(FX_STRSIZE nIndex) const
检索由索引号指定的单个宽字符。
Definition: fx_string.h:1642
FX_STRSIZE Delete(FX_STRSIZE index, FX_STRSIZE count=1)
从指定位置开始删除一个或多个字符。
wchar_t FX_WCHAR
编译器相关的Unicode字符(Microsoft编译器为16位,gcc为32位)。
Definition: fx_system.h:732
CFX_WideStringC()
构造空的常量字符串。
Definition: fx_string.h:1216
FX_STRSIZE Insert(FX_STRSIZE index, FX_WCHAR ch)
在指定位置之前插入宽字符。
const CFX_ByteStringC & FX_BSTR
常量CFX_ByteStringC对象的引用。
Definition: fx_string.h:285
FX_FLOAT GetFloat() const
转换为其他数据类型。
static CFX_ByteString FromUnicode(FX_LPCWSTR ptr, FX_STRSIZE len=-1)
从Unicode字符串创建CFX_ByteString对象。从Unicode转换为系统多字节字符集。
void TrimRight()
从字节字符串的右侧修剪空白字符。
void ReleaseBuffer(FX_STRSIZE len=-1)
释放由函数CFX_WideString::GetBuffer或 CFX_WideString::LockBuffer获取的缓冲区,并设置修改后字符串的长度。
unsigned long FX_DWORD
32位无符号整数。
Definition: fx_system.h:726
CFX_WideStringC Right(FX_STRSIZE count) const
从此CFX_WideStringC对象中提取最后(最右边)count个宽字符作为子字符串。
Definition: fx_string.h:1401
常量宽字符串类
Definition: fx_string.h:1210
bool IsEmpty() const
判断当前字符串对象是否为空。
Definition: fx_string.h:1353
FX_CHAR m_String[1]
实际数据(实际上是可变大小的数组)。
Definition: fx_string.h:311
CFX_WideStringC Left(FX_STRSIZE count) const
从此CFX_WideStringC对象中提取第一个(最左边)count个宽字符作为子字符串。
Definition: fx_string.h:1371
long m_nRefs
引用计数。
Definition: fx_string.h:305
FX_STRSIZE Find(FX_LPCWSTR lpszSub, FX_STRSIZE start=0) const
从指定位置查找子字符串。只找到第一次出现。
FX_STRSIZE GetLength() const
获取字节字符串的长度。
Definition: fx_string.h:1347
FX_STRSIZE GetLength() const
获取字节字符串的长度。
Definition: fx_string.h:227
CFX_WideStringC Mid(FX_STRSIZE index, FX_STRSIZE count=-1) const
从此CFX_WideStringC对象中提取长度为count字节的子字符串,从位置index(基于零)开始。
Definition: fx_string.h:1386
CFX_ByteStringC(FX_LPCSTR ptr)
从字符字符串构造。
Definition: fx_string.h:81
FX_FLOAT FX_atof(FX_BSTR str)
将非缓冲字节字符串转换为浮点数。
CFX_ByteStringC(FX_LPCSTR ptr, FX_STRSIZE len)
从字符字符串构造。
Definition: fx_string.h:105
bool Equal(const CFX_WideStringC &str) const
检查当前字符串是否等于另一个字符串。
bool operator==(const CFX_ByteStringC &str) const
比较(==)运算符重载。区分大小写。
Definition: fx_string.h:172
FX_LPSTR LockBuffer()
锁定并获取当前字符串缓冲区,以便调用者可以修改返回的缓冲区。
void Empty()
将此字符串设置为空。
Definition: fx_string.h:1127
wchar_t const * FX_LPCWSTR
指向常量Unicode字符的指针。
Definition: fx_system.h:736
void TrimLeft()
从字节字符串的左侧修剪空白字符。
FX_STRSIZE Delete(FX_STRSIZE index, FX_STRSIZE count=1)
从指定位置开始删除一个或多个宽字符。
FX_BYTE operator[](FX_STRSIZE nIndex) const
下标([])运算符重载。它检索由nIndex中基于零的索引指定的单个字节。
Definition: fx_string.h:613
#define FXSYS_strlen
获取ANSIC字符串的长度。
Definition: fx_system.h:879
FX_LPWSTR GetBuffer(FX_STRSIZE len)
获取已分配指定数量字符的缓冲区。
FX_STRSIZE GetSize() const
获取字符串的长度。
Definition: fx_string.h:1120
CFX_WideString(FX_LPCWSTR ptr, FX_STRSIZE len=-1)
从宽字符字符串构造。
Definition: fx_string.h:1476
FX_INT32 FXSYS_memcmp32(const void *buf1, const void *buf2, size_t size)
比较两个缓冲区中的数据。
char * FX_LPSTR
指向8位Windows (ANSI) 字符的指针。
Definition: fx_system.h:703
CFX_StringBufTemplate< 256 > CFX_StringBuf256
固定的256字节字符串缓冲区。
Definition: fx_string.h:1200
FX_LPSTR GetBuffer(FX_STRSIZE len)
获取分配了指定字节数的缓冲区。
void Load(FX_LPCBYTE str, FX_STRSIZE len)
从字节字符串加载。
FX_STRSIZE Remove(FX_WCHAR ch)
移除特定字符的所有出现。
CFX_ByteStringC(const CFX_ByteStringC &src)
复制构造函数
Definition: fx_string.h:118
CFX_WideStringC & operator=(FX_LPCWSTR src)
赋值(=)运算符重载。来自字符串。
Definition: fx_string.h:1285
void ConvertFrom(const CFX_WideString &str, CFX_CharMap *pCharMap=NULL)
使用指定的字符映射器将unicode数据加载到此字节字符串中。 如果未指定字符映射器,将使用系统默认映射器。
bool operator !=(const CFX_WideStringC &str) const
比较(!=)运算符重载。区分大小写。
Definition: fx_string.h:1331
宽字符串类
Definition: fx_string.h:1457
void TrimLeft()
从宽字符串的左侧修剪空白字符。
CFX_WideStringC(const CFX_WideStringC &src)
复制构造函数
Definition: fx_string.h:1266
void MakeUpper()
将英文字母的大小写更改为大写。
static FX_STRSIZE WStringLength(const unsigned short *str)
字符串的长度。
FX_LPCBYTE GetPtr() const
获取指向字节字符串的常量字节字符串指针。
Definition: fx_string.h:215
FX_BOOL FXWCHAR_IsWordBreak(FX_WCHAR wchar)
检查Unicode是否可以断词。
FX_STRSIZE Replace(FX_LPCWSTR lpszOld, FX_LPCWSTR lpszNew)
用新的子字符串替换字符串中的所有模式。
FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_LPSTR buf, int precision=0)
将浮点数转换为字节字符串。
static CFX_WideString FromUTF8(const char *str, FX_STRSIZE len=-1)
从UTF-8字符串(ASCII字符串兼容)创建宽字符串。
void TrimRight()
从宽字符串的右侧修剪空白字符。
此类表示宽字符串对象的数据。
Definition: fx_string.h:1439
FX_WCHAR FXWCHAR_GetUpper(FX_WCHAR wchar)
转换为大写字母。
FX_WCHAR FXWCHAR_GetLower(FX_WCHAR wchar)
转换为小写字母。
FX_WCHAR m_String[1]
实际数据(实际上是可变大小的数组)。
Definition: fx_string.h:1448
FX_STRSIZE GetLength() const
获取字符数,不是字节数。不计算尾随零。
Definition: fx_string.h:1573
FX_STRSIZE Remove(FX_CHAR ch)
删除特定字符的所有出现。
void Reserve(FX_STRSIZE len)
保留可以容纳指定字节数的缓冲区。
FX_BOOL FXWCHAR_IsSpace(FX_WCHAR wchar)
检查Unicode是否为空格。
CFX_WideString()
构造空的宽字符串。
Definition: fx_string.h:1463
固定字符串缓冲区,最多容纳特定数量的字符。
Definition: fx_string.h:1099
int FX_INT32
32位有符号整数。
Definition: fx_system.h:683
void * FXSYS_memset32(void *dst, FX_INT32 v, size_t size)
将缓冲区数据设置为指定值。
int FX_STRSIZE
字符串大小限制为 2^31-1。
Definition: fx_string.h:35
固定字符串缓冲区模板。
Definition: fx_string.h:1183
bool EqualNoCase(FX_BSTR str) const
检查当前字符串是否等于另一个字符串,不考虑大小写。
FX_STRSIZE m_nAllocLength
分配长度。
Definition: fx_string.h:309
const CFX_ByteString & operator+=(FX_CHAR ch)
连接(+=)运算符重载。连接单个字符。
FX_WCHAR GetAt(FX_STRSIZE index) const
检索由索引号指定的单个字节。
Definition: fx_string.h:1362
int Compare(FX_LPCWSTR str) const
将当前字符串与宽字符字符串进行比较。区分大小写。
CFX_ByteStringC()
构造一个空的常量字符串。
Definition: fx_string.h:57
int FX_BOOL
布尔变量(应为TRUE或FALSE)。
Definition: fx_system.h:691
int Compare(FX_BSTR str) const
将字符串与另一个字符串进行比较。区分大小写。
CFX_WideStringC(FX_WCHAR &ch)
从单个字符构造。
Definition: fx_string.h:1242
void Format(FX_LPCSTR lpszFormat,...)
将一些参数格式化到此字节字符串中。
char const * FX_LPCSTR
指向常量8位Windows (ANSI) 字符的指针。
Definition: fx_system.h:705
#define FXSYS_wcslen
获取宽字符字符串的长度。
Definition: fx_system.h:1028
const CFX_WideString & operator+=(FX_LPCWSTR str)
连接(+=)运算符重载。连接宽字符字符串。
CFX_ByteString UTF16LE_Encode(FX_BOOL bTerminate=true) const
进行UTF16LE编码。
static CFX_WideString FromLocal(const char *str, FX_STRSIZE len=-1)
从系统多字节字符集创建宽字符串。
CFX_ByteString Left(FX_STRSIZE count) const
从此CFX_ByteString对象中提取第一个(最左边)count个字节作为子字符串。
FX_DWORD GetID(FX_STRSIZE start_pos=0) const
获取字符串的DWORD标识符。有关详细信息,请参阅函数CFX_ByteStringC::GetID。
CFX_ByteString GetString() const
获取缓冲字节字符串。
Definition: fx_string.h:1170
void SetAt(FX_STRSIZE nIndex, FX_CHAR ch)
覆盖由索引号指定的单个字节。
FX_STRSIZE GetLength() const
获取字节字符串中的字节数(不计算任何可能的终止符)。
Definition: fx_string.h:402
FX_STRSIZE m_nDataLength
数据长度(不包括终止符)。
Definition: fx_string.h:307
FX_WCHAR operator[](FX_STRSIZE nIndex) const
下标([])运算符重载。它检索由nIndex中零基索引指定的宽字符。
Definition: fx_string.h:1650
此类表示字节字符串对象的数据。
Definition: fx_string.h:302
bool IsEmpty() const
检查当前字符串对象是否为空。
Definition: fx_string.h:409
FX_CHAR m_Buffer[limit]
固定字符串缓冲区。
Definition: fx_string.h:1196
CFX_ByteString UTF8Encode() const
进行UTF8编码。
void MakeLower()
将英文字母的大小写更改为小写。
CFX_ByteStringC Mid(FX_STRSIZE index, FX_STRSIZE count=-1) const
此方法从此CFX_ByteStringC对象中提取长度为count字节的子字符串, 从位置index(基于零)开始。
Definition: fx_string.h:263
static CFX_ByteString FormatInteger64(FX_INT64 i)
从Integer64转换。
static CFX_ByteString FormatFloat(FX_FLOAT f, int precision=0)
从浮点数转换。
FX_STRSIZE m_nDataLength
数据长度(不包括终止符)。
Definition: fx_string.h:1444
CFX_ByteString Mid(FX_STRSIZE first) const
从此CFX_ByteString对象中提取子字符串,从位置nFirst(基于零)开始到最后。
CFX_ByteString operator+(FX_BSTR str1, FX_BSTR str2)
连接非缓冲字节字符串和非缓冲字节字符串。
Definition: fx_string.h:977
Foxit分配器接口。
Definition: fx_memory.h:994
Definition: fx_basic.h:937
void ConvertFrom(const CFX_ByteString &str, CFX_CharMap *pCharMap=NULL)
使用指定的字符映射器将MBCS数据加载到此宽字符串中。
char FX_CHAR
8位Windows (ANSI) 字符。
Definition: fx_system.h:701
void FX_atonum(FX_BSTR str, FX_BOOL &bInteger, void *pData, int sizeOfData=4)
将非缓冲字节字符串转换为数字。
FX_LPCSTR GetCStr() const
获取指向字节字符串的常量字符字符串指针。
Definition: fx_string.h:221
float FX_FLOAT
32位浮点数。
Definition: fx_system.h:685
CFX_StringBufBase(FX_STRSIZE limit)
构造函数
Definition: fx_string.h:1107
bool IsEmpty() const
检查当前字符串对象是否为空。
Definition: fx_string.h:233
FX_BOOL FX_CreateUtf16SurrogatePairFromCodePoint(FX_DWORD unicode, FX_WCHAR &first, FX_WCHAR &second)
从Unicode代码点创建UTF16代理对。
Definition: fx_string.h:2398
FX_STRSIZE ReverseFind(FX_CHAR ch) const
从字符串末尾查找字符
bool operator<(const CFX_ByteString &rhs) const
比较(<)运算符重载。区分大小写。
void FormatV(FX_LPCSTR lpszFormat, va_list argList)
使用va_list将一些参数格式化到此字节字符串中。
CFX_ByteString FX_UTF8Encode(FX_LPCWSTR pwsStr, FX_STRSIZE len)
将宽字符串编码为UTF-8字符串。
void SetAt(FX_STRSIZE nIndex, FX_WCHAR ch)
覆写由索引号指定的单个宽字符。
void Append(FX_BSTR str)
追加非缓冲字节字符串。
bool operator !=(FX_LPCSTR str) const
比较(!=)运算符重载。区分大小写。
Definition: fx_string.h:485
CFX_ByteStringC & operator=(FX_LPCSTR src)
赋值(=)运算符重载。来自字符字符串。
Definition: fx_string.h:137
FX_BYTE GetAt(FX_STRSIZE index) const
此方法检索由索引号指定的单个字节。
Definition: fx_string.h:252
static CFX_ByteString LoadFromFile(FX_BSTR file_path)
加载文件的全部内容。
常量字节字符串类
Definition: fx_string.h:51
CFX_ByteString()
构造一个空的字节字符串。
Definition: fx_string.h:323
const CFX_WideStringC & FX_WSTR
常量CFX_WideStringC对象的引用的类型定义。
Definition: fx_string.h:1422
bool operator!=(const CFX_WideString &s1, const CFX_WideString &s2)
比较(!=)操作符重载。区分大小写。
FX_STRSIZE Replace(FX_BSTR lpszOld, FX_BSTR lpszNew)
将字符串中的所有模式替换为新的子字符串。
void Reserve(FX_STRSIZE len)
保留可容纳指定数量字符的缓冲区。
static CFX_ByteString FormatInteger(FX_INT32 i, FX_DWORD flags=0)
从整数转换。
CFX_WideStringC(FX_LPCWSTR ptr)
从字符串构造。
Definition: fx_string.h:1229
bool operator==(const CFX_WideStringC &str) const
比较(==)运算符重载。区分大小写。
Definition: fx_string.h:1320
FX_STRSIZE Find(FX_BSTR lpszSub, FX_STRSIZE start=0) const
从指定位置查找子字符串。仅找到第一次出现的位置。
CFX_ByteString Right(FX_STRSIZE count) const
从此CFX_ByteString对象中提取最后(最右边)count个字节作为子字符串。
long m_nRefs
引用计数。
Definition: fx_string.h:1442
CFX_WideString UTF8Decode() const
解码UTF-8 unicode字符串(假设此字节字符串是UTF-8编码的)。
static CFX_WideString FromUTF16BE(const unsigned short *str, FX_STRSIZE len=-1)
从UTF16BE编码字符串创建宽字符串。
void MakeUpper()
将英文字母的大小写更改为大写。
字节字符串类
Definition: fx_string.h:317
int GetInteger() const
转换为其他数据类型。
unsigned char const * FX_LPCBYTE
指向常量FX_BYTE的指针。
Definition: fx_system.h:669
bool operator !=(const CFX_ByteStringC &str) const
比较(!=)运算符重载。区分大小写。
Definition: fx_string.h:183
FX_DWORD FX_CreateCodePointFromUtf16SurrogatePair(FX_WCHAR first, FX_WCHAR second)
从UTF16代理对创建Unicode代码点。
Definition: fx_string.h:2379
FX_CHAR * GetPtr() const
获取指向字符串缓冲区的C风格字符串指针。
Definition: fx_string.h:1114
FX_LPWSTR LockBuffer()
锁定并获取当前字符串缓冲区,以便调用者可以修改返回的缓冲区。 调用者可以修改返回的缓冲区,并在修改完成后调用CFX_WideString::ReleaseBuffer。
static CFX_WideString FromUTF16LE(const unsigned short *str, FX_STRSIZE len=-1)
从UTF16LE编码字符串创建宽字符串。
wchar_t * FX_LPWSTR
指向Unicode字符的指针。
Definition: fx_system.h:734
CFX_WideString Right(FX_STRSIZE count) const
从此CFX_WideString对象中提取最后(最右边)count个宽字符作为子字符串。
void MakeLower()
将英文字母的大小写更改为小写。
#define NULL
空指针值。
Definition: fx_system.h:792
FX_BOOL IsEmpty() const
检查当前字符串对象是否为空。
Definition: fx_string.h:1566
bool Equal(FX_BSTR str) const
检查当前字符串是否等于另一个字符串。区分大小写。
CFX_WideString Left(FX_STRSIZE count) const
从此CFX_WideString对象中提取前(最左边)count个宽字符作为子字符串。
void Copy(FX_BSTR str)
从非缓冲字节字符串复制。
bool operator==(const CFX_WideString &s1, const CFX_WideString &s2)
比较(==)操作符重载。区分大小写。
void ReleaseBuffer(FX_STRSIZE len=-1)
释放由函数CFX_ByteString::GetBuffer或 CFX_ByteString::LockBuffer获取的缓冲区,并设置修改后字符串的长度。
const CFX_WideString & operator=(FX_LPCWSTR str)
赋值(=)运算符重载。来自宽字符字符串。
void FormatV(FX_LPCWSTR lpszFormat, va_list argList)
使用va_list将多个参数格式化到此宽字符串中。
FX_BOOL FX_IsUtf16SurrogatePair(FX_WCHAR first, FX_WCHAR second)
确定参数是否构成UTF-16代理对。
Definition: fx_string.h:2363
FX_LPCWSTR GetPtr() const
获取指向宽字符串的常量宽字符串指针。
Definition: fx_string.h:1341
int FXWCHAR_GetDirection(FX_WCHAR wchar)
获取文本方向。
CFX_StringBufTemplate()
构造函数。
Definition: fx_string.h:1189
CFX_WideStringC(FX_LPCWSTR ptr, FX_STRSIZE len)
从字符串构造。
Definition: fx_string.h:1253
CFX_ByteStringC(const FX_CHAR &ch)
从单个字符构造。
Definition: fx_string.h:94
FX_STRSIZE Insert(FX_STRSIZE index, FX_CHAR ch)
在指定位置之前插入字符。
const CFX_ByteString & operator=(FX_LPCSTR str)
赋值(=)运算符重载。来自字符字符串。
CFX_WideString Mid(FX_STRSIZE first) const
从此CFX_WideString对象中提取子字符串,从位置nFirst(零基)开始到结束。
unsigned char FX_BYTE
字节(8位)。
Definition: fx_system.h:665
FX_DWORD GetID(FX_STRSIZE start_pos=0) const
从特定位置获取字符串的DWORD标识符。
bool operator==(FX_LPCSTR str) const
比较(==)运算符重载。区分大小写。
Definition: fx_string.h:455
void Format(FX_LPCWSTR lpszFormat,...)
将多个参数格式化到此宽字符串中。