Foxit PDF SDK
CFX_WideString类 参考

宽字符串类 更多...

继承自 CFX_Object .

Public 成员函数

 CFX_WideString ()
 构造空的宽字符串。
 
 CFX_WideString (const CFX_WideString &str)
 复制构造函数。 更多...
 
 CFX_WideString (FX_LPCWSTR ptr, FX_STRSIZE len=-1)
 从宽字符字符串构造。 更多...
 
 CFX_WideString (FX_WCHAR ch)
 从单个宽字符构造。 更多...
 
 CFX_WideString (const CFX_WideStringC &str)
 从CFX_WideStringC对象的常量引用构造。 更多...
 
 CFX_WideString (const CFX_WideStringC &str1, const CFX_WideStringC &str2)
 连接构造函数。 更多...
 
 ~CFX_WideString ()
 析构函数。
 
int Compare (FX_LPCWSTR str) const
 将当前字符串与宽字符字符串进行比较。区分大小写。 更多...
 
int Compare (const CFX_WideString &str) const
 将字符串与另一个字符串进行比较。区分大小写。 更多...
 
int CompareNoCase (FX_LPCWSTR str) const
 将字符串与宽字符字符串进行比较。不区分大小写。 更多...
 
void ConvertFrom (const CFX_ByteString &str, CFX_CharMap *pCharMap=NULL)
 使用指定的字符映射器将MBCS数据加载到此宽字符串中。 更多...
 
FX_STRSIZE Delete (FX_STRSIZE index, FX_STRSIZE count=1)
 从指定位置开始删除一个或多个宽字符。 更多...
 
void Empty ()
 将此字符串设置为空。 更多...
 
bool Equal (const CFX_WideStringC &str) const
 检查当前字符串是否等于另一个字符串。 更多...
 
FX_STRSIZE Find (FX_LPCWSTR lpszSub, FX_STRSIZE start=0) const
 从指定位置查找子字符串。只找到第一次出现。 更多...
 
FX_STRSIZE Find (FX_WCHAR ch, FX_STRSIZE start=0) const
 从指定位置查找字符。只找到第一次出现。 更多...
 
void Format (FX_LPCWSTR lpszFormat,...)
 将多个参数格式化到此宽字符串中。 更多...
 
void FormatV (FX_LPCWSTR lpszFormat, va_list argList)
 使用va_list将多个参数格式化到此宽字符串中。 更多...
 
FX_WCHAR GetAt (FX_STRSIZE nIndex) const
 检索由索引号指定的单个宽字符。 更多...
 
FX_LPWSTR GetBuffer (FX_STRSIZE len)
 获取已分配指定数量字符的缓冲区。 更多...
 
FX_FLOAT GetFloat () const
 转换为其他数据类型。 更多...
 
int GetInteger () const
 转换为其他数据类型。 更多...
 
FX_STRSIZE GetLength () const
 获取字符数,不是字节数。不计算尾随零。 更多...
 
FX_STRSIZE Insert (FX_STRSIZE index, FX_WCHAR ch)
 在指定位置之前插入宽字符。 更多...
 
FX_BOOL IsEmpty () const
 检查当前字符串对象是否为空。 更多...
 
CFX_WideString Left (FX_STRSIZE count) const
 从此CFX_WideString对象中提取前(最左边)count个宽字符作为子字符串。 更多...
 
FX_LPWSTR LockBuffer ()
 锁定并获取当前字符串缓冲区,以便调用者可以修改返回的缓冲区。 调用者可以修改返回的缓冲区,并在修改完成后调用CFX_WideString::ReleaseBuffer更多...
 
void MakeLower ()
 将英文字母的大小写更改为小写。 更多...
 
void MakeUpper ()
 将英文字母的大小写更改为大写。 更多...
 
CFX_WideString Mid (FX_STRSIZE first) const
 从此CFX_WideString对象中提取子字符串,从位置nFirst(零基)开始到结束。 更多...
 
CFX_WideString Mid (FX_STRSIZE first, FX_STRSIZE count) const
 从此CFX_WideString对象中提取count个宽字符的子字符串, 从位置nFirst(零基)开始到结束。 更多...
 
 operator FX_LPCWSTR () const
 FX_LPCWSTR类型转换操作符。
 
const CFX_WideStringoperator+= (FX_LPCWSTR str)
 连接(+=)运算符重载。连接宽字符字符串。 更多...
 
const CFX_WideStringoperator+= (FX_WCHAR ch)
 连接(+=)运算符重载。连接单个宽字符。 更多...
 
const CFX_WideStringoperator+= (const CFX_WideString &str)
 连接(+=)运算符重载。连接宽字符串。 更多...
 
const CFX_WideStringoperator+= (const CFX_WideStringC &str)
 连接(+=)运算符重载。连接常量宽字符串。 更多...
 
const CFX_WideStringoperator= (FX_LPCWSTR str)
 赋值(=)运算符重载。来自宽字符字符串。 更多...
 
const CFX_WideStringoperator= (const CFX_WideString &stringSrc)
 赋值(=)运算符重载。来自宽字符串。 更多...
 
const CFX_WideStringoperator= (const CFX_WideStringC &stringSrc)
 赋值(=)运算符重载。来自常量宽字符串。 更多...
 
FX_WCHAR operator[] (FX_STRSIZE nIndex) const
 下标([])运算符重载。它检索由nIndex中零基索引指定的宽字符。 更多...
 
void ReleaseBuffer (FX_STRSIZE len=-1)
 释放由函数CFX_WideString::GetBufferCFX_WideString::LockBuffer获取的缓冲区,并设置修改后字符串的长度。 更多...
 
FX_STRSIZE Remove (FX_WCHAR ch)
 移除特定字符的所有出现。 更多...
 
FX_STRSIZE Replace (FX_LPCWSTR lpszOld, FX_LPCWSTR lpszNew)
 用新的子字符串替换字符串中的所有模式。 更多...
 
void Reserve (FX_STRSIZE len)
 保留可容纳指定数量字符的缓冲区。 更多...
 
CFX_WideString Right (FX_STRSIZE count) const
 从此CFX_WideString对象中提取最后(最右边)count个宽字符作为子字符串。 更多...
 
void SetAt (FX_STRSIZE nIndex, FX_WCHAR ch)
 覆写由索引号指定的单个宽字符。 更多...
 
void TrimLeft ()
 从宽字符串的左侧修剪空白字符。 更多...
 
void TrimLeft (FX_WCHAR chTarget)
 从宽字符串的左侧修剪指定字符的连续出现。 更多...
 
void TrimLeft (FX_LPCWSTR lpszTargets)
 从宽字符串的左侧修剪指定字符集的连续出现。 更多...
 
void TrimRight ()
 从宽字符串的右侧修剪空白字符。 更多...
 
void TrimRight (FX_WCHAR chTarget)
 从宽字符串的右侧修剪指定字符的连续出现。 更多...
 
void TrimRight (FX_LPCWSTR lpszTargets)
 从宽字符串的右侧修剪指定字符集的连续出现。 更多...
 
CFX_ByteString UTF16LE_Encode (FX_BOOL bTerminate=true) const
 进行UTF16LE编码。 更多...
 
CFX_ByteString UTF8Encode () const
 进行UTF8编码。 更多...
 

静态 Public 成员函数

static CFX_WideString FromLocal (const char *str, FX_STRSIZE len=-1)
 从系统多字节字符集创建宽字符串。 更多...
 
static CFX_WideString FromUTF16BE (const unsigned short *str, FX_STRSIZE len=-1)
 从UTF16BE编码字符串创建宽字符串。 更多...
 
static CFX_WideString FromUTF16LE (const unsigned short *str, FX_STRSIZE len=-1)
 从UTF16LE编码字符串创建宽字符串。 更多...
 
static CFX_WideString FromUTF8 (const char *str, FX_STRSIZE len=-1)
 从UTF-8字符串(ASCII字符串兼容)创建宽字符串。 更多...
 
static FX_STRSIZE WStringLength (const unsigned short *str)
 字符串的长度。 更多...
 

详细描述

宽字符串类

在Windows平台上,宽字符串由UTF-16LE编码表示; 在Unix/Linux平台上,宽字符串由UCS-4编码表示。

构造及析构函数说明

◆ CFX_WideString() [1/5]

CFX_WideString::CFX_WideString ( const CFX_WideString str)

复制构造函数。

参数
[in]strCFX_WideString对象的常量引用。

◆ CFX_WideString() [2/5]

CFX_WideString::CFX_WideString ( FX_LPCWSTR  ptr,
FX_STRSIZE  len = -1 
)
inline

从宽字符字符串构造。

参数
[in]ptr指向常量宽字符字符串的指针。
[in]len宽字符字符串的长度。对于以零结尾的宽字符字符串,可以为-1。

◆ CFX_WideString() [3/5]

CFX_WideString::CFX_WideString ( FX_WCHAR  ch)

从单个宽字符构造。

参数
[in]ch单个宽字符。

◆ CFX_WideString() [4/5]

CFX_WideString::CFX_WideString ( const CFX_WideStringC str)

从CFX_WideStringC对象的常量引用构造。

参数
[in]strCFX_WideStringC对象的常量引用。

◆ CFX_WideString() [5/5]

CFX_WideString::CFX_WideString ( const CFX_WideStringC str1,
const CFX_WideStringC str2 
)

连接构造函数。

参数
[in]str1第一个CFX_WideStringC对象的常量引用。
[in]str2第二个CFX_WideStringC对象的常量引用。

成员函数说明

◆ Compare() [1/2]

int CFX_WideString::Compare ( FX_LPCWSTR  str) const

将当前字符串与宽字符字符串进行比较。区分大小写。

参数
[in]str要比较的宽字符字符串。
返回
  • -1 表示当前字符串在字母顺序上"小于"另一个字符串。
  • 0 表示相等。
  • 1 表示当前字符串在字母顺序上"大于"另一个字符串。

◆ Compare() [2/2]

int CFX_WideString::Compare ( const CFX_WideString str) const

将字符串与另一个字符串进行比较。区分大小写。

参数
[in]str要比较的宽字符串。
返回
  • -1 表示当前字符串在字母顺序上"小于"另一个字符串。
  • 0 表示相等。
  • 1 表示当前字符串在字母顺序上"大于"另一个字符串。

◆ CompareNoCase()

int CFX_WideString::CompareNoCase ( FX_LPCWSTR  str) const

将字符串与宽字符字符串进行比较。不区分大小写。

参数
[in]str要比较的宽字符字符串。
返回
  • -1 表示当前字符串在字母顺序上"小于"另一个字符串。
  • 0 表示相等。
  • 1 表示当前字符串在字母顺序上"大于"另一个字符串。

◆ ConvertFrom()

void CFX_WideString::ConvertFrom ( const CFX_ByteString str,
CFX_CharMap pCharMap = NULL 
)

使用指定的字符映射器将MBCS数据加载到此宽字符串中。

如果未指定字符映射器,将使用系统默认映射器。

参数
[in]str字节字符串。
[in]pCharMap字符映射器。
返回
无。

◆ Delete()

FX_STRSIZE CFX_WideString::Delete ( FX_STRSIZE  index,
FX_STRSIZE  count = 1 
)

从指定位置开始删除一个或多个宽字符。

参数
[in]index指定宽字符串中开始删除的零基索引。
[in]count要删除的宽字符数量。
返回
宽字符串的新长度。

◆ Empty()

void CFX_WideString::Empty ( )

将此字符串设置为空。

返回
无。

◆ Equal()

bool CFX_WideString::Equal ( const CFX_WideStringC str) const

检查当前字符串是否等于另一个字符串。

当只需要检查两个字符串是否相等时,此函数比CFX_WideString::Compare更快。

参数
[in]str要比较的宽字符串。
返回
true 表示相等,false 表示不相等。

◆ Find() [1/2]

FX_STRSIZE CFX_WideString::Find ( FX_LPCWSTR  lpszSub,
FX_STRSIZE  start = 0 
) const

从指定位置查找子字符串。只找到第一次出现。

参数
[in]lpszSub要查找的子字符串。
[in]start指定进行查找的起始位置的零基索引。默认值:0。
返回
在当前字符串中第一次出现的位置。-1表示未找到。

◆ Find() [2/2]

FX_STRSIZE CFX_WideString::Find ( FX_WCHAR  ch,
FX_STRSIZE  start = 0 
) const

从指定位置查找字符。只找到第一次出现。

参数
[in]ch要查找的字符。
[in]start指定进行查找的起始位置的零基索引。默认值:0。
返回
在当前字符串中第一次出现的位置。-1表示未找到。

◆ Format()

void CFX_WideString::Format ( FX_LPCWSTR  lpszFormat,
  ... 
)

将多个参数格式化到此宽字符串中。

参数
[in]lpszFormat指定格式控制字符串。
返回
无。

◆ FormatV()

void CFX_WideString::FormatV ( FX_LPCWSTR  lpszFormat,
va_list  argList 
)

使用va_list将多个参数格式化到此宽字符串中。

参数
[in]lpszFormat指定格式控制字符串。
[in]argList可变参数列表。
返回
无。
参见
CFX_WideString::Format

◆ FromLocal()

static CFX_WideString CFX_WideString::FromLocal ( const char *  str,
FX_STRSIZE  len = -1 
)
static

从系统多字节字符集创建宽字符串。

参数
[in]str多字节字符集字符串。
[in]len多字节字符集字符串的字节长度。 对于以零结尾的多字节字符集字符串,可以为-1。
返回
宽字符串。

◆ FromUTF16BE()

static CFX_WideString CFX_WideString::FromUTF16BE ( const unsigned short *  str,
FX_STRSIZE  len = -1 
)
static

从UTF16BE编码字符串创建宽字符串。

参数
[in]strUTF16BE编码字符串。
[in]lenUTF16BE编码字符串的字节长度。对于以零结尾的UTF16BE字符串,可以为-1。
返回
宽字符串。

◆ FromUTF16LE()

static CFX_WideString CFX_WideString::FromUTF16LE ( const unsigned short *  str,
FX_STRSIZE  len = -1 
)
static

从UTF16LE编码字符串创建宽字符串。

参数
[in]strUTF16LE编码字符串。
[in]lenUTF16LE编码字符串的字节长度。对于以零结尾的UTF16LE字符串,可以为-1。
返回
宽字符串。

◆ FromUTF8()

static CFX_WideString CFX_WideString::FromUTF8 ( const char *  str,
FX_STRSIZE  len = -1 
)
static

从UTF-8字符串(ASCII字符串兼容)创建宽字符串。

参数
[in]strUTF8字符串。
[in]lenUTF8字符串的字节长度。对于以零结尾的UTF8字符串,可以为-1。
返回
宽字符串。

◆ GetAt()

FX_WCHAR CFX_WideString::GetAt ( FX_STRSIZE  nIndex) const
inline

检索由索引号指定的单个宽字符。

参数
[in]nIndex指定宽字符串中从零开始的索引。
返回
单个宽字符。

◆ GetBuffer()

FX_LPWSTR CFX_WideString::GetBuffer ( FX_STRSIZE  len)

获取已分配指定数量字符的缓冲区。

参数
[in]len期望获取的长度。
返回
指向宽字符串的宽字符字符串指针。

◆ GetFloat()

FX_FLOAT CFX_WideString::GetFloat ( ) const

转换为其他数据类型。

返回
浮点数。

◆ GetInteger()

int CFX_WideString::GetInteger ( ) const

转换为其他数据类型。

返回
十进制数字。

◆ GetLength()

FX_STRSIZE CFX_WideString::GetLength ( ) const
inline

获取字符数,不是字节数。不计算尾随零。

返回
字符数。

◆ Insert()

FX_STRSIZE CFX_WideString::Insert ( FX_STRSIZE  index,
FX_WCHAR  ch 
)

在指定位置之前插入宽字符。

参数
[in]index指定宽字符串中的零基索引。
[in]ch单个宽字符。
返回
宽字符串的新长度。

◆ IsEmpty()

FX_BOOL CFX_WideString::IsEmpty ( ) const
inline

检查当前字符串对象是否为空。

返回
true表示当前字符串对象为空,false表示不为空。

◆ Left()

CFX_WideString CFX_WideString::Left ( FX_STRSIZE  count) const

从此CFX_WideString对象中提取前(最左边)count个宽字符作为子字符串。

参数
[in]count为子字符串期望提取的宽字符数量。
返回
CFX_WideString子字符串。

◆ LockBuffer()

FX_LPWSTR CFX_WideString::LockBuffer ( )

锁定并获取当前字符串缓冲区,以便调用者可以修改返回的缓冲区。 调用者可以修改返回的缓冲区,并在修改完成后调用CFX_WideString::ReleaseBuffer

返回
指向宽字符串的宽字符字符串指针。

◆ MakeLower()

void CFX_WideString::MakeLower ( )

将英文字母的大小写更改为小写。

返回
无。

◆ MakeUpper()

void CFX_WideString::MakeUpper ( )

将英文字母的大小写更改为大写。

返回
无。

◆ Mid() [1/2]

CFX_WideString CFX_WideString::Mid ( FX_STRSIZE  first) const

从此CFX_WideString对象中提取子字符串,从位置nFirst(零基)开始到结束。

参数
[in]first指定此CFX_WideString对象中起始位置的零基索引。
返回
CFX_WideString子字符串。

◆ Mid() [2/2]

CFX_WideString CFX_WideString::Mid ( FX_STRSIZE  first,
FX_STRSIZE  count 
) const

从此CFX_WideString对象中提取count个宽字符的子字符串, 从位置nFirst(零基)开始到结束。

参数
[in]first指定此CFX_WideString对象中起始位置的零基索引。
[in]count为子字符串期望提取的宽字符数量。
返回
CFX_WideString子字符串。

◆ operator+=() [1/4]

const CFX_WideString& CFX_WideString::operator+= ( FX_LPCWSTR  str)

连接(+=)运算符重载。连接宽字符字符串。

参数
[in]str宽字符字符串。
返回
当前对象本身的引用。

◆ operator+=() [2/4]

const CFX_WideString& CFX_WideString::operator+= ( FX_WCHAR  ch)

连接(+=)运算符重载。连接单个宽字符。

参数
[in]ch单个宽字符。
返回
当前对象本身的引用。

◆ operator+=() [3/4]

const CFX_WideString& CFX_WideString::operator+= ( const CFX_WideString str)

连接(+=)运算符重载。连接宽字符串。

参数
[in]str输入的宽字符串。
返回
当前对象本身的引用。

◆ operator+=() [4/4]

const CFX_WideString& CFX_WideString::operator+= ( const CFX_WideStringC str)

连接(+=)运算符重载。连接常量宽字符串。

参数
[in]str输入的宽字符串。
返回
当前对象本身的引用。

◆ operator=() [1/3]

const CFX_WideString& CFX_WideString::operator= ( FX_LPCWSTR  str)

赋值(=)运算符重载。来自宽字符字符串。

参数
[in]str宽字符字符串。
返回
当前对象本身的引用。

◆ operator=() [2/3]

const CFX_WideString& CFX_WideString::operator= ( const CFX_WideString stringSrc)

赋值(=)运算符重载。来自宽字符串。

参数
[in]stringSrc输入的宽字符串。
返回
当前对象本身的引用。

◆ operator=() [3/3]

const CFX_WideString& CFX_WideString::operator= ( const CFX_WideStringC stringSrc)

赋值(=)运算符重载。来自常量宽字符串。

参数
[in]stringSrc输入的宽字符串。
返回
当前对象本身的引用。

◆ operator[]()

FX_WCHAR CFX_WideString::operator[] ( FX_STRSIZE  nIndex) const
inline

下标([])运算符重载。它检索由nIndex中零基索引指定的宽字符。

参数
[in]nIndex指定宽字符串中的零基索引。
返回
单个宽字符。

◆ ReleaseBuffer()

void CFX_WideString::ReleaseBuffer ( FX_STRSIZE  len = -1)

释放由函数CFX_WideString::GetBufferCFX_WideString::LockBuffer获取的缓冲区,并设置修改后字符串的长度。

参数
[in]len期望释放到的长度。-1表示假定当前字符串是一个以零结尾的字符串。
返回
无。

◆ Remove()

FX_STRSIZE CFX_WideString::Remove ( FX_WCHAR  ch)

移除特定字符的所有出现。

参数
[in]ch指定要移除的字符。
返回
移除的字符数量。

◆ Replace()

FX_STRSIZE CFX_WideString::Replace ( FX_LPCWSTR  lpszOld,
FX_LPCWSTR  lpszNew 
)

用新的子字符串替换字符串中的所有模式。

参数
[in]lpszOld指定要在宽字符串中匹配和替换的字符串。
[in]lpszNew指定要替换的字符串。
返回
替换模式的数量。

◆ Reserve()

void CFX_WideString::Reserve ( FX_STRSIZE  len)

保留可容纳指定数量字符的缓冲区。

参数
[in]len期望保留的长度。
返回
无。
参见
CFX_ByteString::Reserve(FX_STRSIZE)

◆ Right()

CFX_WideString CFX_WideString::Right ( FX_STRSIZE  count) const

从此CFX_WideString对象中提取最后(最右边)count个宽字符作为子字符串。

参数
[in]count为子字符串期望提取的宽字符数量。
返回
CFX_WideString子字符串。

◆ SetAt()

void CFX_WideString::SetAt ( FX_STRSIZE  nIndex,
FX_WCHAR  ch 
)

覆写由索引号指定的单个宽字符。

参数
[in]nIndex指定宽字符串中的零基索引。
[in]ch单个宽字符。
返回
无。

◆ TrimLeft() [1/3]

void CFX_WideString::TrimLeft ( )

从宽字符串的左侧修剪空白字符。

返回
无。

◆ TrimLeft() [2/3]

void CFX_WideString::TrimLeft ( FX_WCHAR  chTarget)

从宽字符串的左侧修剪指定字符的连续出现。

参数
[in]chTarget指定字符。
返回
无。

◆ TrimLeft() [3/3]

void CFX_WideString::TrimLeft ( FX_LPCWSTR  lpszTargets)

从宽字符串的左侧修剪指定字符集的连续出现。

参数
[in]lpszTargets指定字符集。
返回
无。

◆ TrimRight() [1/3]

void CFX_WideString::TrimRight ( )

从宽字符串的右侧修剪空白字符。

返回
无。

◆ TrimRight() [2/3]

void CFX_WideString::TrimRight ( FX_WCHAR  chTarget)

从宽字符串的右侧修剪指定字符的连续出现。

参数
[in]chTarget指定字符。
返回
无。

◆ TrimRight() [3/3]

void CFX_WideString::TrimRight ( FX_LPCWSTR  lpszTargets)

从宽字符串的右侧修剪指定字符集的连续出现。

参数
[in]lpszTargets指定字符集。
返回
无。

◆ UTF16LE_Encode()

CFX_ByteString CFX_WideString::UTF16LE_Encode ( FX_BOOL  bTerminate = true) const

进行UTF16LE编码。

参数
[in]bTerminate
返回
表示UTF-16LE编码内存块的字节字符串。

◆ UTF8Encode()

CFX_ByteString CFX_WideString::UTF8Encode ( ) const

进行UTF8编码。

返回
字节字符串。

◆ WStringLength()

static FX_STRSIZE CFX_WideString::WStringLength ( const unsigned short *  str)
static

字符串的长度。

参数
[in]str字符串。
返回
字符串的长度。