ReactOS  0.4.13-dev-235-g7373cb3
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  }
T _pool[INITIAL_SIZE]
Definition: tinyxml2.h:287

◆ 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  }
#define INT_MAX
Definition: limits.h:40
T _pool[INITIAL_SIZE]
Definition: tinyxml2.h:287
#define T
Definition: mbstring.h:31
GLenum cap
Definition: glext.h:9639
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define TIXMLASSERT(x)
Definition: tinyxml2.h:88

Referenced by tinyxml2::DynArray< char, 20 >::Push(), and tinyxml2::DynArray< char, 20 >::PushArr().

◆ Mem() [1/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  }
#define TIXMLASSERT(x)
Definition: tinyxml2.h:88

◆ Mem() [2/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  }
#define TIXMLASSERT(x)
Definition: tinyxml2.h:88

◆ 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
#define TIXMLASSERT(x)
Definition: tinyxml2.h:88

◆ 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  }
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
#define TIXMLASSERT(x)
Definition: tinyxml2.h:88

◆ 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  }
#define TIXMLASSERT(x)
Definition: tinyxml2.h:88

◆ 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  }
#define TIXMLASSERT(x)
Definition: tinyxml2.h:88

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
#define TIXMLASSERT(x)
Definition: tinyxml2.h:88

◆ 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  {
205  EnsureCapacity( _size+1 );
206  _mem[_size++] = t;
207  }
#define INT_MAX
Definition: limits.h:40
GLdouble GLdouble t
Definition: gl.h:2047
void EnsureCapacity(int cap)
Definition: tinyxml2.h:271
#define TIXMLASSERT(x)
Definition: tinyxml2.h:88

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 );
211  TIXMLASSERT( _size <= INT_MAX - count );
213  T* ret = &_mem[_size];
214  _size += count;
215  return ret;
216  }
#define INT_MAX
Definition: limits.h:40
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define T
Definition: mbstring.h:31
void EnsureCapacity(int cap)
Definition: tinyxml2.h:271
int ret
#define TIXMLASSERT(x)
Definition: tinyxml2.h:88

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  }
#define TIXMLASSERT(x)
Definition: tinyxml2.h:88

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

Member Data Documentation

◆ _allocated

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

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