Guillaume 1.0.0
Guillaume.
Loading...
Searching...
No Matches
Properties Class Reference

Manages immutable component properties. More...

#include <properties.hpp>

Public Member Functions

 Properties (void)
 Default constructor for empty properties.
 
 Properties (const std::map< std::string, std::any > &attributes)
 Construct properties from a map of attributes.
 
template<typename T >
get (const std::string &key) const
 Get a property value by key with type casting.
 
bool has (const std::string &key) const
 Check if a property key exists.
 
const std::map< std::string, std::any > & getAttributes (void) const
 Get all property attributes.
 

Detailed Description

Manages immutable component properties.

The Properties class provides read-only access to component configuration data passed from parent components. Properties cannot be modified after construction.

Constructor & Destructor Documentation

◆ Properties()

Properties::Properties ( const std::map< std::string, std::any > &  attributes)
inline

Construct properties from a map of attributes.

Parameters
attributesMap of key-value pairs to store as properties

Member Function Documentation

◆ get()

template<typename T >
T Properties::get ( const std::string &  key) const
inline

Get a property value by key with type casting.

Template Parameters
TThe type to cast the value to
Parameters
keyThe key to retrieve
Returns
The value cast to type T, or default-constructed T if key doesn't exist

◆ getAttributes()

const std::map< std::string, std::any > & Properties::getAttributes ( void  ) const
inline

Get all property attributes.

Returns
Const reference to the map containing all property key-value pairs

◆ has()

bool Properties::has ( const std::string &  key) const
inline

Check if a property key exists.

Parameters
keyThe key to check
Returns
true if the key exists, false otherwise

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