ReactOS 0.4.15-dev-8348-gc1b9bb5
atlstr.h
Go to the documentation of this file.
1#ifndef __ATLSTR_H__
2#define __ATLSTR_H__
3
4#pragma once
5#include "atlbase.h"
6#include "cstringt.h"
7
8namespace ATL
9{
10
12{
13protected:
16
17public:
19 m_MemMgr(MemMgr)
20 {
22 }
23
24 virtual ~CAtlStringMgr(void)
25 {
26 }
27
29 {
30 static CWin32Heap Win32Heap(::GetProcessHeap());
31 static CAtlStringMgr StringMgr(&Win32Heap);
32 return &StringMgr;
33 }
34
36 _In_ int NumChars,
38 {
39 size_t SizeBytes;
41
42 SizeBytes = sizeof(CStringData) + ((NumChars + 1) * CharSize);
43
44 StrData = static_cast<CStringData*>(m_MemMgr->Allocate(SizeBytes));
45 if (StrData == NULL) return NULL;
46
49 StrData->nAllocLength = NumChars;
51
52 return StrData;
53 }
54
56 {
59 }
60
64 _In_ int nCharSize) noexcept
65 {
67
71
75
76 pNewData = static_cast<CStringData*>(m_MemMgr->Reallocate(StrData, SizeBytes));
77 if (pNewData == NULL) return NULL;
78
80 return pNewData;
81 }
83 {
85 return &m_NilStrData;
86 }
88 {
89 return this;
90 }
91
92private:
93 static bool StaticInitialize()
94 {
96 return true;
97 }
98};
99
100
101template< typename _CharType = wchar_t >
103 public ChTraitsBase < _CharType >
104{
105
106};
107
108
109template<typename _BaseType = wchar_t, class StringIterator = ChTraitsOS<_BaseType> >
111 public StringIterator
112{
113public:
115 {
117 }
118
120 {
122 }
123};
124
125
128
129
132
133
134#ifdef UNICODE
135typedef CAtlStringW CAtlString;
136typedef CStringW CString;
137#else
140#endif
141
142
143}
144
145#endif
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
virtual void Free(_In_ CStringData *StrData)
Definition: atlstr.h:55
ULONG nDataBytes
Definition: atlstr.h:70
static bool StaticInitialize()
Definition: atlstr.h:93
virtual _Ret_maybenull_ _In_ int nChars
Definition: atlstr.h:63
virtual CStringData * GetNilString() noexcept
Definition: atlstr.h:82
static IAtlStringMgr * GetInstance(void)
Definition: atlstr.h:28
CNilStringData m_NilStrData
Definition: atlstr.h:15
ULONG SizeBytes
Definition: atlstr.h:69
CStringData * pNewData
Definition: atlstr.h:68
IAtlMemMgr * m_MemMgr
Definition: atlstr.h:14
virtual _Ret_maybenull_ _In_ int CharSize
Definition: atlstr.h:38
virtual _Ret_maybenull_ _In_ int _In_ int nCharSize noexcept
Definition: atlstr.h:65
return pNewData
Definition: atlstr.h:80
CAtlStringMgr(_In_opt_ IAtlMemMgr *MemMgr=NULL)
Definition: atlstr.h:18
virtual _Ret_maybenull_ _Post_writable_byte_size_(sizeof(CStringData)+nChars *nCharSize) CStringData *Reallocate(_Inout_ _Post_readable_byte_size_(sizeof(CStringData)) CStringData *StrData
virtual _Ret_maybenull_ _Post_writable_byte_size_(sizeof(CStringData)+NumChars *CharSize) CStringData *Allocate(_In_ int NumChars
virtual ~CAtlStringMgr(void)
Definition: atlstr.h:24
return StrData
Definition: atlstr.h:52
virtual IAtlStringMgr * Clone() noexcept
Definition: atlstr.h:87
CStringData * StrData
Definition: atlstr.h:40
void SetManager(_In_ IAtlStringMgr *pMgr) noexcept
Definition: atlsimpstr.h:101
virtual void Free(_Inout_opt_ void *Buffer)=0
virtual _Ret_maybenull_ _In_ int nCharSize
Definition: atlsimpstr.h:30
static HINSTANCE FindStringResourceInstance(_In_ UINT nID) noexcept
Definition: atlstr.h:114
static IAtlStringMgr * GetDefaultManager() noexcept
Definition: atlstr.h:119
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define _Post_readable_byte_size_(size)
Definition: ms_sal.h:651
#define _Inout_
Definition: ms_sal.h:378
#define _Ret_maybenull_
Definition: ms_sal.h:529
#define _In_
Definition: ms_sal.h:308
#define _In_opt_
Definition: ms_sal.h:309
Definition: rosdlgs.h:6
CStringA CString
Definition: atlstr.h:139
CAtlStringA CAtlString
Definition: atlstr.h:138
CAtlStringA CStringA
Definition: atlstr.h:131
HINSTANCE AtlFindStringResourceInstance(UINT nID, WORD wLanguage=0)
Definition: atlcore.h:294
CAtlStringW CStringW
Definition: atlstr.h:130
CStringT< wchar_t, StrTraitATL< wchar_t, ChTraitsCRT< wchar_t > > > CAtlStringW
Definition: atlstr.h:126
CStringT< char, StrTraitATL< char, ChTraitsCRT< char > > > CAtlStringA
Definition: atlstr.h:127
unsigned int UINT
Definition: ndis.h:50
void AddRef() noexcept
Definition: atlsimpstr.h:60
IAtlStringMgr * pStringMgr
Definition: atlsimpstr.h:50
uint32_t ULONG
Definition: typedefs.h:59
_In_opt_ PALLOCATE_FUNCTION Allocate
Definition: exfuncs.h:814