tetengo 1.8.1
A multipurpose library set
Loading...
Searching...
No Matches
tetengo::property::property_set Class Reference

A property set. More...

#include <property_set.hpp>

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

Public Member Functions

 property_set (std::unique_ptr< storage_loader > &&p_storage_loader, const std::filesystem::path &path)
 Creates a property set.
 
virtual ~property_set ()
 Destroys the property set.
 
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 update ()
 Updates the property values to the latest state in the storage.
 
void commit () const
 Commits the property value changes to the storage.
 

Detailed Description

A property set.

Constructor & Destructor Documentation

◆ property_set()

tetengo::property::property_set::property_set ( std::unique_ptr< storage_loader > &&  p_storage_loader,
const std::filesystem::path &  path 
)

Creates a property set.

Parameters
p_storage_loaderA unique pointer to a storage loader.
pathA path.

Member Function Documentation

◆ get_bool()

std::optional< bool > tetengo::property::property_set::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::property_set::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::property_set::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::property_set::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::property_set::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::property_set::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.

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