CComBSTR Method
|
Description
|
CComBSTR
|
多个版本的构造函数用来创建新的
BSTR
。可以使用的参数包括
LPCOLESTR, LPCSTR, CComBSTR
。
|
~CComBSTR, Empty
|
释放内部封装的
BSTR.
|
Attach, Detach, Copy
|
Attach
把一个已经存在
BSTR
加入类中。
Detach
把劣种的
BSTR
剥离,以便在超出作用域的时候,析构函数不会释放
BSTR
。
Detach
用于把
CComBSTR
赋给
[out]
参数。
Copy
用于产生一个
BSTR
的副本。一般用于用于把
CComBSTR
内容赋给
[out]
参数。
|
operator BSTR, operator&
|
允许直接操作内部的
BSTR
。
operator BSTR
用于把
CComBSTR
传给
BSTR
输入
[in]
参数。
operator&
用于把
CComBSTR
传给
BSTR*
类型输出
[out]
参数。
|
operator=, operator+=, operator<, operator==, operator>
|
重载运算符,用于赋值、字符串连接、简单比较。
|
Append, AppendBSTR
|
字符串连接
|
Length
|
计算字符串长度
|
LoadString
|
利用字符串资源初始化
BSTR
。
|
ToLower, ToUpper
|
字符串大小写转换。
|
WriteToStream,ReadFromStream
|
从
IStream
中读
/
写
BSTR
。
|
Features Not Included in CComBSTR
|
Explanation
|
LPCSTR extraction
|
CComBSTR
可以把一个单字节字符串转换成
BSTR
,但是没有提供反向转换的功能。
_bstr_t
提供了
LPCTSTR operator
。
|
String manipulation (including Replace, Insert, Delete, Remove, Find, Mid, Left, Right, and so on)
|
CComBSTR
没有提供这些方法。如果需要,可以使用
STL
中的
wstring
。
|
Language-sensitive collation
|
CComBSTR
提供的字符串比较
(<, >, ==)
按照是
byte-by-byte
方式进行的。没有提供语言相关的比较
(language-specific collation)
。如果需要可以使用
wstring.
|
Construction
|
Version
|
|
_bstr_t
|
|
Constructs a _bstr_t object.
|
Operations
|
|
|
Assign
|
|
Copies a BSTR into the BSTR wrapped by a _bstr_t.
|
Attach
|
VC 7
|
Links a _bstr_t wrapper to a BSTR.
|
copy
|
|
Constructs a copy of the encapsulated BSTR.
|
Detach
|
VC 7
|
Returns the BSTR wrapped by a _bstr_t and detaches the BSTR from the _bstr_t.
|
GetAddress
|
VC 7
|
Points to the BSTR wrapped by a _bstr_t.
|
GetBSTR
|
VC 7
|
Points to the beginning of the BSTR wrapped by the _bstr_t.
|
length
|
|
Returns the number of characters in the _bstr_t.
|
Operators
|
|
|
operator =
|
|
Assigns a new value to an existing _bstr_t object.
|
operator +=
|
|
Appends characters to the end of the _bstr_t object.
|
operator +
|
|
Concatenates two strings.
|
operator !
|
|
Checks if the encapsulated BSTR is a NULL string.
|
operator ==, !=, <, >, <=, >=
|
|
Compares two _bstr_t objects.
|
operator wchar_t* | char*
|
|
Extract the pointers to the encapsulated Unicode or multibyte BSTR object.
|
|
|
|