crashpad::TSimpleStringDictionary< KeySize, ValueSize, NumEntries > Class Template Reference

A map/dictionary collection implementation using a fixed amount of storage, so that it does not perform any dynamic allocations for its operations. More...

`#include "client/simple_string_dictionary.h"`

## Classes

struct | Entry
| A single entry in the map. More...
class | Iterator
| An iterator to traverse all of the active entries in a TSimpleStringDictionary. More...

## Public Member Functions

| TSimpleStringDictionary (const TSimpleStringDictionary &other)
TSimpleStringDictionary & | operator= (const TSimpleStringDictionary &other)
size_t | GetCount () const
| Returns the number of active key/value pairs. The upper limit for this is NumEntries.
const char * | GetValueForKey (base::StringPiece key) const
| Given key, returns its corresponding value. More...
void | SetKeyValue (base::StringPiece key, base::StringPiece value)
| Stores value into key, replacing the existing value if key is already present. More...
void | RemoveKey (base::StringPiece key)
| Removes key from the map. More...

## Static Public Attributes

static const size_t | key_size = KeySize
| Constant and publicly accessible versions of the template parameters.
static const size_t | value_size = ValueSize
| Constant and publicly accessible versions of the template parameters.
static const size_t | num_entries = NumEntries
| Constant and publicly accessible versions of the template parameters.

## Detailed Description

### template<size_t KeySize = 256, size_t ValueSize = 256, size_t NumEntries = 64>
class crashpad::TSimpleStringDictionary< KeySize, ValueSize, NumEntries >

A map/dictionary collection implementation using a fixed amount of storage, so that it does not perform any dynamic allocations for its operations.

The actual map storage (TSimpleStringDictionary::Entry) is guaranteed to be POD, so that it can be transmitted over various IPC mechanisms.

The template parameters control the amount of storage used for the key, value, and map. The KeySize and ValueSize are measured in bytes, not glyphs, and include space for a trailing `NUL` byte. This gives space for `KeySize - 1` and `ValueSize - 1` characters in an entry. NumEntries is the total number of entries that will fit in the map.

## Member Function Documentation

## GetValueForKey()

template<size_t KeySize = 256, size_t ValueSize = 256, size_t NumEntries = 64>

const char* crashpad::TSimpleStringDictionary< KeySize, ValueSize, NumEntries >::GetValueForKey | ( | base::StringPiece | key | ) | const

inline

Given key, returns its corresponding value.

Parameters

  [in] | key | The key to look up. This must not be `nullptr`, nor an empty string. It must not contain embedded `NUL`s.

Returns
  The corresponding value for key, or if key is not found, `nullptr`.

## RemoveKey()

template<size_t KeySize = 256, size_t ValueSize = 256, size_t NumEntries = 64>

void crashpad::TSimpleStringDictionary< KeySize, ValueSize, NumEntries >::RemoveKey | ( | base::StringPiece | key | ) |

inline

Removes key from the map.

If key is not found, this is a no-op.

Parameters

  [in] | key | The key of the entry to remove. This must not be `nullptr`, nor an empty string. It must not contain embedded `NUL`s.

## SetKeyValue()

template<size_t KeySize = 256, size_t ValueSize = 256, size_t NumEntries = 64>

void crashpad::TSimpleStringDictionary< KeySize, ValueSize, NumEntries >::SetKeyValue | ( | base::StringPiece | key,
|  | base::StringPiece | value
| ) |  |

inline

Stores value into key, replacing the existing value if key is already present.

If key is not yet in the map and the map is already full (containing NumEntries active entries), this operation silently fails.

Parameters

  [in] | key | The key to store. This must not be `nullptr`, nor an empty string. It must not contain embedded `NUL`s.
  [in] | value | The value to store. If `nullptr`, key is removed from the map. Must not contain embedded `NUL`s.

The documentation for this class was generated from the following file:

- client/simple_string_dictionary.h