ReactOS  0.4.12-dev-36-g472787f
ATL::CSimpleStringT< BaseType, t_bMFCDLL > Class Template Reference

#include <atlsimpstr.h>

Public Types

typedef ChTraitsBase< BaseType >::XCHAR XCHAR
 
typedef ChTraitsBase< BaseType >::PXSTR PXSTR
 
typedef ChTraitsBase< BaseType >::PCXSTR PCXSTR
 
typedef ChTraitsBase< BaseType >::YCHAR YCHAR
 
typedef ChTraitsBase< BaseType >::PYSTR PYSTR
 
typedef ChTraitsBase< BaseType >::PCYSTR PCYSTR
 

Public Member Functions

 CSimpleStringT (_Inout_ IAtlStringMgr *pStringMgr)
 
 CSimpleStringT (_In_ const CSimpleStringT &strSrc)
 
 CSimpleStringT (_In_z_ PCXSTR pszSrc, _Inout_ IAtlStringMgr *pStringMgr)
 
 CSimpleStringT (_In_count_(nLength) const XCHAR *pchSrc, _In_ int nLength, _Inout_ IAtlStringMgr *pStringMgr)
 
 ~CSimpleStringT () throw ()
 
CSimpleStringToperator= (_In_opt_z_ PCXSTR pszSrc)
 
CSimpleStringToperator= (_In_ const CSimpleStringT &strSrc)
 
CSimpleStringToperator+= (_In_ const CSimpleStringT &strSrc)
 
CSimpleStringToperator+= (_In_z_ PCXSTR pszSrc)
 
CSimpleStringToperator+= (XCHAR ch)
 
 operator PCXSTR () const throw ()
 
void Empty () throw ()
 
void Append (_In_count_(nLength) PCXSTR pszSrc, _In_ int nLength)
 
void Append (_In_z_ PCXSTR pszSrc)
 
void Append (_In_ const CSimpleStringT &strSrc)
 
void SetString (_In_opt_z_ PCXSTR pszSrc)
 
void SetString (_In_reads_opt_(nLength) PCXSTR pszSrc, _In_ int nLength)
 
PXSTR GetBuffer ()
 
_Ret_notnull_ _Post_writable_size_ (nMinBufferLength+1) PXSTR GetBuffer(_In_ int nMinBufferLength)
 
int GetAllocLength () const throw ()
 
int GetLength () const throw ()
 
PCXSTR GetString () const throw ()
 
void ReleaseBufferSetLength (_In_ int nNewLength)
 
void ReleaseBuffer (_In_ int nNewLength=-1)
 
bool IsEmpty () const throw ()
 
CStringDataGetData () const throw ()
 
IAtlStringMgrGetManager () const throw ()
 

Static Public Member Functions

static void __cdecl CopyChars (_Out_writes_to_(nDestLen, nChars) XCHAR *pchDest, _In_ size_t nDestLen, _In_reads_opt_(nChars) const XCHAR *pchSrc, _In_ int nChars) throw ()
 
static void __cdecl CopyCharsOverlapped (_Out_writes_to_(nDestLen, nDestLen) XCHAR *pchDest, _In_ size_t nDestLen, _In_reads_(nChars) const XCHAR *pchSrc, _In_ int nChars) throw ()
 
static int __cdecl StringLength (_In_opt_z_ const char *psz) throw ()
 
static int __cdecl StringLength (_In_opt_z_ const wchar_t *psz) throw ()
 

Static Protected Member Functions

static void __cdecl Concatenate (_Inout_ CSimpleStringT &strResult, _In_count_(nLength1) PCXSTR psz1, _In_ int nLength1, _In_count_(nLength2) PCXSTR psz2, _In_ int nLength2)
 

Private Member Functions

void Attach (_Inout_ CStringData *pData) throw ()
 
 __declspec (noinline) void Fork(_In_ int nLength)
 
PXSTR PrepareWrite (_In_ int nLength)
 
void PrepareWrite2 (_In_ int nLength)
 
void Reallocate (_In_ int nLength)
 
void SetLength (_In_ int nLength)
 

Static Private Member Functions

static CStringData *__cdecl CloneData (_Inout_ CStringData *pData)
 
static void ThrowMemoryException ()
 
static void ThrowInvalidArgException ()
 

Private Attributes

PXSTR m_pszData
 

Friends

CSimpleStringT operator+ (_In_ const CSimpleStringT &str1, _In_ const CSimpleStringT &str2)
 
CSimpleStringT operator+ (_In_ const CSimpleStringT &str1, _In_z_ PCXSTR psz2)
 
CSimpleStringT operator+ (_In_z_ PCXSTR psz1, _In_ const CSimpleStringT &str2)
 

Detailed Description

template<typename BaseType, bool t_bMFCDLL = false>
class ATL::CSimpleStringT< BaseType, t_bMFCDLL >

Definition at line 131 of file atlsimpstr.h.

Member Typedef Documentation

◆ PCXSTR

template<typename BaseType, bool t_bMFCDLL = false>
typedef ChTraitsBase<BaseType>::PCXSTR ATL::CSimpleStringT< BaseType, t_bMFCDLL >::PCXSTR

Definition at line 136 of file atlsimpstr.h.

◆ PCYSTR

template<typename BaseType, bool t_bMFCDLL = false>
typedef ChTraitsBase<BaseType>::PCYSTR ATL::CSimpleStringT< BaseType, t_bMFCDLL >::PCYSTR

Definition at line 139 of file atlsimpstr.h.

◆ PXSTR

template<typename BaseType, bool t_bMFCDLL = false>
typedef ChTraitsBase<BaseType>::PXSTR ATL::CSimpleStringT< BaseType, t_bMFCDLL >::PXSTR

Definition at line 135 of file atlsimpstr.h.

◆ PYSTR

template<typename BaseType, bool t_bMFCDLL = false>
typedef ChTraitsBase<BaseType>::PYSTR ATL::CSimpleStringT< BaseType, t_bMFCDLL >::PYSTR

Definition at line 138 of file atlsimpstr.h.

◆ XCHAR

template<typename BaseType, bool t_bMFCDLL = false>
typedef ChTraitsBase<BaseType>::XCHAR ATL::CSimpleStringT< BaseType, t_bMFCDLL >::XCHAR

Definition at line 134 of file atlsimpstr.h.

◆ YCHAR

template<typename BaseType, bool t_bMFCDLL = false>
typedef ChTraitsBase<BaseType>::YCHAR ATL::CSimpleStringT< BaseType, t_bMFCDLL >::YCHAR

Definition at line 137 of file atlsimpstr.h.

Constructor & Destructor Documentation

◆ CSimpleStringT() [1/4]

template<typename BaseType, bool t_bMFCDLL = false>
ATL::CSimpleStringT< BaseType, t_bMFCDLL >::CSimpleStringT ( _Inout_ IAtlStringMgr pStringMgr)
inlineexplicit

Definition at line 145 of file atlsimpstr.h.

146  {
147  CStringData* pData = pStringMgr->GetNilString();
148  Attach(pData);
149  }
void Attach(_Inout_ CStringData *pData)
Definition: atlsimpstr.h:488
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827

◆ CSimpleStringT() [2/4]

template<typename BaseType, bool t_bMFCDLL = false>
ATL::CSimpleStringT< BaseType, t_bMFCDLL >::CSimpleStringT ( _In_ const CSimpleStringT< BaseType, t_bMFCDLL > &  strSrc)
inline

Definition at line 151 of file atlsimpstr.h.

152  {
153  CStringData* pSrcData = strSrc.GetData();
154  CStringData* pNewData = CloneData(pSrcData);
155  Attach(pNewData);
156  }
void Attach(_Inout_ CStringData *pData)
Definition: atlsimpstr.h:488
static CStringData *__cdecl CloneData(_Inout_ CStringData *pData)
Definition: atlsimpstr.h:585

◆ CSimpleStringT() [3/4]

template<typename BaseType, bool t_bMFCDLL = false>
ATL::CSimpleStringT< BaseType, t_bMFCDLL >::CSimpleStringT ( _In_z_ PCXSTR  pszSrc,
_Inout_ IAtlStringMgr pStringMgr 
)
inline

Definition at line 158 of file atlsimpstr.h.

161  {
162  int nLength = StringLength(pszSrc);
163  CStringData* pData = pStringMgr->Allocate(nLength, sizeof(XCHAR));
164  if (pData == NULL)
166 
167  Attach(pData);
168  SetLength(nLength);
169  CopyChars(m_pszData, nLength, pszSrc, nLength);
170  }
void SetLength(_In_ int nLength)
Definition: atlsimpstr.h:571
_In_ DWORD nLength
Definition: wincon.h:461
void Attach(_Inout_ CStringData *pData)
Definition: atlsimpstr.h:488
static void ThrowMemoryException()
Definition: atlsimpstr.h:612
ChTraitsBase< BaseType >::XCHAR XCHAR
Definition: atlsimpstr.h:134
smooth NULL
Definition: ftsmooth.c:416
static void __cdecl CopyChars(_Out_writes_to_(nDestLen, nChars) XCHAR *pchDest, _In_ size_t nDestLen, _In_reads_opt_(nChars) const XCHAR *pchSrc, _In_ int nChars)
Definition: atlsimpstr.h:423
static int __cdecl StringLength(_In_opt_z_ const char *psz)
Definition: atlsimpstr.h:441
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827

◆ CSimpleStringT() [4/4]

template<typename BaseType, bool t_bMFCDLL = false>
ATL::CSimpleStringT< BaseType, t_bMFCDLL >::CSimpleStringT ( _In_count_(nLength) const XCHAR pchSrc,
_In_ int  nLength,
_Inout_ IAtlStringMgr pStringMgr 
)
inline

Definition at line 172 of file atlsimpstr.h.

176  {
177  if (pchSrc == NULL && nLength != 0)
179 
180  CStringData* pData = pStringMgr->Allocate(nLength, sizeof(XCHAR));
181  if (pData == NULL)
182  {
184  }
185  Attach(pData);
187  CopyChars(m_pszData, nLength, pchSrc, nLength);
188  }
void SetLength(_In_ int nLength)
Definition: atlsimpstr.h:571
_In_ DWORD nLength
Definition: wincon.h:461
void Attach(_Inout_ CStringData *pData)
Definition: atlsimpstr.h:488
static void ThrowMemoryException()
Definition: atlsimpstr.h:612
ChTraitsBase< BaseType >::XCHAR XCHAR
Definition: atlsimpstr.h:134
smooth NULL
Definition: ftsmooth.c:416
static void ThrowInvalidArgException()
Definition: atlsimpstr.h:617
static void __cdecl CopyChars(_Out_writes_to_(nDestLen, nChars) XCHAR *pchDest, _In_ size_t nDestLen, _In_reads_opt_(nChars) const XCHAR *pchSrc, _In_ int nChars)
Definition: atlsimpstr.h:423
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827

◆ ~CSimpleStringT()

template<typename BaseType, bool t_bMFCDLL = false>
ATL::CSimpleStringT< BaseType, t_bMFCDLL >::~CSimpleStringT ( )
throw (
)
inline

Definition at line 190 of file atlsimpstr.h.

191  {
192  CStringData* pData = GetData();
193  pData->Release();
194  }
CStringData * GetData() const
Definition: atlsimpstr.h:384
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827

Member Function Documentation

◆ __declspec()

template<typename BaseType, bool t_bMFCDLL = false>
ATL::CSimpleStringT< BaseType, t_bMFCDLL >::__declspec ( noinline  )
inlineprivate

Definition at line 493 of file atlsimpstr.h.

494  {
495  CStringData* pOldData = GetData();
496  int nOldLength = pOldData->nDataLength;
497  CStringData* pNewData = pOldData->pStringMgr->Clone()->Allocate(nLength, sizeof(XCHAR));
498  if (pNewData == NULL)
499  {
501  }
502  int nCharsToCopy = ((nOldLength < nLength) ? nOldLength : nLength) + 1;
503  CopyChars(PXSTR(pNewData->data()), nCharsToCopy,
504  PCXSTR(pOldData->data()), nCharsToCopy);
505  pNewData->nDataLength = nOldLength;
506  pOldData->Release();
507  Attach(pNewData);
508  }
CStringData * GetData() const
Definition: atlsimpstr.h:384
_In_ DWORD nLength
Definition: wincon.h:461
ChTraitsBase< BaseType >::PXSTR PXSTR
Definition: atlsimpstr.h:135
void Attach(_Inout_ CStringData *pData)
Definition: atlsimpstr.h:488
static void ThrowMemoryException()
Definition: atlsimpstr.h:612
ChTraitsBase< BaseType >::XCHAR XCHAR
Definition: atlsimpstr.h:134
smooth NULL
Definition: ftsmooth.c:416
ChTraitsBase< BaseType >::PCXSTR PCXSTR
Definition: atlsimpstr.h:136
static void __cdecl CopyChars(_Out_writes_to_(nDestLen, nChars) XCHAR *pchDest, _In_ size_t nDestLen, _In_reads_opt_(nChars) const XCHAR *pchSrc, _In_ int nChars)
Definition: atlsimpstr.h:423

◆ _Post_writable_size_()

template<typename BaseType, bool t_bMFCDLL = false>
_Ret_notnull_ ATL::CSimpleStringT< BaseType, t_bMFCDLL >::_Post_writable_size_ ( nMinBufferLength+  1)
inline

Definition at line 346 of file atlsimpstr.h.

347  {
348  return PrepareWrite(nMinBufferLength);
349  }
PXSTR PrepareWrite(_In_ int nLength)
Definition: atlsimpstr.h:510

◆ Append() [1/3]

template<typename BaseType, bool t_bMFCDLL = false>
void ATL::CSimpleStringT< BaseType, t_bMFCDLL >::Append ( _In_count_(nLength) PCXSTR  pszSrc,
_In_ int  nLength 
)
inline

Definition at line 265 of file atlsimpstr.h.

268  {
269  UINT_PTR nOffset = pszSrc - GetString();
270 
271  int nOldLength = GetLength();
272  if (nOldLength < 0)
273  nOldLength = 0;
274 
275  ATLASSERT(nLength >= 0);
276 
277 #if 0 // FIXME: See comment for StringLengthN below.
278  nLength = StringLengthN(pszSrc, nLength);
279  if (!(INT_MAX - nLength >= nOldLength))
280  throw;
281 #endif
282 
283  int nNewLength = nOldLength + nLength;
284  PXSTR pszBuffer = GetBuffer(nNewLength);
285  if (nOffset <= (UINT_PTR)nOldLength)
286  {
287  pszSrc = pszBuffer + nOffset;
288  }
289  CopyChars(pszBuffer + nOldLength, nLength, pszSrc, nLength);
290  ReleaseBufferSetLength(nNewLength);
291  }
int GetLength() const
Definition: atlsimpstr.h:356
#define INT_MAX
Definition: limits.h:40
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
_In_ DWORD nLength
Definition: wincon.h:461
ChTraitsBase< BaseType >::PXSTR PXSTR
Definition: atlsimpstr.h:135
void ReleaseBufferSetLength(_In_ int nNewLength)
Definition: atlsimpstr.h:366
PCXSTR GetString() const
Definition: atlsimpstr.h:361
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
static void __cdecl CopyChars(_Out_writes_to_(nDestLen, nChars) XCHAR *pchDest, _In_ size_t nDestLen, _In_reads_opt_(nChars) const XCHAR *pchSrc, _In_ int nChars)
Definition: atlsimpstr.h:423

◆ Append() [2/3]

template<typename BaseType, bool t_bMFCDLL = false>
void ATL::CSimpleStringT< BaseType, t_bMFCDLL >::Append ( _In_z_ PCXSTR  pszSrc)
inline

Definition at line 293 of file atlsimpstr.h.

294  {
295  Append(pszSrc, StringLength(pszSrc));
296  }
void Append(_In_count_(nLength) PCXSTR pszSrc, _In_ int nLength)
Definition: atlsimpstr.h:265
static int __cdecl StringLength(_In_opt_z_ const char *psz)
Definition: atlsimpstr.h:441

◆ Append() [3/3]

template<typename BaseType, bool t_bMFCDLL = false>
void ATL::CSimpleStringT< BaseType, t_bMFCDLL >::Append ( _In_ const CSimpleStringT< BaseType, t_bMFCDLL > &  strSrc)
inline

Definition at line 298 of file atlsimpstr.h.

299  {
300  Append(strSrc.GetString(), strSrc.GetLength());
301  }
void Append(_In_count_(nLength) PCXSTR pszSrc, _In_ int nLength)
Definition: atlsimpstr.h:265

◆ Attach()

template<typename BaseType, bool t_bMFCDLL = false>
void ATL::CSimpleStringT< BaseType, t_bMFCDLL >::Attach ( _Inout_ CStringData pData)
throw (
)
inlineprivate

Definition at line 488 of file atlsimpstr.h.

489  {
490  m_pszData = static_cast<PXSTR>(pData->data());
491  }
ChTraitsBase< BaseType >::PXSTR PXSTR
Definition: atlsimpstr.h:135
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827

◆ CloneData()

template<typename BaseType, bool t_bMFCDLL = false>
static CStringData* __cdecl ATL::CSimpleStringT< BaseType, t_bMFCDLL >::CloneData ( _Inout_ CStringData pData)
inlinestaticprivate

Definition at line 585 of file atlsimpstr.h.

586  {
587  CStringData* pNewData = NULL;
588 
589  IAtlStringMgr* pNewStringMgr = pData->pStringMgr->Clone();
590  if (!pData->IsLocked() && (pNewStringMgr == pData->pStringMgr))
591  {
592  pNewData = pData;
593  pNewData->AddRef();
594  }
595  else
596  {
597  pNewData = pNewStringMgr->Allocate(pData->nDataLength, sizeof(XCHAR));
598  if (pNewData == NULL)
599  {
601  }
602 
603  pNewData->nDataLength = pData->nDataLength;
604  CopyChars(PXSTR(pNewData->data()), pData->nDataLength + 1,
605  PCXSTR(pData->data()), pData->nDataLength + 1);
606  }
607 
608  return pNewData;
609  }
ChTraitsBase< BaseType >::PXSTR PXSTR
Definition: atlsimpstr.h:135
static void ThrowMemoryException()
Definition: atlsimpstr.h:612
ChTraitsBase< BaseType >::XCHAR XCHAR
Definition: atlsimpstr.h:134
smooth NULL
Definition: ftsmooth.c:416
ChTraitsBase< BaseType >::PCXSTR PCXSTR
Definition: atlsimpstr.h:136
static void __cdecl CopyChars(_Out_writes_to_(nDestLen, nChars) XCHAR *pchDest, _In_ size_t nDestLen, _In_reads_opt_(nChars) const XCHAR *pchSrc, _In_ int nChars)
Definition: atlsimpstr.h:423
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
nsrefcnt AddRef()

◆ Concatenate()

template<typename BaseType, bool t_bMFCDLL = false>
static void __cdecl ATL::CSimpleStringT< BaseType, t_bMFCDLL >::Concatenate ( _Inout_ CSimpleStringT< BaseType, t_bMFCDLL > &  strResult,
_In_count_(nLength1) PCXSTR  psz1,
_In_ int  nLength1,
_In_count_(nLength2) PCXSTR  psz2,
_In_ int  nLength2 
)
inlinestaticprotected

Definition at line 473 of file atlsimpstr.h.

479  {
480  int nNewLength = nLength1 + nLength2;
481  PXSTR pszBuffer = strResult.GetBuffer(nNewLength);
482  CopyChars(pszBuffer, nLength1, psz1, nLength1);
483  CopyChars(pszBuffer + nLength1, nLength2, psz2, nLength2);
484  strResult.ReleaseBufferSetLength(nNewLength);
485  }
ChTraitsBase< BaseType >::PXSTR PXSTR
Definition: atlsimpstr.h:135
static void __cdecl CopyChars(_Out_writes_to_(nDestLen, nChars) XCHAR *pchDest, _In_ size_t nDestLen, _In_reads_opt_(nChars) const XCHAR *pchSrc, _In_ int nChars)
Definition: atlsimpstr.h:423

◆ CopyChars()

template<typename BaseType, bool t_bMFCDLL = false>
static void __cdecl ATL::CSimpleStringT< BaseType, t_bMFCDLL >::CopyChars ( _Out_writes_to_(nDestLen, nChars) XCHAR pchDest,
_In_ size_t  nDestLen,
_In_reads_opt_(nChars) const XCHAR pchSrc,
_In_ int  nChars 
)
throw (
)
inlinestatic

Definition at line 423 of file atlsimpstr.h.

428  {
429  memcpy(pchDest, pchSrc, nChars * sizeof(XCHAR));
430  }
ChTraitsBase< BaseType >::XCHAR XCHAR
Definition: atlsimpstr.h:134
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878

◆ CopyCharsOverlapped()

template<typename BaseType, bool t_bMFCDLL = false>
static void __cdecl ATL::CSimpleStringT< BaseType, t_bMFCDLL >::CopyCharsOverlapped ( _Out_writes_to_(nDestLen, nDestLen) XCHAR pchDest,
_In_ size_t  nDestLen,
_In_reads_(nChars) const XCHAR pchSrc,
_In_ int  nChars 
)
throw (
)
inlinestatic

Definition at line 432 of file atlsimpstr.h.

437  {
438  memmove(pchDest, pchSrc, nChars * sizeof(XCHAR));
439  }
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
ChTraitsBase< BaseType >::XCHAR XCHAR
Definition: atlsimpstr.h:134

◆ Empty()

template<typename BaseType, bool t_bMFCDLL = false>
void ATL::CSimpleStringT< BaseType, t_bMFCDLL >::Empty ( )
throw (
)
inline

Definition at line 247 of file atlsimpstr.h.

Referenced by CDownloadManager::DownloadProgressProc(), CAvailableApplicationInfo::GetString(), CMainWindow::OnCommand(), and CAvailableApplicationInfo::RetrieveLanguages().

248  {
249  CStringData* pOldData = GetData();
250  IAtlStringMgr* pStringMgr = pOldData->pStringMgr;
251  if (pOldData->nDataLength == 0) return;
252 
253  if (pOldData->IsLocked())
254  {
255  SetLength(0);
256  }
257  else
258  {
259  pOldData->Release();
260  CStringData* pNewData = pStringMgr->GetNilString();
261  Attach(pNewData);
262  }
263  }
CStringData * GetData() const
Definition: atlsimpstr.h:384
void SetLength(_In_ int nLength)
Definition: atlsimpstr.h:571
void Attach(_Inout_ CStringData *pData)
Definition: atlsimpstr.h:488

◆ GetAllocLength()

template<typename BaseType, bool t_bMFCDLL = false>
int ATL::CSimpleStringT< BaseType, t_bMFCDLL >::GetAllocLength ( ) const
throw (
)
inline

Definition at line 351 of file atlsimpstr.h.

Referenced by CCharMapWindow::ChangeMapFont().

352  {
353  return GetData()->nAllocLength;
354  }
CStringData * GetData() const
Definition: atlsimpstr.h:384

◆ GetBuffer()

◆ GetData()

template<typename BaseType, bool t_bMFCDLL = false>
CStringData* ATL::CSimpleStringT< BaseType, t_bMFCDLL >::GetData ( ) const
throw (
)
inline

Definition at line 384 of file atlsimpstr.h.

385  {
386  return (reinterpret_cast<CStringData*>(m_pszData) - 1);
387  }

◆ GetLength()

template<typename BaseType, bool t_bMFCDLL = false>
int ATL::CSimpleStringT< BaseType, t_bMFCDLL >::GetLength ( ) const
throw (
)
inline

◆ GetManager()

template<typename BaseType, bool t_bMFCDLL = false>
IAtlStringMgr* ATL::CSimpleStringT< BaseType, t_bMFCDLL >::GetManager ( ) const
throw (
)
inline

Definition at line 389 of file atlsimpstr.h.

390  {
391  IAtlStringMgr* pStringMgr = GetData()->pStringMgr;
392  return (pStringMgr ? pStringMgr->Clone() : NULL);
393  }
CStringData * GetData() const
Definition: atlsimpstr.h:384
smooth NULL
Definition: ftsmooth.c:416
IAtlStringMgr * pStringMgr
Definition: atlsimpstr.h:44

◆ GetString()

template<typename BaseType, bool t_bMFCDLL = false>
PCXSTR ATL::CSimpleStringT< BaseType, t_bMFCDLL >::GetString ( ) const
throw (
)
inline

◆ IsEmpty()

◆ operator PCXSTR()

template<typename BaseType, bool t_bMFCDLL = false>
ATL::CSimpleStringT< BaseType, t_bMFCDLL >::operator PCXSTR ( ) const
throw (
)
inline

Definition at line 242 of file atlsimpstr.h.

243  {
244  return m_pszData;
245  }

◆ operator+=() [1/3]

template<typename BaseType, bool t_bMFCDLL = false>
CSimpleStringT& ATL::CSimpleStringT< BaseType, t_bMFCDLL >::operator+= ( _In_ const CSimpleStringT< BaseType, t_bMFCDLL > &  strSrc)
inline

Definition at line 224 of file atlsimpstr.h.

225  {
226  Append(strSrc);
227  return *this;
228  }
void Append(_In_count_(nLength) PCXSTR pszSrc, _In_ int nLength)
Definition: atlsimpstr.h:265

◆ operator+=() [2/3]

template<typename BaseType, bool t_bMFCDLL = false>
CSimpleStringT& ATL::CSimpleStringT< BaseType, t_bMFCDLL >::operator+= ( _In_z_ PCXSTR  pszSrc)
inline

Definition at line 230 of file atlsimpstr.h.

231  {
232  Append(pszSrc);
233  return *this;
234  }
void Append(_In_count_(nLength) PCXSTR pszSrc, _In_ int nLength)
Definition: atlsimpstr.h:265

◆ operator+=() [3/3]

template<typename BaseType, bool t_bMFCDLL = false>
CSimpleStringT& ATL::CSimpleStringT< BaseType, t_bMFCDLL >::operator+= ( XCHAR  ch)
inline

Definition at line 236 of file atlsimpstr.h.

237  {
238  Append(&ch, 1);
239  return *this;
240  }
void Append(_In_count_(nLength) PCXSTR pszSrc, _In_ int nLength)
Definition: atlsimpstr.h:265

◆ operator=() [1/2]

template<typename BaseType, bool t_bMFCDLL = false>
CSimpleStringT& ATL::CSimpleStringT< BaseType, t_bMFCDLL >::operator= ( _In_opt_z_ PCXSTR  pszSrc)
inline

Definition at line 196 of file atlsimpstr.h.

197  {
198  SetString(pszSrc);
199  return *this;
200  }
void SetString(_In_opt_z_ PCXSTR pszSrc)
Definition: atlsimpstr.h:303

◆ operator=() [2/2]

template<typename BaseType, bool t_bMFCDLL = false>
CSimpleStringT& ATL::CSimpleStringT< BaseType, t_bMFCDLL >::operator= ( _In_ const CSimpleStringT< BaseType, t_bMFCDLL > &  strSrc)
inline

Definition at line 202 of file atlsimpstr.h.

203  {
204  CStringData* pData = GetData();
205  CStringData* pNewData = strSrc.GetData();
206 
207  if (pNewData != pData)
208  {
209  if (!pData->IsLocked() && (pNewData->pStringMgr == pData->pStringMgr))
210  {
211  pNewData = CloneData(pNewData);
212  pData->Release();
213  Attach(pNewData);
214  }
215  else
216  {
217  SetString(strSrc.GetString(), strSrc.GetLength());
218  }
219  }
220 
221  return *this;
222  }
CStringData * GetData() const
Definition: atlsimpstr.h:384
void Attach(_Inout_ CStringData *pData)
Definition: atlsimpstr.h:488
void SetString(_In_opt_z_ PCXSTR pszSrc)
Definition: atlsimpstr.h:303
static CStringData *__cdecl CloneData(_Inout_ CStringData *pData)
Definition: atlsimpstr.h:585
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827

◆ PrepareWrite()

template<typename BaseType, bool t_bMFCDLL = false>
PXSTR ATL::CSimpleStringT< BaseType, t_bMFCDLL >::PrepareWrite ( _In_ int  nLength)
inlineprivate

Definition at line 510 of file atlsimpstr.h.

511  {
512  CStringData* pOldData = GetData();
513  int nShared = 1 - pOldData->nRefs;
514  int nTooShort = pOldData->nAllocLength - nLength;
515  if ((nShared | nTooShort) < 0)
516  {
518  }
519 
520  return m_pszData;
521  }
CStringData * GetData() const
Definition: atlsimpstr.h:384
_In_ DWORD nLength
Definition: wincon.h:461
void PrepareWrite2(_In_ int nLength)
Definition: atlsimpstr.h:522

◆ PrepareWrite2()

template<typename BaseType, bool t_bMFCDLL = false>
void ATL::CSimpleStringT< BaseType, t_bMFCDLL >::PrepareWrite2 ( _In_ int  nLength)
inlineprivate

Definition at line 522 of file atlsimpstr.h.

523  {
524  CStringData* pOldData = GetData();
525  if (pOldData->nDataLength > nLength)
526  {
527  nLength = pOldData->nDataLength;
528  }
529  if (pOldData->IsShared())
530  {
531  Fork(nLength);
532  //ATLASSERT(FALSE);
533  }
534  else if (pOldData->nAllocLength < nLength)
535  {
536  int nNewLength = pOldData->nAllocLength;
537  if (nNewLength > 1024 * 1024 * 1024)
538  {
539  nNewLength += 1024 * 1024;
540  }
541  else
542  {
543  nNewLength = nNewLength + nNewLength / 2;
544  }
545  if (nNewLength < nLength)
546  {
547  nNewLength = nLength;
548  }
549  Reallocate(nNewLength);
550  }
551  }
CStringData * GetData() const
Definition: atlsimpstr.h:384
_In_ DWORD nLength
Definition: wincon.h:461
void Reallocate(_In_ int nLength)
Definition: atlsimpstr.h:553

◆ Reallocate()

template<typename BaseType, bool t_bMFCDLL = false>
void ATL::CSimpleStringT< BaseType, t_bMFCDLL >::Reallocate ( _In_ int  nLength)
inlineprivate

Definition at line 553 of file atlsimpstr.h.

554  {
555  CStringData* pOldData = GetData();
556  ATLASSERT(pOldData->nAllocLength < nLength);
557  IAtlStringMgr* pStringMgr = pOldData->pStringMgr;
558  if (pOldData->nAllocLength >= nLength || nLength <= 0)
559  {
560  return;
561  }
562  CStringData* pNewData = pStringMgr->Reallocate(pOldData, nLength, sizeof(XCHAR));
563  if (pNewData == NULL)
564  {
566  }
567 
568  Attach(pNewData);
569  }
CStringData * GetData() const
Definition: atlsimpstr.h:384
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
_In_ DWORD nLength
Definition: wincon.h:461
void Attach(_Inout_ CStringData *pData)
Definition: atlsimpstr.h:488
static void ThrowMemoryException()
Definition: atlsimpstr.h:612
ChTraitsBase< BaseType >::XCHAR XCHAR
Definition: atlsimpstr.h:134
smooth NULL
Definition: ftsmooth.c:416

◆ ReleaseBuffer()

◆ ReleaseBufferSetLength()

template<typename BaseType, bool t_bMFCDLL = false>
void ATL::CSimpleStringT< BaseType, t_bMFCDLL >::ReleaseBufferSetLength ( _In_ int  nNewLength)
inline

Definition at line 366 of file atlsimpstr.h.

Referenced by CLayerUIPropPage::InitFile().

367  {
368  ATLASSERT(nNewLength >= 0);
369  SetLength(nNewLength);
370  }
void SetLength(_In_ int nLength)
Definition: atlsimpstr.h:571
#define ATLASSERT(x)
Definition: CComVariant.cpp:9

◆ SetLength()

template<typename BaseType, bool t_bMFCDLL = false>
void ATL::CSimpleStringT< BaseType, t_bMFCDLL >::SetLength ( _In_ int  nLength)
inlineprivate

Definition at line 571 of file atlsimpstr.h.

572  {
573  ATLASSERT(nLength >= 0);
574  ATLASSERT(nLength <= GetData()->nAllocLength);
575 
576  if (nLength < 0 || nLength > GetData()->nAllocLength)
577  {
579  }
580 
582  m_pszData[nLength] = 0;
583  }
CStringData * GetData() const
Definition: atlsimpstr.h:384
#define AtlThrow(x)
Definition: atlexcept.h:42
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
_In_ DWORD nLength
Definition: wincon.h:461
#define E_INVALIDARG
Definition: ddrawi.h:101

◆ SetString() [1/2]

template<typename BaseType, bool t_bMFCDLL = false>
void ATL::CSimpleStringT< BaseType, t_bMFCDLL >::SetString ( _In_opt_z_ PCXSTR  pszSrc)
inline

Definition at line 303 of file atlsimpstr.h.

304  {
305  SetString(pszSrc, StringLength(pszSrc));
306  }
void SetString(_In_opt_z_ PCXSTR pszSrc)
Definition: atlsimpstr.h:303
static int __cdecl StringLength(_In_opt_z_ const char *psz)
Definition: atlsimpstr.h:441

◆ SetString() [2/2]

template<typename BaseType, bool t_bMFCDLL = false>
void ATL::CSimpleStringT< BaseType, t_bMFCDLL >::SetString ( _In_reads_opt_(nLength) PCXSTR  pszSrc,
_In_ int  nLength 
)
inline

Definition at line 308 of file atlsimpstr.h.

310  {
311  if (nLength == 0)
312  {
313  Empty();
314  }
315  else
316  {
317  UINT nOldLength = GetLength();
318  UINT_PTR nOffset = pszSrc - GetString();
319 
320  PXSTR pszBuffer = GetBuffer(nLength);
321  if (nOffset <= nOldLength)
322  {
323  CopyCharsOverlapped(pszBuffer, GetAllocLength(),
324  pszBuffer + nOffset, nLength);
325  }
326  else
327  {
328  CopyChars(pszBuffer, GetAllocLength(), pszSrc, nLength);
329  }
331  }
332  }
int GetLength() const
Definition: atlsimpstr.h:356
_In_ DWORD nLength
Definition: wincon.h:461
ChTraitsBase< BaseType >::PXSTR PXSTR
Definition: atlsimpstr.h:135
int GetAllocLength() const
Definition: atlsimpstr.h:351
void ReleaseBufferSetLength(_In_ int nNewLength)
Definition: atlsimpstr.h:366
PCXSTR GetString() const
Definition: atlsimpstr.h:361
unsigned int UINT
Definition: ndis.h:50
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
static void __cdecl CopyChars(_Out_writes_to_(nDestLen, nChars) XCHAR *pchDest, _In_ size_t nDestLen, _In_reads_opt_(nChars) const XCHAR *pchSrc, _In_ int nChars)
Definition: atlsimpstr.h:423
static void __cdecl CopyCharsOverlapped(_Out_writes_to_(nDestLen, nDestLen) XCHAR *pchDest, _In_ size_t nDestLen, _In_reads_(nChars) const XCHAR *pchSrc, _In_ int nChars)
Definition: atlsimpstr.h:432

◆ StringLength() [1/2]

template<typename BaseType, bool t_bMFCDLL = false>
static int __cdecl ATL::CSimpleStringT< BaseType, t_bMFCDLL >::StringLength ( _In_opt_z_ const char psz)
throw (
)
inlinestatic

Definition at line 441 of file atlsimpstr.h.

442  {
443  if (psz == NULL) return 0;
444  return (int)strlen(psz);
445  }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
smooth NULL
Definition: ftsmooth.c:416

◆ StringLength() [2/2]

template<typename BaseType, bool t_bMFCDLL = false>
static int __cdecl ATL::CSimpleStringT< BaseType, t_bMFCDLL >::StringLength ( _In_opt_z_ const wchar_t psz)
throw (
)
inlinestatic

Definition at line 447 of file atlsimpstr.h.

448  {
449  if (psz == NULL) return 0;
450  return (int)wcslen(psz);
451  }
smooth NULL
Definition: ftsmooth.c:416
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

◆ ThrowInvalidArgException()

template<typename BaseType, bool t_bMFCDLL = false>
static void ATL::CSimpleStringT< BaseType, t_bMFCDLL >::ThrowInvalidArgException ( )
inlinestaticprivate

Definition at line 617 of file atlsimpstr.h.

618  {
620  }
#define AtlThrow(x)
Definition: atlexcept.h:42
#define E_INVALIDARG
Definition: ddrawi.h:101

◆ ThrowMemoryException()

template<typename BaseType, bool t_bMFCDLL = false>
static void ATL::CSimpleStringT< BaseType, t_bMFCDLL >::ThrowMemoryException ( )
inlinestaticprivate

Definition at line 612 of file atlsimpstr.h.

613  {
615  }
#define AtlThrow(x)
Definition: atlexcept.h:42
#define E_OUTOFMEMORY
Definition: ddrawi.h:100

Friends And Related Function Documentation

◆ operator+ [1/3]

template<typename BaseType, bool t_bMFCDLL = false>
CSimpleStringT operator+ ( _In_ const CSimpleStringT< BaseType, t_bMFCDLL > &  str1,
_In_ const CSimpleStringT< BaseType, t_bMFCDLL > &  str2 
)
friend

Definition at line 396 of file atlsimpstr.h.

399  {
400  CSimpleStringT s(str1.GetManager());
401  Concatenate(s, str1, str1.GetLength(), str2, str2.GetLength());
402  return s;
403  }
CSimpleStringT(_Inout_ IAtlStringMgr *pStringMgr)
Definition: atlsimpstr.h:145
GLdouble s
Definition: gl.h:2039
static void __cdecl Concatenate(_Inout_ CSimpleStringT &strResult, _In_count_(nLength1) PCXSTR psz1, _In_ int nLength1, _In_count_(nLength2) PCXSTR psz2, _In_ int nLength2)
Definition: atlsimpstr.h:473

◆ operator+ [2/3]

template<typename BaseType, bool t_bMFCDLL = false>
CSimpleStringT operator+ ( _In_ const CSimpleStringT< BaseType, t_bMFCDLL > &  str1,
_In_z_ PCXSTR  psz2 
)
friend

Definition at line 405 of file atlsimpstr.h.

408  {
409  CSimpleStringT s(str1.GetManager());
410  Concatenate(s, str1, str1.GetLength(), psz2, StringLength(psz2));
411  return s;
412  }
CSimpleStringT(_Inout_ IAtlStringMgr *pStringMgr)
Definition: atlsimpstr.h:145
GLdouble s
Definition: gl.h:2039
static void __cdecl Concatenate(_Inout_ CSimpleStringT &strResult, _In_count_(nLength1) PCXSTR psz1, _In_ int nLength1, _In_count_(nLength2) PCXSTR psz2, _In_ int nLength2)
Definition: atlsimpstr.h:473
static int __cdecl StringLength(_In_opt_z_ const char *psz)
Definition: atlsimpstr.h:441

◆ operator+ [3/3]

template<typename BaseType, bool t_bMFCDLL = false>
CSimpleStringT operator+ ( _In_z_ PCXSTR  psz1,
_In_ const CSimpleStringT< BaseType, t_bMFCDLL > &  str2 
)
friend

Definition at line 414 of file atlsimpstr.h.

417  {
418  CSimpleStringT s(str2.GetManager());
419  Concatenate(s, psz1, StringLength(psz1), str2, str2.GetLength());
420  return s;
421  }
CSimpleStringT(_Inout_ IAtlStringMgr *pStringMgr)
Definition: atlsimpstr.h:145
GLdouble s
Definition: gl.h:2039
static void __cdecl Concatenate(_Inout_ CSimpleStringT &strResult, _In_count_(nLength1) PCXSTR psz1, _In_ int nLength1, _In_count_(nLength2) PCXSTR psz2, _In_ int nLength2)
Definition: atlsimpstr.h:473
static int __cdecl StringLength(_In_opt_z_ const char *psz)
Definition: atlsimpstr.h:441

Member Data Documentation

◆ m_pszData

template<typename BaseType, bool t_bMFCDLL = false>
PXSTR ATL::CSimpleStringT< BaseType, t_bMFCDLL >::m_pszData
private

Definition at line 142 of file atlsimpstr.h.


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