ReactOS  0.4.12-dev-57-g7050ac4
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 251 of file atlcomcli.h.

Constructor & Destructor Documentation

◆ CComBSTR() [1/7]

ATL::CComBSTR::CComBSTR ( )
inline

Definition at line 256 of file atlcomcli.h.

256  :
257  m_str(NULL)
258  {
259  }
smooth NULL
Definition: ftsmooth.c:416

◆ CComBSTR() [2/7]

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

Definition at line 261 of file atlcomcli.h.

262  {
263  if (pSrc == NULL)
264  m_str = NULL;
265  else
266  m_str = ::SysAllocString(pSrc);
267  }
smooth NULL
Definition: ftsmooth.c:416
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:242

◆ CComBSTR() [3/7]

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

Definition at line 269 of file atlcomcli.h.

270  {
271  if (length == 0)
272  m_str = NULL;
273  else
275  }
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:343
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 277 of file atlcomcli.h.

278  {
279  if (length == 0)
280  m_str = NULL;
281  else
283  }
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:343
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 285 of file atlcomcli.h.

286  {
287  if (pSrc)
288  {
289  int len = MultiByteToWideChar(CP_THREAD_ACP, 0, pSrc, -1, NULL, 0);
290  m_str = ::SysAllocStringLen(NULL, len - 1);
291  if (m_str)
292  {
293  int res = MultiByteToWideChar(CP_THREAD_ACP, 0, pSrc, -1, m_str, len);
294  ATLASSERT(res == len);
295  if (res != len)
296  {
298  m_str = NULL;
299  }
300  }
301  }
302  else
303  {
304  m_str = NULL;
305  }
306  }
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:343
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
void WINAPI SysFreeString(BSTR str)
Definition: oleaut.c:275
smooth NULL
Definition: ftsmooth.c:416
GLenum GLsizei len
Definition: glext.h:6722
#define MultiByteToWideChar
Definition: compat.h:100
GLuint res
Definition: glext.h:9613
#define CP_THREAD_ACP
Definition: winnls.h:221

◆ CComBSTR() [6/7]

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

Definition at line 308 of file atlcomcli.h.

309  {
310  m_str = other.Copy();
311  }
BSTR Copy() const
Definition: atlcomcli.h:356

◆ CComBSTR() [7/7]

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

Definition at line 313 of file atlcomcli.h.

314  {
315  OLECHAR szGuid[40];
316  ::StringFromGUID2(guid, szGuid, 40);
317  m_str = ::SysAllocString(szGuid);
318  }
WCHAR OLECHAR
Definition: compat.h:1926
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:242
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2346
static const WCHAR szGuid[]
Definition: rtlstr.c:1892

◆ ~CComBSTR()

ATL::CComBSTR::~CComBSTR ( )
inline

Definition at line 320 of file atlcomcli.h.

321  {
323  m_str = NULL;
324  }
void WINAPI SysFreeString(BSTR str)
Definition: oleaut.c:275
smooth NULL
Definition: ftsmooth.c:416

Member Function Documentation

◆ Attach()

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

Definition at line 343 of file atlcomcli.h.

Referenced by CLayerUIPropPage::~CLayerUIPropPage().

344  {
346  m_str = bstr;
347  }
void WINAPI SysFreeString(BSTR str)
Definition: oleaut.c:275

◆ ByteLength()

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

Definition at line 387 of file atlcomcli.h.

388  {
390  }
UINT WINAPI SysStringByteLen(BSTR str)
Definition: oleaut.c:219

◆ Copy()

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

Definition at line 356 of file atlcomcli.h.

Referenced by CComBSTR(), and operator=().

357  {
358  if (!m_str)
359  return NULL;
361  }
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:343
smooth NULL
Definition: ftsmooth.c:416
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:200

◆ CopyTo()

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

Definition at line 363 of file atlcomcli.h.

364  {
365  if (!other)
366  return E_POINTER;
367  *other = Copy();
368  return S_OK;
369  }
int other
Definition: msacm.c:1364
BSTR Copy() const
Definition: atlcomcli.h:356
#define S_OK
Definition: intsafe.h:59
#define E_POINTER
Definition: winerror.h:2365

◆ Detach()

BSTR ATL::CComBSTR::Detach ( )
inline

Definition at line 349 of file atlcomcli.h.

Referenced by ATL::CComVariant::CComVariant(), and CLayerUIPropPage::CLayerUIPropPage().

350  {
351  BSTR str = m_str;
352  m_str = NULL;
353  return str;
354  }
OLECHAR * BSTR
Definition: compat.h:1927
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416

◆ Length()

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

Definition at line 382 of file atlcomcli.h.

Referenced by CAutoComplete::ACEditSubclassProc().

383  {
385  }
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:200

◆ LoadString()

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

Definition at line 371 of file atlcomcli.h.

Referenced by CLayerUIPropPage::CLayerUIPropPage(), CLayerUIPropPage::EditModesProc(), and CLayerUIPropPage::OnInitDialog().

372  {
374  m_str = NULL;
375  const wchar_t *ptr = NULL;
376  int len = ::LoadStringW(module, uID, (PWSTR)&ptr, 0);
377  if (len)
378  m_str = ::SysAllocStringLen(ptr, len);
379  return m_str != NULL;
380  }
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:343
uint16_t * PWSTR
Definition: typedefs.h:54
void WINAPI SysFreeString(BSTR str)
Definition: oleaut.c:275
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

◆ operator BSTR()

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

Definition at line 326 of file atlcomcli.h.

327  {
328  return m_str;
329  }

◆ operator&()

Definition at line 331 of file atlcomcli.h.

332  {
333  return &m_str;
334  }

◆ operator=()

Definition at line 336 of file atlcomcli.h.

337  {
339  m_str = other.Copy();
340  return *this;
341  }
void WINAPI SysFreeString(BSTR str)
Definition: oleaut.c:275
BSTR Copy() const
Definition: atlcomcli.h:356

Member Data Documentation

◆ m_str

BSTR ATL::CComBSTR::m_str

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