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)
 
TSimpleStringDictionaryoperator= (const TSimpleStringDictionary &other)
 
 TSimpleStringDictionary (const SerializedSimpleStringDictionary *map, size_t size)
 Constructs a map from its serialized form. map should be the out parameter from Serialize(), and size should be its return value.
 
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...
 
size_t Serialize (const SerializedSimpleStringDictionary **map) const
 Returns a serialized form of 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

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]keyThe key to look up. This must not be nullptr.
Returns
The corresponding value for key, or if key is not found, nullptr.
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]keyThe key of the entry to remove. This must not be nullptr.
template<size_t KeySize = 256, size_t ValueSize = 256, size_t NumEntries = 64>
size_t crashpad::TSimpleStringDictionary< KeySize, ValueSize, NumEntries >::Serialize ( const SerializedSimpleStringDictionary **  map) const
inline

Returns a serialized form of the map.

Places a serialized version of the map into map and returns the size in bytes. Both map and the size should be passed to the deserializing constructor. Note that the serialized map is scoped to the lifetime of the non-serialized instance of this class. The map data can be copied across IPC boundaries.

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]keyThe key to store. This must not be nullptr.
[in]valueThe value to store. If nullptr, key is removed from the map.

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