tetengo 1.8.1
A multipurpose library set
Loading...
Searching...
No Matches
tetengo::property::storage Class Referenceabstract

A storage. More...

#include <storage.hpp>

+ Inheritance diagram for tetengo::property::storage:
+ Collaboration diagram for tetengo::property::storage:

Public Types

using value_map_type = std::unordered_map< std::string, std::variant< bool, std::uint32_t, std::string > >
 The value map type.
 

Public Member Functions

virtual ~storage ()
 Destroys the storage.
 
std::optional< bool > get_bool (const std::filesystem::path &key) const
 Returns the value in a boolean.
 
void set_bool (const std::filesystem::path &key, bool value)
 Sets a value in a boolean.
 
std::optional< std::uint32_t > get_uint32 (const std::filesystem::path &key) const
 Returns the value in an unsigned 32-bit integer.
 
void set_uint32 (const std::filesystem::path &key, std::uint32_t value)
 Sets a value in an unsigned 32-bit integer.
 
std::optional< std::string > get_string (const std::filesystem::path &key) const
 Returns the value in a string.
 
void set_string (const std::filesystem::path &key, const std::string &value)
 Sets a value in a string.
 
void save () const
 Saves the values.
 

Protected Member Functions

 storage (value_map_type value_map)
 Creates a storage.
 
const value_map_typevalue_map () const
 Returns the value map.
 

Detailed Description

A storage.

Constructor & Destructor Documentation

◆ storage()

tetengo::property::storage::storage ( value_map_type  value_map)
explicitprotected

Creates a storage.

Parameters
value_mapA value map.

Member Function Documentation

◆ get_bool()

std::optional< bool > tetengo::property::storage::get_bool ( const std::filesystem::path &  key) const

Returns the value in a boolean.

Parameters
keyA key.
Returns
The value. Or std::nullopt when no such key.

◆ get_string()

std::optional< std::string > tetengo::property::storage::get_string ( const std::filesystem::path &  key) const

Returns the value in a string.

Parameters
keyA key.
Returns
The value. Or std::nullopt when no such key.

◆ get_uint32()

std::optional< std::uint32_t > tetengo::property::storage::get_uint32 ( const std::filesystem::path &  key) const

Returns the value in an unsigned 32-bit integer.

Parameters
keyA key.
Returns
The value. Or std::nullopt when no such key.

◆ set_bool()

void tetengo::property::storage::set_bool ( const std::filesystem::path &  key,
bool  value 
)

Sets a value in a boolean.

Parameters
keyA key.
valueA value.

◆ set_string()

void tetengo::property::storage::set_string ( const std::filesystem::path &  key,
const std::string &  value 
)

Sets a value in a string.

Parameters
keyA key.
valueA value.

◆ set_uint32()

void tetengo::property::storage::set_uint32 ( const std::filesystem::path &  key,
std::uint32_t  value 
)

Sets a value in an unsigned 32-bit integer.

Parameters
keyA key.
valueA value.

◆ value_map()

const value_map_type & tetengo::property::storage::value_map ( ) const
protected

Returns the value map.

Returns
The value map.

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