Foxit PDF SDK

Classes | Public Member Functions | List of all members
CFX_MapByteStringToPtr Class Reference
FXCRT

Inherits CFX_Object.

## Classes
struct | CAssoc
| Association in CFX_MapByteStringToPtr. More...

## Public Member Functions
| CFX_MapByteStringToPtr (int nBlockSize=10, IFX_Allocator *pAllocator=0)
| Construct with specified block size. More...
| ~CFX_MapByteStringToPtr ()
| 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, CFX_ByteString &rKey, void *&rValue) const
| Get the current association and set the position to next association. More...
FX_LPVOID | GetNextValue (FX_POSITION &rNextPosition) const
| Get the the current value 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...
FX_DWORD | HashKey (FX_BSTR key) const
| Routine used to user-provided hash keys. 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 (FX_BSTR key, void *&rValue) const
| Lookup by a key. More...
void *& | operator[] (FX_BSTR 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 (FX_BSTR key)
| Remove existing key. More...
void | SetAt (FX_BSTR key, void *newValue)
| Add a new (key, value) pair. Add if not exist, otherwise modify. More...

## Detailed Description

The class represents BYTE STRING MAP.

## Constructor & Destructor Documentation

## ◆ CFX_MapByteStringToPtr()

CFX_MapByteStringToPtr::CFX_MapByteStringToPtr | ( | int | nBlockSize = `10`,
|  | IFX_Allocator * | pAllocator = `0`
| ) |  |

Construct with specified block size.

Parameters

  [in] | nBlockSize | The internal block. Default value: 10.
  [in] | pAllocator | Allocator used in this class. NULL means to use default allocator. Default value: NULL.

## Member Function Documentation

## ◆ GetCount()

int CFX_MapByteStringToPtr::GetCount | ( |  | ) | const
| inline

Get the number of elements.

Returns
  The number of elements in the map.

## ◆ GetHashTableSize()

FX_DWORD CFX_MapByteStringToPtr::GetHashTableSize | ( |  | ) | const
| inline

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

Returns
  The hash table size.

## ◆ GetNextAssoc()

void CFX_MapByteStringToPtr::GetNextAssoc | ( | FX_POSITION & | rNextPosition,
|  | CFX_ByteString & | rKey,
|  | void *& | rValue
| ) |  | const

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

Parameters

  [in,out] | rNextPosition | Input a position, and receive the next association position as result.
  [out] | rKey | Receive a key.
  [out] | rValue | Receive a value.

Returns
  None.

## ◆ GetNextValue()

FX_LPVOID CFX_MapByteStringToPtr::GetNextValue | ( | FX_POSITION & | rNextPosition | ) | const

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

Parameters

  [in,out] | rNextPosition | Input a position, and receive the next association position as result.

Returns
  Current value.

## ◆ GetStartPosition()

FX_POSITION CFX_MapByteStringToPtr::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.

## ◆ HashKey()

FX_DWORD CFX_MapByteStringToPtr::HashKey | ( | FX_BSTR | key | ) | const

Routine used to user-provided hash keys.

Overwrite-able: special non-virtual (see map implementation for details).

Parameters

  [in] | key | The key used to produce hash key.

Returns
  A hash value.

## ◆ InitHashTable()

void CFX_MapByteStringToPtr::InitHashTable | ( | FX_DWORD | hashSize,
|  | FX_BOOL | bAllocNow = `true`
| ) |  |

Initialize the hash table.

Parameters

  [in] | hashSize | Initialize the hash table size.
  [in] | bAllocNow | A boolean value to decide whether to allocate the hash table now. true means to allocate hash table now, while false means not.

Returns
  None.

## ◆ IsEmpty()

FX_BOOL CFX_MapByteStringToPtr::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_MapByteStringToPtr::Lookup | ( | FX_BSTR | key,
|  | void *& | rValue
| ) |  | const

Lookup by a key.

Parameters

  [in] | key | The key to lookup.
  [out] | rValue | A 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_MapByteStringToPtr::operator[] | ( | FX_BSTR | key | ) |

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

Parameters

  [in] | key | The key to lookup.

Returns
  A reference to the found value.

## ◆ RemoveAll()

void CFX_MapByteStringToPtr::RemoveAll | ( |  | ) |

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

Returns
  None.

## ◆ RemoveKey()

FX_BOOL CFX_MapByteStringToPtr::RemoveKey | ( | FX_BSTR | key | ) |

Remove existing key.

Parameters

  [in] | key | The key to be removed.

Returns
  true means removing is successfully, while false means the key does not exist.

## ◆ SetAt()

void CFX_MapByteStringToPtr::SetAt | ( | FX_BSTR | key,
|  | void * | newValue
| ) |  |
| inline

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

Parameters

  [in] | key | The key to specify a position.
  [in] | newValue | The new value.

Returns
  None.