CFX_MapPtrToPtr Class Reference
Inheritance diagram for CFX_MapPtrToPtr:
CFX_MapPtrTemplate< KeyType, ValueType >

Classes

struct  CAssoc
 Association in CFX_MapPtrToPtr. More...
 

Public Member Functions

 CFX_MapPtrToPtr (int nBlockSize=10, IFX_Allocator *pAllocator=0)
 Construct with specified block size. More...
 
 ~CFX_MapPtrToPtr ()
 The Destructor.
 
int GetCount () const
 Get the number of elements. More...
 
FX_DWORD GetHashTableSize () const
 Get the internal hash table size. Advanced features for derived classes. More...
 
void GetNextAssoc (FX_POSITION &rNextPosition, void *&rKey, void *&rValue) const
 Get the current association and set the position to next association. More...
 
FX_POSITION GetStartPosition () const
 Get the first key-value pair position. iterating all (key, value) pairs. More...
 
void * GetValueAt (void *key) const
 Get a value pointer by a key. More...
 
void InitHashTable (FX_DWORD hashSize, FX_BOOL bAllocNow=true)
 Initialize the hash table. More...
 
FX_BOOL IsEmpty () const
 Verify whether the map is empty. More...
 
FX_BOOL Lookup (void *key, void *&rValue) const
 Lookup by a key. More...
 
void *& operator[] (void *key)
 Subscript([]) operator overload. Lookup and add if not there. More...
 
void RemoveAll ()
 Remove all the (key, value) pairs in the map. More...
 
FX_BOOL RemoveKey (void *key)
 Removing existing (key, ?) pair. More...
 
void SetAt (void *key, void *newValue)
 Add a new (key, value) pair. Add if not exist, otherwise modify. More...
 

Detailed Description

The class represents POINTER/DWORD TO POINTER/DWORD MAP.

Constructor & Destructor Documentation

◆ CFX_MapPtrToPtr()

CFX_MapPtrToPtr::CFX_MapPtrToPtr ( int  nBlockSize = 10,
IFX_Allocator pAllocator = 0 
)

Construct with specified block size.

Parameters
[in]nBlockSizeThe internal block. This parameter must be > 0.
[in]pAllocatorAllocator used in this class. NULL means to use default allocator. Default value: NULL.

Member Function Documentation

◆ GetCount()

int CFX_MapPtrToPtr::GetCount ( ) const
inline

Get the number of elements.

Returns
The number of elements in the map.

◆ GetHashTableSize()

FX_DWORD CFX_MapPtrToPtr::GetHashTableSize ( ) const
inline

Get the internal hash table size. Advanced features for derived classes.

Returns
The hash table size.

◆ GetNextAssoc()

void CFX_MapPtrToPtr::GetNextAssoc ( FX_POSITION rNextPosition,
void *&  rKey,
void *&  rValue 
) const

Get the current association and set the position to next association.

Never call this function on an empty map.

Parameters
[in,out]rNextPositionInput a position, and receive the next association position as result. This parameter will be NULL when reaching the end of the map.
[out]rKeyReceive a key.
[out]rValueReceive a value.
Returns
None.

◆ GetStartPosition()

FX_POSITION CFX_MapPtrToPtr::GetStartPosition ( ) const
inline

Get the first key-value pair position. iterating all (key, value) pairs.

Returns
The first key-value pair position in the map.

◆ GetValueAt()

void* CFX_MapPtrToPtr::GetValueAt ( void *  key) const

Get a value pointer by a key.

Parameters
[in]keyThe key, whose mapping value is to be retrieved.
Returns
A value. NULL means the key is not found.

◆ InitHashTable()

void CFX_MapPtrToPtr::InitHashTable ( FX_DWORD  hashSize,
FX_BOOL  bAllocNow = true 
)

Initialize the hash table.

Parameters
[in]hashSizeInitialize the hash table size.
[in]bAllocNowA boolean value to decide whether to allocate the hash table now. true means to allocate the hash table now, while false means not.
Returns
None.

◆ IsEmpty()

FX_BOOL CFX_MapPtrToPtr::IsEmpty ( ) const
inline

Verify whether the map is empty.

Returns
true means current map is empty, while false means current map is not empty.

◆ Lookup()

FX_BOOL CFX_MapPtrToPtr::Lookup ( void *  key,
void *&  rValue 
) const

Lookup by a key.

Parameters
[in]keyThe key to lookup.
[out]rValueA reference of a typeless pointer to receive the found value.
Returns
true means the key is found, while false means the key is not found.

◆ operator[]()

void*& CFX_MapPtrToPtr::operator[] ( void *  key)

Subscript([]) operator overload. Lookup and add if not there.

Parameters
[in]keyThe key to lookup.
Returns
A reference to the found value.

◆ RemoveAll()

void CFX_MapPtrToPtr::RemoveAll ( )

Remove all the (key, value) pairs in the map.

Returns
None.

◆ RemoveKey()

FX_BOOL CFX_MapPtrToPtr::RemoveKey ( void *  key)

Removing existing (key, ?) pair.

Parameters
[in]keyThe key to be removed.
Returns
true means success, while false means failure.

◆ SetAt()

void CFX_MapPtrToPtr::SetAt ( void *  key,
void *  newValue 
)
inline

Add a new (key, value) pair. Add if not exist, otherwise modify.

Parameters
[in]keyThe key to specify a position.
[in]newValueThe new value.
Returns
None.

Foxit Software Corporation Logo
@2019 Foxit Software Incorporated. All rights reserved.