CLI11  2.5.0
Public Member Functions | Protected Attributes | List of all members
CLI::ConfigBase Class Reference

This converter works with INI/TOML files; to write INI files use ConfigINI. More...

#include <ConfigFwd.hpp>

Inheritance diagram for CLI::ConfigBase:
Inheritance graph
[legend]
Collaboration diagram for CLI::ConfigBase:
Collaboration graph
[legend]

Public Member Functions

std::string to_config (const App *, bool default_also, bool write_description, std::string prefix) const override
 Convert an app into a configuration. More...
 
std::vector< ConfigItemfrom_config (std::istream &input) const override
 Convert a configuration into an app. More...
 
ConfigBasecomment (char cchar)
 Specify the configuration for comment characters. More...
 
ConfigBasearrayBounds (char aStart, char aEnd)
 Specify the start and end characters for an array. More...
 
ConfigBasearrayDelimiter (char aSep)
 Specify the delimiter character for an array. More...
 
ConfigBasevalueSeparator (char vSep)
 Specify the delimiter between a name and value. More...
 
ConfigBasequoteCharacter (char qString, char literalChar)
 Specify the quote characters used around strings and literal strings. More...
 
ConfigBasemaxLayers (uint8_t layers)
 Specify the maximum number of parents. More...
 
ConfigBaseparentSeparator (char sep)
 Specify the separator to use for parent layers. More...
 
ConfigBasecommentDefaults (bool comDef=true)
 comment default value options More...
 
std::string & sectionRef ()
 get a reference to the configuration section More...
 
CLI11_NODISCARD const std::string & section () const
 get the section More...
 
ConfigBasesection (const std::string &sectionName)
 specify a particular section of the configuration file to use More...
 
int16_t & indexRef ()
 get a reference to the configuration index More...
 
CLI11_NODISCARD int16_t index () const
 get the section index More...
 
ConfigBaseindex (int16_t sectionIndex)
 specify a particular index in the section to use (-1) for all sections to use More...
 
ConfigBaseallowDuplicateFields (bool value=true)
 specify that multiple duplicate arguments should be merged even if not sequential More...
 
- Public Member Functions inherited from CLI::Config
virtual CLI11_NODISCARD std::string to_flag (const ConfigItem &item) const
 Get a flag value. More...
 
CLI11_NODISCARD std::vector< ConfigItemfrom_file (const std::string &name) const
 Parse a config file, throw an error (ParseError:ConfigParseError or FileError) on failure. More...
 
virtual ~Config ()=default
 Virtual destructor. More...
 

Protected Attributes

char commentChar = '#'
 the character used for comments More...
 
char arrayStart = '['
 the character used to start an array '\0' is a default to not use More...
 
char arrayEnd = ']'
 the character used to end an array '\0' is a default to not use More...
 
char arraySeparator = ','
 the character used to separate elements in an array More...
 
char valueDelimiter = '='
 the character used separate the name from the value More...
 
char stringQuote = '"'
 the character to use around strings More...
 
char literalQuote = '\''
 the character to use around single characters and literal strings More...
 
uint8_t maximumLayers {255}
 the maximum number of layers to allow More...
 
char parentSeparatorChar {'.'}
 the separator used to separator parent layers More...
 
bool commentDefaultsBool = false
 comment default values More...
 
bool allowMultipleDuplicateFields {false}
 specify the config reader should collapse repeated field names to a single vector More...
 
int16_t configIndex {-1}
 Specify the configuration index to use for arrayed sections. More...
 
std::string configSection {}
 Specify the configuration section that should be used. More...
 
- Protected Attributes inherited from CLI::Config
std::vector< ConfigItemitems {}
 

Detailed Description

This converter works with INI/TOML files; to write INI files use ConfigINI.

Member Function Documentation

ConfigBase* CLI::ConfigBase::allowDuplicateFields ( bool  value = true)
inline

specify that multiple duplicate arguments should be merged even if not sequential

ConfigBase* CLI::ConfigBase::arrayBounds ( char  aStart,
char  aEnd 
)
inline

Specify the start and end characters for an array.

ConfigBase* CLI::ConfigBase::arrayDelimiter ( char  aSep)
inline

Specify the delimiter character for an array.

ConfigBase* CLI::ConfigBase::comment ( char  cchar)
inline

Specify the configuration for comment characters.

ConfigBase* CLI::ConfigBase::commentDefaults ( bool  comDef = true)
inline

comment default value options

std::vector<ConfigItem> CLI::ConfigBase::from_config ( std::istream &  ) const
overridevirtual

Convert a configuration into an app.

Implements CLI::Config.

CLI11_NODISCARD int16_t CLI::ConfigBase::index ( ) const
inline

get the section index

ConfigBase* CLI::ConfigBase::index ( int16_t  sectionIndex)
inline

specify a particular index in the section to use (-1) for all sections to use

int16_t& CLI::ConfigBase::indexRef ( )
inline

get a reference to the configuration index

ConfigBase* CLI::ConfigBase::maxLayers ( uint8_t  layers)
inline

Specify the maximum number of parents.

ConfigBase* CLI::ConfigBase::parentSeparator ( char  sep)
inline

Specify the separator to use for parent layers.

ConfigBase* CLI::ConfigBase::quoteCharacter ( char  qString,
char  literalChar 
)
inline

Specify the quote characters used around strings and literal strings.

CLI11_NODISCARD const std::string& CLI::ConfigBase::section ( ) const
inline

get the section

ConfigBase* CLI::ConfigBase::section ( const std::string &  sectionName)
inline

specify a particular section of the configuration file to use

std::string& CLI::ConfigBase::sectionRef ( )
inline

get a reference to the configuration section

std::string CLI::ConfigBase::to_config ( const App ,
bool  ,
bool  ,
std::string   
) const
overridevirtual

Convert an app into a configuration.

Implements CLI::Config.

ConfigBase* CLI::ConfigBase::valueSeparator ( char  vSep)
inline

Specify the delimiter between a name and value.

Member Data Documentation

bool CLI::ConfigBase::allowMultipleDuplicateFields {false}
protected

specify the config reader should collapse repeated field names to a single vector

char CLI::ConfigBase::arrayEnd = ']'
protected

the character used to end an array '\0' is a default to not use

char CLI::ConfigBase::arraySeparator = ','
protected

the character used to separate elements in an array

char CLI::ConfigBase::arrayStart = '['
protected

the character used to start an array '\0' is a default to not use

char CLI::ConfigBase::commentChar = '#'
protected

the character used for comments

bool CLI::ConfigBase::commentDefaultsBool = false
protected

comment default values

int16_t CLI::ConfigBase::configIndex {-1}
protected

Specify the configuration index to use for arrayed sections.

std::string CLI::ConfigBase::configSection {}
protected

Specify the configuration section that should be used.

char CLI::ConfigBase::literalQuote = '\''
protected

the character to use around single characters and literal strings

uint8_t CLI::ConfigBase::maximumLayers {255}
protected

the maximum number of layers to allow

char CLI::ConfigBase::parentSeparatorChar {'.'}
protected

the separator used to separator parent layers

char CLI::ConfigBase::stringQuote = '"'
protected

the character to use around strings

char CLI::ConfigBase::valueDelimiter = '='
protected

the character used separate the name from the value


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