Foxit PDF SDK

Public Member Functions | List of all members
CFX_CMapByteStringToPtr Class Reference
FXCRT

Inherits CFX_Object.

## Public Member Functions
| CFX_CMapByteStringToPtr (IFX_Allocator *pAllocator=0)
| The constructor. More...
| ~CFX_CMapByteStringToPtr ()
| The destructor.
void | AddValue (FX_BSTR key, void *pValue)
| Add a key-value pair to the dictionary, assuming there is no duplicated key existing. More...
int | GetCount () const
| Get the number of key-value pairs. 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_BOOL | Lookup (FX_BSTR key, void *&rValue) const
| Lookup by a key. More...
void | RemoveAll ()
| Remove all key-value pairs in the map. More...
void | RemoveKey (FX_BSTR key)
| Removing existing (key, ?) pair. More...
void | SetAt (FX_BSTR key, void *value)
| Add a new (key, value) pair. Add if not exist, otherwise modify. More...

## Detailed Description

A compact mapping from byte strings to pointers.
Use this class instead of CFX_MapByteStringToPtr when:

- The number of mappings is mostly limited, for example, tens of mappings;
- The length of mapping keys is mostly limited, for example, often less than 8 characters.

## Constructor & Destructor Documentation

## ◆ CFX_CMapByteStringToPtr()

CFX_CMapByteStringToPtr::CFX_CMapByteStringToPtr | ( | IFX_Allocator * | pAllocator = `0` | ) |

The constructor.

Parameters

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

## Member Function Documentation

## ◆ AddValue()

void CFX_CMapByteStringToPtr::AddValue | ( | FX_BSTR | key,
|  | void * | pValue
| ) |  |

Add a key-value pair to the dictionary, assuming there is no duplicated key existing.

This is a function for quickly building up the whole dictionary, but should be used with care. If duplicate key happens, only the first value will prevail.

Parameters

  [in] | key | The key to be added.
  [in] | pValue | The value to be added.

Returns
  None.

## ◆ GetCount()

int CFX_CMapByteStringToPtr::GetCount | ( |  | ) | const

Get the number of key-value pairs.

Returns
  The number of key-value pairs in the map.

## ◆ GetNextAssoc()

void CFX_CMapByteStringToPtr::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_CMapByteStringToPtr::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_CMapByteStringToPtr::GetStartPosition | ( |  | ) | const

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

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

## ◆ Lookup()

FX_BOOL CFX_CMapByteStringToPtr::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.

## ◆ RemoveAll()

void CFX_CMapByteStringToPtr::RemoveAll | ( |  | ) |

Remove all key-value pairs in the map.

Returns
  None.

## ◆ RemoveKey()

void CFX_CMapByteStringToPtr::RemoveKey | ( | FX_BSTR | key | ) |

Removing existing (key, ?) pair.

Parameters

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

Returns
  None.

## ◆ SetAt()

void CFX_CMapByteStringToPtr::SetAt | ( | FX_BSTR | key,
|  | void * | value
| ) |  |

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

Parameters

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

Returns
  None.