ReactOS 0.4.15-dev-6056-gb29b268
ATL::CComBSTR Class Reference

#include <atlcomcli.h>

Public Member Functions

 CComBSTR ()
 
 CComBSTR (LPCOLESTR pSrc)
 
 CComBSTR (int length)
 
 CComBSTR (int length, LPCOLESTR pSrc)
 
 CComBSTR (PCSTR pSrc)
 
 CComBSTR (const CComBSTR &other)
 
 CComBSTR (REFGUID guid)
 
 ~CComBSTR ()
 
 operator BSTR () const
 
BSTRoperator& ()
 
CComBSTRoperator= (const CComBSTR &other)
 
void Attach (BSTR bstr)
 
BSTR Detach ()
 
BSTR Copy () const
 
HRESULT CopyTo (BSTR *other) const
 
bool LoadString (HMODULE module, DWORD uID)
 
unsigned int Length () const
 
unsigned int ByteLength () const
 

Public Attributes

BSTR m_str
 

Detailed Description

Definition at line 264 of file atlcomcli.h.

Constructor & Destructor Documentation

◆ CComBSTR() [1/7]

ATL::CComBSTR::CComBSTR ( )
inline

Definition at line 269 of file atlcomcli.h.

269 :
270 m_str(NULL)
271 {
272 }
#define NULL
Definition: types.h:112

◆ CComBSTR() [2/7]

ATL::CComBSTR::CComBSTR ( LPCOLESTR  pSrc)
inline

Definition at line 274 of file atlcomcli.h.

275 {
276 if (pSrc == NULL)
277 m_str = NULL;
278 else
279 m_str = ::SysAllocString(pSrc);
280 }
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238

◆ CComBSTR() [3/7]

ATL::CComBSTR::CComBSTR ( int  length)
inline

Definition at line 282 of file atlcomcli.h.

283 {
284 if (length == 0)
285 m_str = NULL;
286 else
288 }
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:339

◆ CComBSTR() [4/7]

ATL::CComBSTR::CComBSTR ( int  length,
LPCOLESTR  pSrc 
)
inline

Definition at line 290 of file atlcomcli.h.

291 {
292 if (length == 0)
293 m_str = NULL;
294 else
296 }

◆ CComBSTR() [5/7]

ATL::CComBSTR::CComBSTR ( PCSTR  pSrc)
inline

Definition at line 298 of file atlcomcli.h.

299 {
300 if (pSrc)
301 {
302 int len = MultiByteToWideChar(CP_THREAD_ACP, 0, pSrc, -1, NULL, 0);
304 if (m_str)
305 {
306 int res = MultiByteToWideChar(CP_THREAD_ACP, 0, pSrc, -1, m_str, len);
307 ATLASSERT(res == len);
308 if (res != len)
309 {
311 m_str = NULL;
312 }
313 }
314 }
315 else
316 {
317 m_str = NULL;
318 }
319 }
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
#define MultiByteToWideChar
Definition: compat.h:110
GLuint res
Definition: glext.h:9613
GLenum GLsizei len
Definition: glext.h:6722
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
#define CP_THREAD_ACP
Definition: winnls.h:233

◆ CComBSTR() [6/7]

ATL::CComBSTR::CComBSTR ( const CComBSTR other)
inline

Definition at line 321 of file atlcomcli.h.

322 {
323 m_str = other.Copy();
324 }
int other
Definition: msacm.c:1376

◆ CComBSTR() [7/7]

ATL::CComBSTR::CComBSTR ( REFGUID  guid)
inline

Definition at line 326 of file atlcomcli.h.

327 {
328 OLECHAR szGuid[40];
331 }
WCHAR OLECHAR
Definition: compat.h:2292
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2434
const GUID * guid
static const WCHAR szGuid[]
Definition: rtlstr.c:1892

◆ ~CComBSTR()

ATL::CComBSTR::~CComBSTR ( )
inline

Definition at line 333 of file atlcomcli.h.

334 {
336 m_str = NULL;
337 }

Member Function Documentation

◆ Attach()

void ATL::CComBSTR::Attach ( BSTR  bstr)
inline

Definition at line 356 of file atlcomcli.h.

357 {
359 m_str = bstr;
360 }

◆ ByteLength()

unsigned int ATL::CComBSTR::ByteLength ( ) const
inline

Definition at line 400 of file atlcomcli.h.

401 {
402 return ::SysStringByteLen(m_str);
403 }

◆ Copy()

BSTR ATL::CComBSTR::Copy ( ) const
inline

Definition at line 369 of file atlcomcli.h.

370 {
371 if (!m_str)
372 return NULL;
373 return ::SysAllocStringLen(m_str, ::SysStringLen(m_str));
374 }
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:196

Referenced by CopyTo().

◆ CopyTo()

HRESULT ATL::CComBSTR::CopyTo ( BSTR other) const
inline

Definition at line 376 of file atlcomcli.h.

377 {
378 if (!other)
379 return E_POINTER;
380 *other = Copy();
381 return S_OK;
382 }
BSTR Copy() const
Definition: atlcomcli.h:369
#define S_OK
Definition: intsafe.h:52
#define E_POINTER
Definition: winerror.h:2365

◆ Detach()

BSTR ATL::CComBSTR::Detach ( )
inline

Definition at line 362 of file atlcomcli.h.

363 {
364 BSTR str = m_str;
365 m_str = NULL;
366 return str;
367 }
OLECHAR * BSTR
Definition: compat.h:2293
const WCHAR * str

◆ Length()

unsigned int ATL::CComBSTR::Length ( ) const
inline

Definition at line 395 of file atlcomcli.h.

396 {
397 return ::SysStringLen(m_str);
398 }

◆ LoadString()

bool ATL::CComBSTR::LoadString ( HMODULE  module,
DWORD  uID 
)
inline

Definition at line 384 of file atlcomcli.h.

385 {
387 m_str = NULL;
388 const wchar_t *ptr = NULL;
389 int len = ::LoadStringW(module, uID, (PWSTR)&ptr, 0);
390 if (len)
392 return m_str != NULL;
393 }
static PVOID ptr
Definition: dispmode.c:27
uint16_t * PWSTR
Definition: typedefs.h:56
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)

◆ operator BSTR()

ATL::CComBSTR::operator BSTR ( ) const
inline

Definition at line 339 of file atlcomcli.h.

340 {
341 return m_str;
342 }

◆ operator&()

BSTR * ATL::CComBSTR::operator& ( )
inline

Definition at line 344 of file atlcomcli.h.

345 {
346 return &m_str;
347 }

◆ operator=()

CComBSTR & ATL::CComBSTR::operator= ( const CComBSTR other)
inline

Definition at line 349 of file atlcomcli.h.

350 {
352 m_str = other.Copy();
353 return *this;
354 }

Member Data Documentation

◆ m_str


The documentation for this class was generated from the following file: