$mermaidjs
CLI11 2.7.2
C++11 Command Line Interface Parser
Loading...
Searching...
No Matches
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:
CLI::Config CLI::ConfigINI

Public Member Functions

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

Protected Attributes

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

Detailed Description

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

Member Function Documentation

◆ from_config()

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

Convert a configuration into an app.

Implements CLI::Config.

◆ to_config() [1/2]

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

Convert an app into a configuration.

Implements CLI::Config.

◆ to_config() [2/2]

CLI11_INLINE std::string CLI::ConfigBase::to_config ( const App * app,
ConfigOutputMode mode,
bool write_description,
std::string prefix ) const
overridevirtual

Convert an app into a configuration.

Reimplemented from CLI::Config.


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