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... | |
A compact mapping from byte strings to pointers.
Use this class instead of CFX_MapByteStringToPtr when:
CFX_CMapByteStringToPtr::CFX_CMapByteStringToPtr | ( | IFX_Allocator * | pAllocator = 0 | ) |
The constructor.
[in] | pAllocator | An allocator. Default value: NULL. |
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.
[in] | key | The key to be added. |
[in] | pValue | The value to be added. |
int CFX_CMapByteStringToPtr::GetCount | ( | ) | const |
Get the number of key-value pairs.
void CFX_CMapByteStringToPtr::GetNextAssoc | ( | FX_POSITION & | rNextPosition, |
CFX_ByteString & | rKey, | ||
void *& | rValue | ||
) | const |
Get the current association and set the position to next association.
[in,out] | rNextPosition | Input a position, and receive the next association position as result. |
[out] | rKey | Receive a key. |
[out] | rValue | Receive a value. |
FX_LPVOID CFX_CMapByteStringToPtr::GetNextValue | ( | FX_POSITION & | rNextPosition | ) | const |
Get the the current value and set the position to next association.
[in,out] | rNextPosition | Input a position, and receive the next association position as result. |
FX_POSITION CFX_CMapByteStringToPtr::GetStartPosition | ( | ) | const |
Get the first key-value pair position. iterating all (key, value) pairs.
Lookup by a key.
[in] | key | The key to lookup. |
[out] | rValue | A reference of a typeless pointer to receive the found value. |
void CFX_CMapByteStringToPtr::RemoveAll | ( | ) |
Remove all key-value pairs in the map.
void CFX_CMapByteStringToPtr::RemoveKey | ( | FX_BSTR | key | ) |
Removing existing (key, ?) pair.
[in] | key | The key to be removed. |
void CFX_CMapByteStringToPtr::SetAt | ( | FX_BSTR | key, |
void * | value | ||
) |
Add a new (key, value) pair. Add if not exist, otherwise modify.
[in] | key | The key to specify a position. |
[in] | value | The new value. |