Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
AllocArray< T > Class Template Reference

#include <elm/data/Array.h>

+ Inheritance diagram for AllocArray< T >:

Public Member Functions

 AllocArray (void)
 
 AllocArray (int count, T *buffer)
 
 AllocArray (int count)
 
 AllocArray (int count, const T &val)
 
 AllocArray (const Array< T > &t)
 
 AllocArray (const AllocArray< T > &t)
 
 ~AllocArray (void)
 
void copy (const Array< T > &t)
 
void tie (int cnt, T *buffer)
 
void tie (const Array< T > &t)
 
AllocArray< T > & operator= (const Array< T > &t)
 
AllocArray< T > & operator= (const AllocArray< T > &t)
 
- Public Member Functions inherited from Array< T >
 Array (void)
 
 Array (int count, T *buffer)
 
const T * buffer (void) const
 
T * buffer (void)
 
int size (void) const
 
void set (int count, T *buffer)
 
void set (const Array< T > &t)
 
void copy (const Array &t)
 
void fill (const T &val)
 
const T * operator() (void) const
 
T * operator() (void)
 
Array< T > & operator= (const Array< T > &t)
 
Iter items (void) const
 
Iter operator* (void) const
 
Iter begin (void) const
 
Iter end (void) const
 
int count (void) const
 
bool contains (const T &item)
 
template<class C >
bool containsAll (const C &c)
 
bool isEmpty (void) const
 
 operator bool (void) const
 
bool equals (const Array< T > &a)
 
bool operator== (const Array< T > &a) const
 
bool operator!= (const Array< T > &a) const
 
bool operator<= (const Array< T > &a) const
 
bool operator< (const Array< T > &a) const
 
bool operator>= (const Array< T > &a) const
 
bool operator> (const Array< T > &a) const
 
int length (void) const
 
const T & get (int idx) const
 
int indexOf (const T &v, int i=0) const
 
int lastIndexOf (const T &v, int i=-1) const
 
const T & operator[] (int idx) const
 
void set (int idx, const T &val)
 
void set (const Iter &i, const T &val)
 
T & get (int idx)
 
T & operator[] (int idx)
 

Additional Inherited Members

- Public Types inherited from Array< T >
typedef T t
 
typedef Array< T > self_t
 
- Static Public Attributes inherited from Array< T >
static const Array< T > null
 
- Protected Attributes inherited from Array< T >
int cnt
 
T * buf
 

Detailed Description

template<class T>
class elm::AllocArray< T >

An AllocArray is an Array that manages its own memory. It may be built giving its size and from another C array or Array. It will create its memory to store the array and it will free it at destruction time.

Only the set() methods can assign to the AllocArray a memory not allocated by itself. If such a method is called, it will receive the given array (and memory) and will free it when it will be destructed.

Parameters
TType of elements stored in the array.
See also
cArray, _array

Constructor & Destructor Documentation

◆ AllocArray() [1/6]

AllocArray ( void  )
inline

Build an empty array.

◆ AllocArray() [2/6]

AllocArray ( int  count,
T *  buffer 
)
inline

Build an array by copying the given array.

Parameters
countElement count.
bufferContaining the element to copy.

◆ AllocArray() [3/6]

AllocArray ( int  count)
inline

Allocate an array with count size.

Parameters
countArray element count.

◆ AllocArray() [4/6]

AllocArray ( int  count,
const T &  val 
)
inline

Allocate an array with count element and initialize them with val.

Parameters
countElement count.
valInitialization value.

◆ AllocArray() [5/6]

AllocArray ( const Array< T > &  t)
inline

Build a copy of the given array.

◆ AllocArray() [6/6]

AllocArray ( const AllocArray< T > &  t)
inline

Build a copy of the given array.

◆ ~AllocArray()

~AllocArray ( void  )
inline

Member Function Documentation

◆ copy()

void copy ( const Array< T > &  t)
inline

Perform a copy inside the current array of the given array.

Parameters
tCopied array.

Referenced by AllocArray< elm::String >::operator=().

◆ operator=() [1/2]

AllocArray< T > & operator= ( const AllocArray< T > &  t)
inline

Same as copy().

◆ operator=() [2/2]

AllocArray< T > & operator= ( const Array< T > &  t)
inline

Same as copy().

◆ tie() [1/2]

void tie ( const Array< T > &  t)
inline

◆ tie() [2/2]

void tie ( int  cnt,
T *  buffer 
)
inline

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