Foxit PDF Conversion SDK

Public Member Functions | List of all members
CFX_ObjectArray< ObjectClass > Class Template Reference
FXCRT
Inheritance diagram for CFX_ObjectArray< ObjectClass >:

## Public Member Functions
| CFX_ObjectArray (IFX_Allocator *pAllocator=0)
| The constructor. More...
| CFX_ObjectArray (const CFX_ObjectArray &other, IFX_Allocator *pAllocator=0)
| The copy constructor. More...
| ~CFX_ObjectArray ()
| The destructor.
void | Add (const ObjectClass &data)
| Add a copy of an existing object to the array. More...
ObjectClass & | Add ()
| Add an empty object to the array. More...
void * | AddSpace ()
| Add an empty space to the array. More...
FX_INT32 | Append (const CFX_ObjectArray &src, FX_INT32 nStart=0, FX_INT32 nCount=-1)
| Append an array. More...
FX_INT32 | Copy (const CFX_ObjectArray &src, FX_INT32 nStart=0, FX_INT32 nCount=-1)
| Copy from an array. More...
ObjectClass * | GetDataPtr (int index) const
| Get a pointer to the specified element in the array. Direct pointer access. More...
int | GetSize () const
| Get the size of the array. More...
CFX_ObjectArray & | operator= (const CFX_ObjectArray &other)
| The assignment operator. More...
ObjectClass & | operator[] (int index) const
| Subscript([]) operator overload. This function returns a reference to the specified object specified by the zero-based index in nIndex. More...
void | RemoveAll ()
| Remove all objects in the array. More...
void | RemoveAt (int index)
| Remove an object at specified position. More...

## Additional Inherited Members
Public Attributes inherited from CFX_BasicArray
IFX_Allocator * | m_pAllocator
| Special allocator pointer. NULL to use default allocator.

## Detailed Description

### template<class ObjectClass>
class CFX_ObjectArray< ObjectClass >

The class represents Object array template. Each object in the array is "owned" by the array, so when this array is destructed, or an object is removed from the array, the object(s) will be destructed.

The template parameter <class T> must support "placement new". (any class derived from CFX_Object supports placement new).

## Constructor & Destructor Documentation

## ◆ CFX_ObjectArray() [1/2]

template<class ObjectClass>

CFX_ObjectArray< ObjectClass >::CFX_ObjectArray | ( | IFX_Allocator * | pAllocator = `0` | ) |
| inline

The constructor.

Parameters

  [in] | pAllocator | An allocator. Default value: NULL.

## ◆ CFX_ObjectArray() [2/2]

template<class ObjectClass>

CFX_ObjectArray< ObjectClass >::CFX_ObjectArray | ( | const CFX_ObjectArray< ObjectClass > & | other,
|  | IFX_Allocator * | pAllocator = `0`
| ) |  |
| inline

The copy constructor.

Parameters

  [in] | other | The other object array.
  [in] | pAllocator | An allocator. Default value: NULL.

## Member Function Documentation

## ◆ Add() [1/2]

template<class ObjectClass>

void CFX_ObjectArray< ObjectClass >::Add | ( | const ObjectClass & | data | ) |
| inline

Add a copy of an existing object to the array.

To call this function, the template parameter class must support copy constructor.

Parameters

  [in] | data | The input object.

Returns
  None.

## ◆ Add() [2/2]

template<class ObjectClass>

ObjectClass& CFX_ObjectArray< ObjectClass >::Add | ( |  | ) |
| inline

Add an empty object to the array.

To call this function, the template parameter class must support default constructor.

Returns
  A reference to the newly added object.

## ◆ AddSpace()

template<class ObjectClass>

void* CFX_ObjectArray< ObjectClass >::AddSpace | ( |  | ) |
| inline

Add an empty space to the array.

Caller should initialize object at once to make sure object is available.

Returns
  Pointer to allocated space.

## ◆ Append()

template<class ObjectClass>

FX_INT32 CFX_ObjectArray< ObjectClass >::Append | ( | const CFX_ObjectArray< ObjectClass > & | src,
|  | FX_INT32 | nStart = `0`,
|  | FX_INT32 | nCount = `-1`
| ) |  |
| inline

Append an array.

Parameters

  [in] | src | The source array.
  [in] | nStart | The starting position to be appended in source array. Default value: 0.
  [in] | nCount | The total count of source elements to be appended. -1 means all elements from nStart position. Default value: -1.

Returns
  The number of appended elements from source array.

## ◆ Copy()

template<class ObjectClass>

FX_INT32 CFX_ObjectArray< ObjectClass >::Copy | ( | const CFX_ObjectArray< ObjectClass > & | src,
|  | FX_INT32 | nStart = `0`,
|  | FX_INT32 | nCount = `-1`
| ) |  |
| inline

Copy from an array.

Parameters

  [in] | src | The source array.
  [in] | nStart | The starting position to be copied in source array. Default value: 0
  [in] | nCount | The total count of source elements to be copied, -1 means all elements from nStart position. Default value: -1.

Returns
  The number of copied elements from source array.

## ◆ GetDataPtr()

template<class ObjectClass>

ObjectClass* CFX_ObjectArray< ObjectClass >::GetDataPtr | ( | int | index | ) | const
| inline

Get a pointer to the specified element in the array. Direct pointer access.

Parameters

  [in] | index | Specifies the zero-based index of element in the array.

Returns
  A pointer to the specified element.

## ◆ GetSize()

template<class ObjectClass>

int CFX_ObjectArray< ObjectClass >::GetSize | ( |  | ) | const
| inline

Get the size of the array.

Returns
  The size in objects in the array.

## ◆ operator=()

template<class ObjectClass>

CFX_ObjectArray& CFX_ObjectArray< ObjectClass >::operator= | ( | const CFX_ObjectArray< ObjectClass > & | other | ) |
| inline

The assignment operator.

Parameters

  [in] | other | The other object array.

Returns
  A reference to current object itself.

## ◆ operator[]()

template<class ObjectClass>

ObjectClass& CFX_ObjectArray< ObjectClass >::operator[] | ( | int | index | ) | const
| inline

Subscript([]) operator overload. This function returns a reference to the specified object specified by the zero-based index in nIndex.

Parameters

  [in] | index | Specifies the zero-based index in the array.

Returns
  A reference to the specified object.

## ◆ RemoveAll()

template<class ObjectClass>

void CFX_ObjectArray< ObjectClass >::RemoveAll | ( |  | ) |
| inline

Remove all objects in the array.

Returns
  None.

## ◆ RemoveAt()

template<class ObjectClass>

void CFX_ObjectArray< ObjectClass >::RemoveAt | ( | int | index | ) |
| inline

Remove an object at specified position.

Parameters

  [in] | index | Specifies the zero-based index of object in the array.

Returns
  None.