Clingo
Loading...
Searching...
No Matches
Clingo::Config Class Reference

Class modeling a mutable configuration entry. More...

#include <config.hh>

Inheritance diagram for Clingo::Config:
Clingo::ConstConfig

Public Member Functions

 Config (clingo_config_t *stats, ProgramId key)
 Construct from the underlying C API type and a key.
 
auto array () const -> ConfigArray
 Access the configuration entry as an array.
 
auto at (size_t index) const -> Config
 Get the configuration entry at the given index in the array.
 
auto operator[] (size_t index) const -> Config
 Get the configuration entry at the given index in the array.
 
auto map () const -> ConfigMap
 Access the configuration entry as a map.
 
auto get (std::string_view name) const -> Config
 Get the configuration entry with the given name in the map.
 
auto operator[] (std::string_view name) const -> Config
 Get the configuration entry with the given name in the map.
 
void value (std::string_view value) const
 Set the value of the configuration entry.
 
auto operator= (std::string_view value) const -> Config
 Set the value of the configuration entry.
 
auto value () const -> std::optional< std::string_view >
 Get the value of the configuration entry.
 
- Public Member Functions inherited from Clingo::ConstConfig
 ConstConfig (clingo_config_t const *stats, ProgramId key)
 Construct from the underlying C API type and a key.
 
auto type () const -> ConfigType
 Get the type of the configuration entry.
 
auto array () const -> ConstConfigArray
 Access the configuration entry as an array.
 
auto at (size_t index) const -> ConstConfig
 Get the configuration entry at the given index in the array.
 
auto operator[] (size_t index) const -> ConstConfig
 Get the configuration entry at the given index in the array.
 
auto map () const -> ConstConfigMap
 Access the configuration entry as a map.
 
auto get (std::string_view name) const -> ConstConfig
 Get the configuration entry with the given name in the map.
 
auto operator[] (std::string_view name) const -> ConstConfig
 Get the configuration entry with the given name in the map.
 
auto value () const -> std::optional< std::string_view >
 Get the value of the configuration entry.
 
auto operator* () const -> std::optional< std::string_view >
 Get the value of the configuration entry.
 
auto description () const -> std::string_view
 Get the description of the configuration entry.
 
auto to_string () const -> std::string
 Get a string representation of the configuration entry.
 

Friends

auto c_cast (Config const &stats) -> clingo_config_t *
 Cast the configuration to the underlying C API type.
 

Detailed Description

Class modeling a mutable configuration entry.

Constructor & Destructor Documentation

◆ Config()

Clingo::Config::Config ( clingo_config_t stats,
ProgramId  key 
)
inlineexplicit

Construct from the underlying C API type and a key.

Parameters
statsthe underlying C API type
keythe key of the configuration entry

Member Function Documentation

◆ operator=()

auto Clingo::Config::operator= ( std::string_view  value) const -> Config
inline

Set the value of the configuration entry.

Parameters
valuethe new value of the configuration entry
Returns
the configuration entry itself

◆ operator[]() [1/2]

auto Clingo::Config::operator[] ( size_t  index) const -> Config
inline

Get the configuration entry at the given index in the array.

Parameters
indexthe index of the configuration entry
Returns
the configuration entry at the given index

◆ operator[]() [2/2]

auto Clingo::Config::operator[] ( std::string_view  name) const -> Config
inline

Get the configuration entry with the given name in the map.

Parameters
namethe name of the configuration entry in the map
Returns
the configuration entry with the given name

◆ value() [1/2]

auto Clingo::ConstConfig::value ( ) const -> std::optional<std::string_view>
inline

Get the value of the configuration entry.

The return might be empty if no value is assigned to the configuration entry.

Returns
the value of the configuration entry

◆ value() [2/2]

void Clingo::Config::value ( std::string_view  value) const
inline

Set the value of the configuration entry.

Parameters
valuethe new value of the configuration entry

Friends And Related Symbol Documentation

◆ c_cast

auto c_cast ( Config const stats) -> clingo_config_t *
friend

Cast the configuration to the underlying C API type.

Parameters
statsthe configuration to cast
Returns
the underlying C API type

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