|
Thrive
|
A key-value storage for serialization. More...
#include <serialization.h>
Public Member Functions | |
| StorageContainer () | |
| Constructor. | |
| StorageContainer (const StorageContainer &other) | |
| Copy-constructor. More... | |
| StorageContainer (StorageContainer &&other) | |
| Move-constructor. More... | |
| ~StorageContainer () | |
| Destructor. | |
| StorageContainer & | operator= (const StorageContainer &other) |
| Copy-assignment. More... | |
| StorageContainer & | operator= (StorageContainer &&other) |
| Move assignment. More... | |
| bool | contains (const std::string &key) const |
| Checks for a key. More... | |
| template<typename T > | |
| bool | contains (const std::string &key) const |
| Checks for a key together with type. More... | |
| template<typename T > | |
| T | get (const std::string &key, const T &defaultValue=T()) const |
| Retrieves a value from the container. More... | |
| std::list< std::string > | keys () const |
| Returns a list of all keys in this container. | |
| luabind::object | luaGet (const std::string &key, luabind::object defaultValue) const |
| Lua version of StorageContainer::get. More... | |
| template<typename T > | |
| void | set (const std::string &key, T value) |
| Sets a value in this container. More... | |
Static Public Member Functions | |
| static luabind::scope | luaBindings () |
| Lua bindings. More... | |
Friends | |
| std::ostream & | operator<< (std::ostream &stream, const StorageContainer &storage) |
| Output stream operator for StorageContainer. More... | |
| std::istream & | operator>> (std::istream &stream, StorageContainer &storage) |
| Input stream operator for StorageContainer. More... | |
A key-value storage for serialization.
| thrive::StorageContainer::StorageContainer | ( | const StorageContainer & | other | ) |
Copy-constructor.
| other |
| thrive::StorageContainer::StorageContainer | ( | StorageContainer && | other | ) |
Move-constructor.
| other |
| bool thrive::StorageContainer::contains | ( | const std::string & | key | ) | const |
Checks for a key.
| key | The key to check for |
true if the key is present in this container, false otherwise | bool thrive::StorageContainer::contains | ( | const std::string & | key | ) | const |
Checks for a key together with type.
| T | The expected type of the key's associated value |
| key | The key to check for |
true if the key is present and associated with a value of type T, false otherwise | T thrive::StorageContainer::get | ( | const std::string & | key, |
| const T & | defaultValue = T() |
||
| ) | const |
Retrieves a value from the container.
| T | The value's type |
| key | The key to retrieve |
| defaultValue | The value to return when the key is not present (or the value has the wrong type) |
|
static |
| luabind::object thrive::StorageContainer::luaGet | ( | const std::string & | key, |
| luabind::object | defaultValue | ||
| ) | const |
| StorageContainer& thrive::StorageContainer::operator= | ( | const StorageContainer & | other | ) |
Copy-assignment.
| other |
| StorageContainer& thrive::StorageContainer::operator= | ( | StorageContainer && | other | ) |
Move assignment.
| other |
| void thrive::StorageContainer::set | ( | const std::string & | key, |
| T | value | ||
| ) |
Sets a value in this container.
If key is already associated with a value, it is overwritten.
| T | The type of value |
| key | The key to associate with the value |
| value | The value to insert |
|
friend |
|
friend |
1.8.10