Crashpad

Classes | Public Member Functions | List of all members
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 (const char *key) const
| Given key, returns its corresponding value. More...
void | SetKeyValue (const char *key, const char *value)
| Stores value into key, replacing the existing value if key is already present. More...
void | RemoveKey (const char *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 | ( | const char * | key | ) | const
| inline

Given key, returns its corresponding value.

Parameters

  [in] | key | The key to look up. This must not be `nullptr`.

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 | ( | const char * | 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`.

## ◆ SetKeyValue()

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

void crashpad::TSimpleStringDictionary< KeySize, ValueSize, NumEntries >::SetKeyValue | ( | const char * | key,
|  | const char * | 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`.
  [in] | value | The value to store. If `nullptr`, key is removed from the map.

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

- client/simple_string_dictionary.h