ReactOS 0.4.15-dev-5875-g7c755d9
ATL::CSimpleStringT< BaseType, t_bMFCDLL > Class Template Reference

#include <atlsimpstr.h>

Collaboration diagram for ATL::CSimpleStringT< BaseType, t_bMFCDLL >:

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)
 
static void ThrowMemoryException ()
 
static void ThrowInvalidArgException ()
 

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)
 

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:1830

◆ 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 }
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);
170 }
static int __cdecl StringLength(_In_opt_z_ const char *psz)
Definition: atlsimpstr.h:441
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
void SetLength(_In_ int nLength)
Definition: atlsimpstr.h:571
static void ThrowMemoryException()
Definition: atlsimpstr.h:612
ChTraitsBase< BaseType >::XCHAR XCHAR
Definition: atlsimpstr.h:134
#define NULL
Definition: types.h:112
_In_ DWORD nLength
Definition: wincon.h:473

◆ 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);
188 }
static void ThrowInvalidArgException()
Definition: atlsimpstr.h:617

◆ ~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

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 }
ChTraitsBase< BaseType >::PCXSTR PCXSTR
Definition: atlsimpstr.h:136
ChTraitsBase< BaseType >::PXSTR PXSTR
Definition: atlsimpstr.h:135

◆ _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_ 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

◆ Append() [2/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 }
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
int GetLength() const
Definition: atlsimpstr.h:356
void ReleaseBufferSetLength(_In_ int nNewLength)
Definition: atlsimpstr.h:366
PCXSTR GetString() const
Definition: atlsimpstr.h:361
#define INT_MAX
Definition: limits.h:40
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274

Referenced by ATL::CSimpleStringT< BaseType, t_bMFCDLL >::Append(), ATL::CSimpleStringT< BaseType, t_bMFCDLL >::operator+=(), and CZipExtract::ShowExtractError().

◆ Append() [3/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 }

◆ Attach()

◆ 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 }
nsrefcnt AddRef()

Referenced by ATL::CSimpleStringT< BaseType, t_bMFCDLL >::CSimpleStringT(), and ATL::CSimpleStringT< BaseType, t_bMFCDLL >::operator=().

◆ 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 }

◆ 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

◆ 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

Referenced by ATL::CSimpleStringT< BaseType, t_bMFCDLL >::SetString().

◆ 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.

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 }

Referenced by DoTestCaseB(), CInstalledApplicationInfo::GetApplicationRegString(), GetStorageDirectory(), CConfigParser::GetString(), CAutoComplete::LoadQuickComplete(), CDownloaderProgress::OnSetText(), CAppScrnshotPreview::PreviousDisplayCleanup(), and ATL::CSimpleStringT< BaseType, t_bMFCDLL >::SetString().

◆ 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.

352 {
353 return GetData()->nAllocLength;
354 }

Referenced by CCharMapWindow::ChangeMapFont(), and ATL::CSimpleStringT< BaseType, t_bMFCDLL >::SetString().

◆ GetBuffer()

◆ GetData()

◆ GetLength()

◆ 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 }
IAtlStringMgr * pStringMgr
Definition: atlsimpstr.h:44

◆ GetString()

◆ 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 }

◆ 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 }

◆ 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 }

◆ operator=() [1/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 }
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_opt_z_ PCXSTR  pszSrc)
inline

Definition at line 196 of file atlsimpstr.h.

197 {
198 SetString(pszSrc);
199 return *this;
200 }

◆ 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 }
void PrepareWrite2(_In_ int nLength)
Definition: atlsimpstr.h:522

Referenced by ATL::CSimpleStringT< BaseType, t_bMFCDLL >::_Post_writable_size_().

◆ 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 }
void Reallocate(_In_ int nLength)
Definition: atlsimpstr.h:553

Referenced by ATL::CSimpleStringT< BaseType, t_bMFCDLL >::PrepareWrite().

◆ 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 }

Referenced by ATL::CSimpleStringT< BaseType, t_bMFCDLL >::PrepareWrite2().

◆ ReleaseBuffer()

◆ ReleaseBufferSetLength()

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

◆ 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 }
#define AtlThrow(x)
Definition: atldef.h:20
#define E_INVALIDARG
Definition: ddrawi.h:101

Referenced by ATL::CSimpleStringT< BaseType, t_bMFCDLL >::CSimpleStringT(), ATL::CSimpleStringT< BaseType, t_bMFCDLL >::Empty(), and ATL::CSimpleStringT< BaseType, t_bMFCDLL >::ReleaseBufferSetLength().

◆ SetString() [1/2]

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

◆ 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 {
324 pszBuffer + nOffset, nLength);
325 }
326 else
327 {
328 CopyChars(pszBuffer, GetAllocLength(), pszSrc, nLength);
329 }
331 }
332 }
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
int GetAllocLength() const
Definition: atlsimpstr.h:351
unsigned int UINT
Definition: ndis.h:50

◆ 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

◆ 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 }
_CRTIMP 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 ( )
inlinestaticprotected

Definition at line 617 of file atlsimpstr.h.

618 {
620 }

Referenced by ATL::CSimpleStringT< BaseType, t_bMFCDLL >::CSimpleStringT().

◆ ThrowMemoryException()

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

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 }
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
CSimpleStringT(_Inout_ IAtlStringMgr *pStringMgr)
Definition: atlsimpstr.h:145
GLdouble s
Definition: gl.h:2039

◆ 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 }

◆ 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 }

Member Data Documentation

◆ m_pszData


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