InspIRCd  3.0
Public Types | Public Member Functions | List of all members
Serializable::Data Class Reference

#include <serialize.h>

Public Types

typedef insp::flat_map< std::string, DataChildMap
 
typedef insp::flat_map< std::string, std::string > EntryMap
 

Public Member Functions

const ChildMapGetChildren () const
 
ChildMapGetChildren ()
 
const EntryMapGetEntries () const
 
EntryMapGetEntries ()
 
DataLoad (const std::string &key, Data &out)
 
DataLoad (const std::string &key, std::string &out)
 
template<typename T >
DataLoad (const std::string &key, T &out)
 
DataStore (const std::string &key, const Data &value)
 
DataStore (const std::string &key, const std::string &value)
 
template<typename T >
DataStore (const std::string &key, const T &value)
 

Detailed Description

Encapsulates a chunk of serialised data.

Member Typedef Documentation

◆ ChildMap

Maps keys to serialised data.

◆ EntryMap

typedef insp::flat_map<std::string, std::string> Serializable::Data::EntryMap

Maps keys to simple values.

Member Function Documentation

◆ GetChildren()

const ChildMap& Serializable::Data::GetChildren ( ) const
inline

Retrieves the child elements.

◆ GetEntries()

const EntryMap& Serializable::Data::GetEntries ( ) const
inline

Retrieves the key/value map.

◆ Load() [1/3]

Serializable::Data & Serializable::Data::Load ( const std::string &  key,
Serializable::Data out 
)

Loads the serialised data with the specified key.

Parameters
keyThe key by which this serialised data is identified.
outThe location to store the serialised data for this key.

◆ Load() [2/3]

Serializable::Data & Serializable::Data::Load ( const std::string &  key,
std::string &  out 
)

Loads the value with the specified key.

Parameters
keyThe key by which this data is identified.
outThe location to store the value for this keu

◆ Load() [3/3]

template<typename T >
Data& Serializable::Data::Load ( const std::string &  key,
T &  out 
)
inline

Loads the value with the specified key. The value will be converted to the specified type.

Parameters
keyThe key by which this data is identified.
outThe location to store the value for this key.

◆ Store() [1/3]

Serializable::Data & Serializable::Data::Store ( const std::string &  key,
const Data value 
)

Stores the serialised data against the specified key.

Parameters
keyThe key by which this serialised data should be stored against.
outThe serialised data to store.

◆ Store() [2/3]

Serializable::Data & Serializable::Data::Store ( const std::string &  key,
const std::string &  value 
)

Stores the value against the specified key.

Parameters
keyThe key by which this value should be stored against.
outThe value to store.

◆ Store() [3/3]

template<typename T >
Data& Serializable::Data::Store ( const std::string &  key,
const T &  value 
)
inline

Stores the value against the specified key. The value will be converted to a string using ConvToStr.

Parameters
keyThe key by which this value should be stored against.
outThe value to store.

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