ReactOS 0.4.15-dev-6656-gbbb33a6
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 ()
 
PXSTR GetString () 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 137 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 142 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 145 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 141 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 144 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 140 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 143 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 151 of file atlsimpstr.h.

152 {
153 CStringData* pData = pStringMgr->GetNilString();
154 Attach(pData);
155 }
void Attach(_Inout_ CStringData *pData)
Definition: atlsimpstr.h:498
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 157 of file atlsimpstr.h.

158 {
159 CStringData* pSrcData = strSrc.GetData();
160 CStringData* pNewData = CloneData(pSrcData);
161 Attach(pNewData);
162 }
static CStringData *__cdecl CloneData(_Inout_ CStringData *pData)
Definition: atlsimpstr.h:595

◆ 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 164 of file atlsimpstr.h.

167 {
168 int nLength = StringLength(pszSrc);
169 CStringData* pData = pStringMgr->Allocate(nLength, sizeof(XCHAR));
170 if (pData == NULL)
172
173 Attach(pData);
176 }
static int __cdecl StringLength(_In_opt_z_ const char *psz)
Definition: atlsimpstr.h:451
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:433
void SetLength(_In_ int nLength)
Definition: atlsimpstr.h:581
static void ThrowMemoryException()
Definition: atlsimpstr.h:622
ChTraitsBase< BaseType >::XCHAR XCHAR
Definition: atlsimpstr.h:140
#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 178 of file atlsimpstr.h.

182 {
183 if (pchSrc == NULL && nLength != 0)
185
186 CStringData* pData = pStringMgr->Allocate(nLength, sizeof(XCHAR));
187 if (pData == NULL)
188 {
190 }
191 Attach(pData);
194 }
static void ThrowInvalidArgException()
Definition: atlsimpstr.h:627

◆ ~CSimpleStringT()

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

Definition at line 196 of file atlsimpstr.h.

197 {
198 CStringData* pData = GetData();
199 pData->Release();
200 }
CStringData * GetData() const
Definition: atlsimpstr.h:394

Member Function Documentation

◆ __declspec()

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

Definition at line 503 of file atlsimpstr.h.

504 {
505 CStringData* pOldData = GetData();
506 int nOldLength = pOldData->nDataLength;
507 CStringData* pNewData = pOldData->pStringMgr->Clone()->Allocate(nLength, sizeof(XCHAR));
508 if (pNewData == NULL)
509 {
511 }
512 int nCharsToCopy = ((nOldLength < nLength) ? nOldLength : nLength) + 1;
513 CopyChars(PXSTR(pNewData->data()), nCharsToCopy,
514 PCXSTR(pOldData->data()), nCharsToCopy);
515 pNewData->nDataLength = nOldLength;
516 pOldData->Release();
517 Attach(pNewData);
518 }
ChTraitsBase< BaseType >::PCXSTR PCXSTR
Definition: atlsimpstr.h:142
ChTraitsBase< BaseType >::PXSTR PXSTR
Definition: atlsimpstr.h:141

◆ _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 352 of file atlsimpstr.h.

353 {
354 return PrepareWrite(nMinBufferLength);
355 }
PXSTR PrepareWrite(_In_ int nLength)
Definition: atlsimpstr.h:520

◆ 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 304 of file atlsimpstr.h.

305 {
306 Append(strSrc.GetString(), strSrc.GetLength());
307 }
void Append(_In_count_(nLength) PCXSTR pszSrc, _In_ int nLength)
Definition: atlsimpstr.h:271

◆ 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 271 of file atlsimpstr.h.

274 {
275 UINT_PTR nOffset = pszSrc - GetString();
276
277 int nOldLength = GetLength();
278 if (nOldLength < 0)
279 nOldLength = 0;
280
281 ATLASSERT(nLength >= 0);
282
283#if 0 // FIXME: See comment for StringLengthN below.
284 nLength = StringLengthN(pszSrc, nLength);
285 if (!(INT_MAX - nLength >= nOldLength))
286 throw;
287#endif
288
289 int nNewLength = nOldLength + nLength;
290 PXSTR pszBuffer = GetBuffer(nNewLength);
291 if (nOffset <= (UINT_PTR)nOldLength)
292 {
293 pszSrc = pszBuffer + nOffset;
294 }
295 CopyChars(pszBuffer + nOldLength, nLength, pszSrc, nLength);
296 ReleaseBufferSetLength(nNewLength);
297 }
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
int GetLength() const
Definition: atlsimpstr.h:362
void ReleaseBufferSetLength(_In_ int nNewLength)
Definition: atlsimpstr.h:376
#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 299 of file atlsimpstr.h.

300 {
301 Append(pszSrc, StringLength(pszSrc));
302 }

◆ 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 595 of file atlsimpstr.h.

596 {
597 CStringData* pNewData = NULL;
598
599 IAtlStringMgr* pNewStringMgr = pData->pStringMgr->Clone();
600 if (!pData->IsLocked() && (pNewStringMgr == pData->pStringMgr))
601 {
602 pNewData = pData;
603 pNewData->AddRef();
604 }
605 else
606 {
607 pNewData = pNewStringMgr->Allocate(pData->nDataLength, sizeof(XCHAR));
608 if (pNewData == NULL)
609 {
611 }
612
613 pNewData->nDataLength = pData->nDataLength;
614 CopyChars(PXSTR(pNewData->data()), pData->nDataLength + 1,
615 PCXSTR(pData->data()), pData->nDataLength + 1);
616 }
617
618 return pNewData;
619 }
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 483 of file atlsimpstr.h.

489 {
490 int nNewLength = nLength1 + nLength2;
491 PXSTR pszBuffer = strResult.GetBuffer(nNewLength);
492 CopyChars(pszBuffer, nLength1, psz1, nLength1);
493 CopyChars(pszBuffer + nLength1, nLength2, psz2, nLength2);
494 strResult.ReleaseBufferSetLength(nNewLength);
495 }

◆ 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 442 of file atlsimpstr.h.

447 {
448 memmove(pchDest, pchSrc, nChars * sizeof(XCHAR));
449 }
#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 253 of file atlsimpstr.h.

254 {
255 CStringData* pOldData = GetData();
256 IAtlStringMgr* pStringMgr = pOldData->pStringMgr;
257 if (pOldData->nDataLength == 0) return;
258
259 if (pOldData->IsLocked())
260 {
261 SetLength(0);
262 }
263 else
264 {
265 pOldData->Release();
266 CStringData* pNewData = pStringMgr->GetNilString();
267 Attach(pNewData);
268 }
269 }

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

◆ GetAllocLength()

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

Definition at line 357 of file atlsimpstr.h.

358 {
359 return GetData()->nAllocLength;
360 }

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

◆ GetBuffer()

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

◆ GetData()

◆ GetLength()

◆ GetManager()

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

Definition at line 399 of file atlsimpstr.h.

400 {
401 IAtlStringMgr* pStringMgr = GetData()->pStringMgr;
402 return (pStringMgr ? pStringMgr->Clone() : NULL);
403 }
IAtlStringMgr * pStringMgr
Definition: atlsimpstr.h:50

◆ GetString() [1/2]

◆ GetString() [2/2]

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

Definition at line 371 of file atlsimpstr.h.

372 {
373 return m_pszData;
374 }

◆ IsEmpty()

◆ operator PCXSTR()

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

Definition at line 248 of file atlsimpstr.h.

249 {
250 return m_pszData;
251 }

◆ 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 230 of file atlsimpstr.h.

231 {
232 Append(strSrc);
233 return *this;
234 }

◆ 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 236 of file atlsimpstr.h.

237 {
238 Append(pszSrc);
239 return *this;
240 }

◆ operator+=() [3/3]

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

Definition at line 242 of file atlsimpstr.h.

243 {
244 Append(&ch, 1);
245 return *this;
246 }

◆ 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 208 of file atlsimpstr.h.

209 {
210 CStringData* pData = GetData();
211 CStringData* pNewData = strSrc.GetData();
212
213 if (pNewData != pData)
214 {
215 if (!pData->IsLocked() && (pNewData->pStringMgr == pData->pStringMgr))
216 {
217 pNewData = CloneData(pNewData);
218 pData->Release();
219 Attach(pNewData);
220 }
221 else
222 {
223 SetString(strSrc.GetString(), strSrc.GetLength());
224 }
225 }
226
227 return *this;
228 }
void SetString(_In_opt_z_ PCXSTR pszSrc)
Definition: atlsimpstr.h:309

◆ 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 202 of file atlsimpstr.h.

203 {
204 SetString(pszSrc);
205 return *this;
206 }

◆ PrepareWrite()

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

Definition at line 520 of file atlsimpstr.h.

521 {
522 CStringData* pOldData = GetData();
523 int nShared = 1 - pOldData->nRefs;
524 int nTooShort = pOldData->nAllocLength - nLength;
525 if ((nShared | nTooShort) < 0)
526 {
528 }
529
530 return m_pszData;
531 }
void PrepareWrite2(_In_ int nLength)
Definition: atlsimpstr.h:532

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 532 of file atlsimpstr.h.

533 {
534 CStringData* pOldData = GetData();
535 if (pOldData->nDataLength > nLength)
536 {
537 nLength = pOldData->nDataLength;
538 }
539 if (pOldData->IsShared())
540 {
541 Fork(nLength);
542 //ATLASSERT(FALSE);
543 }
544 else if (pOldData->nAllocLength < nLength)
545 {
546 int nNewLength = pOldData->nAllocLength;
547 if (nNewLength > 1024 * 1024 * 1024)
548 {
549 nNewLength += 1024 * 1024;
550 }
551 else
552 {
553 nNewLength = nNewLength + nNewLength / 2;
554 }
555 if (nNewLength < nLength)
556 {
557 nNewLength = nLength;
558 }
559 Reallocate(nNewLength);
560 }
561 }
void Reallocate(_In_ int nLength)
Definition: atlsimpstr.h:563

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 563 of file atlsimpstr.h.

564 {
565 CStringData* pOldData = GetData();
566 ATLASSERT(pOldData->nAllocLength < nLength);
567 IAtlStringMgr* pStringMgr = pOldData->pStringMgr;
568 if (pOldData->nAllocLength >= nLength || nLength <= 0)
569 {
570 return;
571 }
572 CStringData* pNewData = pStringMgr->Reallocate(pOldData, nLength, sizeof(XCHAR));
573 if (pNewData == NULL)
574 {
576 }
577
578 Attach(pNewData);
579 }

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 581 of file atlsimpstr.h.

582 {
583 ATLASSERT(nLength >= 0);
584 ATLASSERT(nLength <= GetData()->nAllocLength);
585
586 if (nLength < 0 || nLength > GetData()->nAllocLength)
587 {
589 }
590
592 m_pszData[nLength] = 0;
593 }
#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 314 of file atlsimpstr.h.

316 {
317 if (nLength == 0)
318 {
319 Empty();
320 }
321 else
322 {
323 UINT nOldLength = GetLength();
324 UINT_PTR nOffset = pszSrc - GetString();
325
326 PXSTR pszBuffer = GetBuffer(nLength);
327 if (nOffset <= nOldLength)
328 {
330 pszBuffer + nOffset, nLength);
331 }
332 else
333 {
334 CopyChars(pszBuffer, GetAllocLength(), pszSrc, nLength);
335 }
337 }
338 }
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:442
int GetAllocLength() const
Definition: atlsimpstr.h:357
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 457 of file atlsimpstr.h.

458 {
459 if (psz == NULL) return 0;
460 return (int)wcslen(psz);
461 }
_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 627 of file atlsimpstr.h.

628 {
630 }

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 406 of file atlsimpstr.h.

409 {
410 CSimpleStringT s(str1.GetManager());
411 Concatenate(s, str1, str1.GetLength(), str2, str2.GetLength());
412 return s;
413 }
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:483
CSimpleStringT(_Inout_ IAtlStringMgr *pStringMgr)
Definition: atlsimpstr.h:151
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 415 of file atlsimpstr.h.

418 {
419 CSimpleStringT s(str1.GetManager());
420 Concatenate(s, str1, str1.GetLength(), psz2, StringLength(psz2));
421 return s;
422 }

◆ 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 424 of file atlsimpstr.h.

427 {
428 CSimpleStringT s(str2.GetManager());
429 Concatenate(s, psz1, StringLength(psz1), str2, str2.GetLength());
430 return s;
431 }

Member Data Documentation

◆ m_pszData


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