libcdoc 0.5.0
libcdoc::Configuration Struct Reference

A configuration provider. More...

#include <Configuration.h>

Inherited by libcdoc::JSONConfiguration.

Public Member Functions

 Configuration ()=default
 
virtual ~Configuration () noexcept=default
 
 Configuration (const Configuration &)=delete
 
Configurationoperator= (const Configuration &)=delete
 
 CDOC_DISABLE_MOVE (Configuration)
 
virtual std::string getValue (std::string_view domain, std::string_view param) const
 get a value of configuration parameter
 
std::string getValue (std::string_view param) const
 get a value of configuration parameter from the default domain
 
bool getBoolean (std::string_view param, bool def_val=false) const
 get boolean value of configuration parameter from the default domain
 
int getInt (std::string_view param, int def_val=0) const
 get integer value of configuration parameter from the default domain
 

Static Public Attributes

static constexpr char const * KEYSERVER_SEND_URL = "KEYSERVER_SEND_URL"
 Send URL of keyserver (Domain is server id)
 
static constexpr char const * KEYSERVER_FETCH_URL = "KEYSERVER_FETCH_URL"
 Fetch URL of keyserver (Domain is server id)
 

Detailed Description

A configuration provider.

Subclasses can implement different configuration systems (registry, .ini files etc.) by overriding getValue.

Constructor & Destructor Documentation

◆ Configuration() [1/2]

libcdoc::Configuration::Configuration ( )
default

◆ ~Configuration()

virtual libcdoc::Configuration::~Configuration ( )
virtualdefaultnoexcept

◆ Configuration() [2/2]

libcdoc::Configuration::Configuration ( const Configuration )
delete

Member Function Documentation

◆ CDOC_DISABLE_MOVE()

libcdoc::Configuration::CDOC_DISABLE_MOVE ( Configuration  )

◆ getBoolean()

bool libcdoc::Configuration::getBoolean ( std::string_view  param,
bool  def_val = false 
) const

get boolean value of configuration parameter from the default domain

Parameters
paramthe parameter name
def_valthe default value to return if parameter is not set
Returns
the parameter value

◆ getInt()

int libcdoc::Configuration::getInt ( std::string_view  param,
int  def_val = 0 
) const

get integer value of configuration parameter from the default domain

Parameters
paramthe parameter name
def_valthe default value to return if parameter is not set
Returns
the key value

◆ getValue() [1/2]

virtual std::string libcdoc::Configuration::getValue ( std::string_view  domain,
std::string_view  param 
) const
inlinevirtual

get a value of configuration parameter

Get a string value of configuration parameter.

Parameters
domainthe parameter domain. For keyservers this is the server ID.
paramthe parameter name.
Returns
a string value or empty string if parameter is not defined.

Reimplemented in libcdoc::JSONConfiguration.

◆ getValue() [2/2]

std::string libcdoc::Configuration::getValue ( std::string_view  param) const
inline

get a value of configuration parameter from the default domain

Parameters
paramthe parameter name.
Returns
a string value or empty string if parameter is not defined.

References getValue().

Referenced by getValue().

◆ operator=()

Configuration & libcdoc::Configuration::operator= ( const Configuration )
delete

Member Data Documentation

◆ KEYSERVER_FETCH_URL

constexpr char const* libcdoc::Configuration::KEYSERVER_FETCH_URL = "KEYSERVER_FETCH_URL"
staticconstexpr

Fetch URL of keyserver (Domain is server id)

◆ KEYSERVER_SEND_URL

constexpr char const* libcdoc::Configuration::KEYSERVER_SEND_URL = "KEYSERVER_SEND_URL"
staticconstexpr

Send URL of keyserver (Domain is server id)


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