Foxit PDF SDK
CFX_ArrayTemplate< TYPE > 模板类 参考
类 CFX_ArrayTemplate< TYPE > 继承关系图:
CFX_BasicArray

Public 类型

enum  ErrorType { invalidArraySize, memoryAllocationError, indexOutOfRange }
 错误类型的枚举。 更多...
 

Public 成员函数

 CFX_ArrayTemplate (IFX_Allocator *pAllocator=0)
 构造函数,从分配器。 更多...
 
 CFX_ArrayTemplate (const CFX_ArrayTemplate &other, IFX_Allocator *pAllocator=0)
 拷贝构造函数。 更多...
 
FX_BOOL Add (TYPE newElement)
 在尾部添加元素。可能会增长数组。 更多...
 
TYPE * AddSpace ()
 添加元素的空间。 更多...
 
FX_BOOL Append (const CFX_ArrayTemplate &src)
 追加数组。 更多...
 
FX_BOOL Copy (const CFX_ArrayTemplate &src)
 从数组复制。 更多...
 
TYPE & ElementAt (int nIndex)
 此方法检索由索引号指定的元素的引用。 更多...
 
int Find (const TYPE &data, int iStart=0) const
 从指定位置到最后查找元素。 更多...
 
void FX_Error (ErrorType error, FX_INT32 badIndex=0) const
 当引发致命错误时调用此函数。打印错误信息并exit(1)。 更多...
 
const TYPE GetAt (int nIndex) const
 此方法检索由索引号指定的元素。 更多...
 
const TYPE * GetData () const
 直接访问元素数据(可能返回NULL)。 更多...
 
TYPE * GetData ()
 直接访问元素数据(可能返回NULL)。 更多...
 
TYPE * GetDataPtr (int index)
 获取指向数组中指定元素的指针。直接指针访问。 更多...
 
int GetSize () const
 获取数组中元素的数量。 更多...
 
int GetUpperBound () const
 获取数组中的上界,实际上是最大有效索引。 更多...
 
FX_BOOL InsertAt (int nIndex, TYPE newElement, int nCount=1)
 在指定位置插入一个或多个连续元素。 更多...
 
FX_BOOL InsertAt (int nStartIndex, const CFX_BasicArray *pNewArray)
 在指定位置插入数组。 更多...
 
TYPE * InsertSpaceAt (int nIndex, int nCount)
 插入若干元素。 更多...
 
CFX_ArrayTemplateoperator= (const CFX_ArrayTemplate &src)
 赋值运算符重载。 更多...
 
const TYPE operator[] (int nIndex) const
 下标([])运算符重载。它检索由nIndex中的基于零的索引指定的元素。 更多...
 
TYPE & operator[] (int nIndex)
 下标([])运算符重载。此函数返回由nIndex中的基于零的索引指定的指定元素的引用。 更多...
 
void RemoveAll ()
 清理数组。 更多...
 
FX_BOOL RemoveAt (int nIndex, int nCount=1)
 在指定位置移除若干元素。 更多...
 
FX_BOOL SetAt (int nIndex, TYPE newElement)
 此方法覆盖由索引号指定的元素。 更多...
 
FX_BOOL SetAtGrow (int nIndex, TYPE newElement)
 在指定位置设置元素值。可能会增长数组。 更多...
 
FX_BOOL SetSize (int nNewSize, int nGrowBy=-1)
 更改分配的大小和增长量。 更多...
 

额外继承的成员函数

- Public 属性 继承自 CFX_BasicArray
IFX_Allocatorm_pAllocator
 特殊分配器指针。NULL表示使用默认分配器。
 

详细描述

template<class TYPE>
class CFX_ArrayTemplate< TYPE >

表示数组模板的类。分配的总大小限制为2^28字节(256MB)。

成员枚举类型说明

◆ ErrorType

template<class TYPE>
enum CFX_ArrayTemplate::ErrorType

错误类型的枚举。

此枚举的值应单独使用。

枚举值
invalidArraySize 

无效的数组大小。

memoryAllocationError 

内存分配错误。

indexOutOfRange 

索引超出范围。

构造及析构函数说明

◆ CFX_ArrayTemplate() [1/2]

template<class TYPE>
CFX_ArrayTemplate< TYPE >::CFX_ArrayTemplate ( IFX_Allocator pAllocator = 0)
inline

构造函数,从分配器。

参数
[in]pAllocator分配器。默认值:NULL

◆ CFX_ArrayTemplate() [2/2]

template<class TYPE>
CFX_ArrayTemplate< TYPE >::CFX_ArrayTemplate ( const CFX_ArrayTemplate< TYPE > &  other,
IFX_Allocator pAllocator = 0 
)
inline

拷贝构造函数。

参数
[in]other另一个数组模板对象。
[in]pAllocator分配器。默认值:NULL

成员函数说明

◆ Add()

template<class TYPE>
FX_BOOL CFX_ArrayTemplate< TYPE >::Add ( TYPE  newElement)
inline

在尾部添加元素。可能会增长数组。

参数
[in]newElement输入的元素。
返回
true 表示成功,false 表示失败(如内存错误)。

◆ AddSpace()

template<class TYPE>
TYPE* CFX_ArrayTemplate< TYPE >::AddSpace ( )
inline

添加元素的空间。

返回
指向新元素的添加空间的指针。

◆ Append()

template<class TYPE>
FX_BOOL CFX_ArrayTemplate< TYPE >::Append ( const CFX_ArrayTemplate< TYPE > &  src)
inline

追加数组。

参数
[in]src输入的数组。
返回
TRUE 表示成功,FALSE 表示失败(如内存错误)。

◆ Copy()

template<class TYPE>
FX_BOOL CFX_ArrayTemplate< TYPE >::Copy ( const CFX_ArrayTemplate< TYPE > &  src)
inline

从数组复制。

参数
[in]src输入的数组。
返回
true 表示成功,false 表示失败(如内存错误)。

◆ ElementAt()

template<class TYPE>
TYPE& CFX_ArrayTemplate< TYPE >::ElementAt ( int  nIndex)
inline

此方法检索由索引号指定的元素的引用。

参数
[in]nIndex指定元素的基于零的索引。
返回
指定元素的引用。

◆ Find()

template<class TYPE>
int CFX_ArrayTemplate< TYPE >::Find ( const TYPE &  data,
int  iStart = 0 
) const
inline

从指定位置到最后查找元素。

参数
[in]data输入的元素。
[in]iStart指定开始查找的起始元素的基于零的索引。
返回
找到的元素的索引。-1表示未找到。

◆ FX_Error()

template<class TYPE>
void CFX_ArrayTemplate< TYPE >::FX_Error ( ErrorType  error,
FX_INT32  badIndex = 0 
) const
inline

当引发致命错误时调用此函数。打印错误信息并exit(1)。

参数
[in]error错误类型。应为以下值之一:
CFX_ArrayTemplate::invalidArraySizeCFX_ArrayTemplate::memoryAllocationError
[in]badIndex错误索引。默认值:0
返回
无。

◆ GetAt()

template<class TYPE>
const TYPE CFX_ArrayTemplate< TYPE >::GetAt ( int  nIndex) const
inline

此方法检索由索引号指定的元素。

参数
[in]nIndex指定元素的基于零的索引。
返回
元素。

◆ GetData() [1/2]

template<class TYPE>
const TYPE* CFX_ArrayTemplate< TYPE >::GetData ( ) const
inline

直接访问元素数据(可能返回NULL)。

返回
常量元素类型指针。

◆ GetData() [2/2]

template<class TYPE>
TYPE* CFX_ArrayTemplate< TYPE >::GetData ( )
inline

直接访问元素数据(可能返回NULL)。

返回
元素类型指针。

◆ GetDataPtr()

template<class TYPE>
TYPE* CFX_ArrayTemplate< TYPE >::GetDataPtr ( int  index)
inline

获取指向数组中指定元素的指针。直接指针访问。

参数
[in]index指定数组中元素的基于零的索引。
返回
指向指定元素的指针。

◆ GetSize()

template<class TYPE>
int CFX_ArrayTemplate< TYPE >::GetSize ( ) const
inline

获取数组中元素的数量。

返回
数组中元素的数量。

◆ GetUpperBound()

template<class TYPE>
int CFX_ArrayTemplate< TYPE >::GetUpperBound ( ) const
inline

获取数组中的上界,实际上是最大有效索引。

返回
上界。

◆ InsertAt() [1/2]

template<class TYPE>
FX_BOOL CFX_ArrayTemplate< TYPE >::InsertAt ( int  nIndex,
TYPE  newElement,
int  nCount = 1 
)
inline

在指定位置插入一个或多个连续元素。

参数
[in]nIndex指定数组中的基于零的索引。
[in]newElement指定要插入的元素值。
[in]nCount指定要插入的元素数量。
返回
TRUE 表示成功,FALSE 表示失败(如参数或内存错误)。

◆ InsertAt() [2/2]

template<class TYPE>
FX_BOOL CFX_ArrayTemplate< TYPE >::InsertAt ( int  nStartIndex,
const CFX_BasicArray pNewArray 
)
inline

在指定位置插入数组。

参数
[in]nStartIndex指定要插入位置的起始元素的基于零的索引。
[in]pNewArray输入的数组。
返回
TRUE 表示成功,FALSE 表示失败(如参数或内存错误)。

◆ InsertSpaceAt()

template<class TYPE>
TYPE* CFX_ArrayTemplate< TYPE >::InsertSpaceAt ( int  nIndex,
int  nCount 
)
inline

插入若干元素。

参数
[in]nIndex指定数组中起始元素的基于零的索引。
[in]nCount指定要插入的元素数量。
返回
指向新元素的插入空间的指针。

◆ operator=()

template<class TYPE>
CFX_ArrayTemplate& CFX_ArrayTemplate< TYPE >::operator= ( const CFX_ArrayTemplate< TYPE > &  src)
inline

赋值运算符重载。

参数
[in]src输入的数组。
返回
当前数组对象的引用。

◆ operator[]() [1/2]

template<class TYPE>
const TYPE CFX_ArrayTemplate< TYPE >::operator[] ( int  nIndex) const
inline

下标([])运算符重载。它检索由nIndex中的基于零的索引指定的元素。

参数
[in]nIndex指定数组中的基于零的索引。
返回
元素值。

◆ operator[]() [2/2]

template<class TYPE>
TYPE& CFX_ArrayTemplate< TYPE >::operator[] ( int  nIndex)
inline

下标([])运算符重载。此函数返回由nIndex中的基于零的索引指定的指定元素的引用。

参数
[in]nIndex指定数组中的基于零的索引。
返回
指定元素的引用。

◆ RemoveAll()

template<class TYPE>
void CFX_ArrayTemplate< TYPE >::RemoveAll ( )
inline

清理数组。

返回
无。

◆ RemoveAt()

template<class TYPE>
FX_BOOL CFX_ArrayTemplate< TYPE >::RemoveAt ( int  nIndex,
int  nCount = 1 
)
inline

在指定位置移除若干元素。

参数
[in]nIndex指定数组中的基于零的索引。
[in]nCount指定要移除的元素数量。
返回
TRUE 表示成功,FALSE 表示失败(如参数或内存错误)。

◆ SetAt()

template<class TYPE>
FX_BOOL CFX_ArrayTemplate< TYPE >::SetAt ( int  nIndex,
TYPE  newElement 
)
inline

此方法覆盖由索引号指定的元素。

参数
[in]nIndex指定元素的基于零的索引。
[in]newElement元素。
返回
true 表示成功,false 表示失败。

◆ SetAtGrow()

template<class TYPE>
FX_BOOL CFX_ArrayTemplate< TYPE >::SetAtGrow ( int  nIndex,
TYPE  newElement 
)
inline

在指定位置设置元素值。可能会增长数组。

参数
[in]nIndex指定数组中元素的基于零的索引。
[in]newElement输入的元素。
返回
true 表示成功,false 表示失败。

◆ SetSize()

template<class TYPE>
FX_BOOL CFX_ArrayTemplate< TYPE >::SetSize ( int  nNewSize,
int  nGrowBy = -1 
)
inline

更改分配的大小和增长量。

参数
[in]nNewSize期望的新大小(以元素为单位)。
[in]nGrowBy期望的增长量(以元素为单位)。这可以为-1表示增长量不变。
返回
true 表示成功,false 表示失败(如参数或内存错误)。