ReactOS 0.4.15-dev-7934-g1dc8d80
tinyxml2::DynArray< T, INITIAL_SIZE > Class Template Reference

#include <tinyxml2.h>

Collaboration diagram for tinyxml2::DynArray< T, INITIAL_SIZE >:

Public Member Functions

 DynArray ()
 
 ~DynArray ()
 
void Clear ()
 
void Push (T t)
 
TPushArr (int count)
 
T Pop ()
 
void PopArr (int count)
 
bool Empty () const
 
Toperator[] (int i)
 
const Toperator[] (int i) const
 
const TPeekTop () const
 
int Size () const
 
int Capacity () const
 
const TMem () const
 
TMem ()
 

Private Member Functions

 DynArray (const DynArray &)
 
void operator= (const DynArray &)
 
void EnsureCapacity (int cap)
 

Private Attributes

T_mem
 
T _pool [INITIAL_SIZE]
 
int _allocated
 
int _size
 

Detailed Description

template<class T, int INITIAL_SIZE>
class tinyxml2::DynArray< T, INITIAL_SIZE >

Definition at line 184 of file tinyxml2.h.

Constructor & Destructor Documentation

◆ DynArray() [1/2]

template<class T , int INITIAL_SIZE>
tinyxml2::DynArray< T, INITIAL_SIZE >::DynArray ( )
inline

Definition at line 187 of file tinyxml2.h.

187 {
188 _mem = _pool;
189 _allocated = INITIAL_SIZE;
190 _size = 0;
191 }
T _pool[INITIAL_SIZE]
Definition: tinyxml2.h:287

◆ ~DynArray()

template<class T , int INITIAL_SIZE>
tinyxml2::DynArray< T, INITIAL_SIZE >::~DynArray ( )
inline

Definition at line 193 of file tinyxml2.h.

193 {
194 if ( _mem != _pool ) {
195 delete [] _mem;
196 }
197 }

◆ DynArray() [2/2]

template<class T , int INITIAL_SIZE>
tinyxml2::DynArray< T, INITIAL_SIZE >::DynArray ( const DynArray< T, INITIAL_SIZE > &  )
private

Member Function Documentation

◆ Capacity()

template<class T , int INITIAL_SIZE>
int tinyxml2::DynArray< T, INITIAL_SIZE >::Capacity ( ) const
inline

Definition at line 252 of file tinyxml2.h.

252 {
253 TIXMLASSERT( _allocated >= INITIAL_SIZE );
254 return _allocated;
255 }
#define TIXMLASSERT(x)
Definition: tinyxml2.h:88

◆ Clear()

template<class T , int INITIAL_SIZE>
void tinyxml2::DynArray< T, INITIAL_SIZE >::Clear ( )
inline

Definition at line 199 of file tinyxml2.h.

199 {
200 _size = 0;
201 }

◆ Empty()

template<class T , int INITIAL_SIZE>
bool tinyxml2::DynArray< T, INITIAL_SIZE >::Empty ( ) const
inline

Definition at line 228 of file tinyxml2.h.

228 {
229 return _size == 0;
230 }

◆ EnsureCapacity()

template<class T , int INITIAL_SIZE>
void tinyxml2::DynArray< T, INITIAL_SIZE >::EnsureCapacity ( int  cap)
inlineprivate

Definition at line 271 of file tinyxml2.h.

271 {
272 TIXMLASSERT( cap > 0 );
273 if ( cap > _allocated ) {
274 TIXMLASSERT( cap <= INT_MAX / 2 );
275 int newAllocated = cap * 2;
276 T* newMem = new T[newAllocated];
277 memcpy( newMem, _mem, sizeof(T)*_size ); // warning: not using constructors, only works for PODs
278 if ( _mem != _pool ) {
279 delete [] _mem;
280 }
281 _mem = newMem;
282 _allocated = newAllocated;
283 }
284 }
GLenum cap
Definition: glext.h:9639
#define INT_MAX
Definition: limits.h:40
#define T
Definition: mbstring.h:31
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878

Referenced by tinyxml2::DynArray< T, INITIAL_SIZE >::Push(), and tinyxml2::DynArray< T, INITIAL_SIZE >::PushArr().

◆ Mem() [1/2]

template<class T , int INITIAL_SIZE>
T * tinyxml2::DynArray< T, INITIAL_SIZE >::Mem ( )
inline

Definition at line 262 of file tinyxml2.h.

262 {
263 TIXMLASSERT( _mem );
264 return _mem;
265 }

◆ Mem() [2/2]

template<class T , int INITIAL_SIZE>
const T * tinyxml2::DynArray< T, INITIAL_SIZE >::Mem ( ) const
inline

Definition at line 257 of file tinyxml2.h.

257 {
258 TIXMLASSERT( _mem );
259 return _mem;
260 }

◆ operator=()

template<class T , int INITIAL_SIZE>
void tinyxml2::DynArray< T, INITIAL_SIZE >::operator= ( const DynArray< T, INITIAL_SIZE > &  )
private

◆ operator[]() [1/2]

template<class T , int INITIAL_SIZE>
T & tinyxml2::DynArray< T, INITIAL_SIZE >::operator[] ( int  i)
inline

Definition at line 232 of file tinyxml2.h.

232 {
233 TIXMLASSERT( i>= 0 && i < _size );
234 return _mem[i];
235 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248

◆ operator[]() [2/2]

template<class T , int INITIAL_SIZE>
const T & tinyxml2::DynArray< T, INITIAL_SIZE >::operator[] ( int  i) const
inline

Definition at line 237 of file tinyxml2.h.

237 {
238 TIXMLASSERT( i>= 0 && i < _size );
239 return _mem[i];
240 }

◆ PeekTop()

template<class T , int INITIAL_SIZE>
const T & tinyxml2::DynArray< T, INITIAL_SIZE >::PeekTop ( ) const
inline

Definition at line 242 of file tinyxml2.h.

242 {
243 TIXMLASSERT( _size > 0 );
244 return _mem[ _size - 1];
245 }

◆ Pop()

template<class T , int INITIAL_SIZE>
T tinyxml2::DynArray< T, INITIAL_SIZE >::Pop ( )
inline

Definition at line 218 of file tinyxml2.h.

218 {
219 TIXMLASSERT( _size > 0 );
220 return _mem[--_size];
221 }

Referenced by tinyxml2::XMLPrinter::CloseElement().

◆ PopArr()

template<class T , int INITIAL_SIZE>
void tinyxml2::DynArray< T, INITIAL_SIZE >::PopArr ( int  count)
inline

Definition at line 223 of file tinyxml2.h.

223 {
224 TIXMLASSERT( _size >= count );
225 _size -= count;
226 }
GLuint GLuint GLsizei count
Definition: gl.h:1545

◆ Push()

template<class T , int INITIAL_SIZE>
void tinyxml2::DynArray< T, INITIAL_SIZE >::Push ( T  t)
inline

Definition at line 203 of file tinyxml2.h.

203 {
206 _mem[_size++] = t;
207 }
void EnsureCapacity(int cap)
Definition: tinyxml2.h:271
GLdouble GLdouble t
Definition: gl.h:2047

Referenced by tinyxml2::XMLPrinter::OpenElement(), and tinyxml2::XMLPrinter::XMLPrinter().

◆ PushArr()

template<class T , int INITIAL_SIZE>
T * tinyxml2::DynArray< T, INITIAL_SIZE >::PushArr ( int  count)
inline

Definition at line 209 of file tinyxml2.h.

209 {
210 TIXMLASSERT( count >= 0 );
213 T* ret = &_mem[_size];
214 _size += count;
215 return ret;
216 }
int ret

Referenced by tinyxml2::XMLPrinter::Print().

◆ Size()

template<class T , int INITIAL_SIZE>
int tinyxml2::DynArray< T, INITIAL_SIZE >::Size ( ) const
inline

Definition at line 247 of file tinyxml2.h.

247 {
248 TIXMLASSERT( _size >= 0 );
249 return _size;
250 }

Referenced by tinyxml2::XMLPrinter::Print().

Member Data Documentation

◆ _allocated

◆ _mem

◆ _pool

template<class T , int INITIAL_SIZE>
T tinyxml2::DynArray< T, INITIAL_SIZE >::_pool[INITIAL_SIZE]
private

◆ _size


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