ReactOS  0.4.13-dev-235-g7373cb3
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 257 of file atlcomcli.h.

Constructor & Destructor Documentation

◆ CComBSTR() [1/7]

ATL::CComBSTR::CComBSTR ( )
inline

Definition at line 262 of file atlcomcli.h.

262  :
263  m_str(NULL)
264  {
265  }
smooth NULL
Definition: ftsmooth.c:416

◆ CComBSTR() [2/7]

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

Definition at line 267 of file atlcomcli.h.

268  {
269  if (pSrc == NULL)
270  m_str = NULL;
271  else
272  m_str = ::SysAllocString(pSrc);
273  }
smooth NULL
Definition: ftsmooth.c:416
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:241

◆ CComBSTR() [3/7]

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

Definition at line 275 of file atlcomcli.h.

276  {
277  if (length == 0)
278  m_str = NULL;
279  else
281  }
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:342
smooth NULL
Definition: ftsmooth.c:416
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579

◆ CComBSTR() [4/7]

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

Definition at line 283 of file atlcomcli.h.

284  {
285  if (length == 0)
286  m_str = NULL;
287  else
289  }
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:342
smooth NULL
Definition: ftsmooth.c:416
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579

◆ CComBSTR() [5/7]

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

Definition at line 291 of file atlcomcli.h.

292  {
293  if (pSrc)
294  {
295  int len = MultiByteToWideChar(CP_THREAD_ACP, 0, pSrc, -1, NULL, 0);
297  if (m_str)
298  {
299  int res = MultiByteToWideChar(CP_THREAD_ACP, 0, pSrc, -1, m_str, len);
300  ATLASSERT(res == len);
301  if (res != len)
302  {
304  m_str = NULL;
305  }
306  }
307  }
308  else
309  {
310  m_str = NULL;
311  }
312  }
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:342
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
smooth NULL
Definition: ftsmooth.c:416
GLenum GLsizei len
Definition: glext.h:6722
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:274
#define MultiByteToWideChar
Definition: compat.h:100
GLuint res
Definition: glext.h:9613
#define CP_THREAD_ACP
Definition: winnls.h:230

◆ CComBSTR() [6/7]

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

Definition at line 314 of file atlcomcli.h.

315  {
316  m_str = other.Copy();
317  }
int other
Definition: msacm.c:1364

◆ CComBSTR() [7/7]

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

Definition at line 319 of file atlcomcli.h.

320  {
321  OLECHAR szGuid[40];
324  }
WCHAR OLECHAR
Definition: compat.h:1933
const GUID * guid
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:241
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2343
static const WCHAR szGuid[]
Definition: rtlstr.c:1892

◆ ~CComBSTR()

ATL::CComBSTR::~CComBSTR ( )
inline

Definition at line 326 of file atlcomcli.h.

327  {
329  m_str = NULL;
330  }
smooth NULL
Definition: ftsmooth.c:416
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:274

Member Function Documentation

◆ Attach()

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

Definition at line 349 of file atlcomcli.h.

350  {
352  m_str = bstr;
353  }
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:274

◆ ByteLength()

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

Definition at line 393 of file atlcomcli.h.

394  {
396  }
UINT WINAPI SysStringByteLen(BSTR str)
Definition: oleaut.c:218

◆ Copy()

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

Definition at line 362 of file atlcomcli.h.

363  {
364  if (!m_str)
365  return NULL;
367  }
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:342
smooth NULL
Definition: ftsmooth.c:416
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:199

Referenced by CopyTo().

◆ CopyTo()

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

Definition at line 369 of file atlcomcli.h.

370  {
371  if (!other)
372  return E_POINTER;
373  *other = Copy();
374  return S_OK;
375  }
int other
Definition: msacm.c:1364
BSTR Copy() const
Definition: atlcomcli.h:362
#define S_OK
Definition: intsafe.h:59
#define E_POINTER
Definition: winerror.h:2365

◆ Detach()

BSTR ATL::CComBSTR::Detach ( )
inline

Definition at line 355 of file atlcomcli.h.

356  {
357  BSTR str = m_str;
358  m_str = NULL;
359  return str;
360  }
OLECHAR * BSTR
Definition: compat.h:1934
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416

◆ Length()

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

Definition at line 388 of file atlcomcli.h.

389  {
391  }
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:199

◆ LoadString()

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

Definition at line 377 of file atlcomcli.h.

378  {
380  m_str = NULL;
381  const wchar_t *ptr = NULL;
382  int len = ::LoadStringW(module, uID, (PWSTR)&ptr, 0);
383  if (len)
385  return m_str != NULL;
386  }
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:342
uint16_t * PWSTR
Definition: typedefs.h:54
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
GLenum GLsizei len
Definition: glext.h:6722
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:274

◆ operator &()

Definition at line 337 of file atlcomcli.h.

338  {
339  return &m_str;
340  }

◆ operator BSTR()

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

Definition at line 332 of file atlcomcli.h.

333  {
334  return m_str;
335  }

◆ operator=()

Definition at line 342 of file atlcomcli.h.

343  {
345  m_str = other.Copy();
346  return *this;
347  }
int other
Definition: msacm.c:1364
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:274

Member Data Documentation

◆ m_str


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