Loading...
Searching...
No Matches
ConfigBase Class Reference

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

#include <CLI11.h>

+ Inheritance diagram for ConfigBase:

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.
 
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 qChar)
 Specify the quote characters used around strings and characters.
 
ConfigBase * maxLayers (uint8_t layers)
 Specify the maximum number of parents.
 
ConfigBase * parentSeparator (char sep)
 Specify the separator to use for parent layers.
 
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
 
- Public Member Functions inherited from 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 characterQuote = '\''
 the character to use around single characters
 
uint8_t maximumLayers {255}
 the maximum number of layers to allow
 
char parentSeparatorChar {'.'}
 the separator used to separator parent layers
 
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 Config
std::vector< ConfigItem > items {}
 

Detailed Description

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

Definition at line 2712 of file CLI11.h.

Member Function Documentation

◆ arrayBounds()

ConfigBase * arrayBounds ( char aStart,
char aEnd )
inline

Specify the start and end characters for an array.

Definition at line 2748 of file CLI11.h.

◆ arrayDelimiter()

ConfigBase * arrayDelimiter ( char aSep)
inline

Specify the delimiter character for an array.

Definition at line 2754 of file CLI11.h.

◆ comment()

ConfigBase * comment ( char cchar)
inline

Specify the configuration for comment characters.

Definition at line 2743 of file CLI11.h.

◆ from_config()

std::vector< ConfigItem > from_config ( std::istream & ) const
inlineoverridevirtual

Convert a configuration into an app.

Implements Config.

Definition at line 9156 of file CLI11.h.

◆ index() [1/2]

CLI11_NODISCARD int16_t index ( ) const
inline

get the section index

Definition at line 2792 of file CLI11.h.

◆ index() [2/2]

ConfigBase * index ( int16_t sectionIndex)
inline

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

Definition at line 2794 of file CLI11.h.

◆ indexRef()

int16_t & indexRef ( )
inline

get a reference to the configuration index

Definition at line 2790 of file CLI11.h.

◆ maxLayers()

ConfigBase * maxLayers ( uint8_t layers)
inline

Specify the maximum number of parents.

Definition at line 2770 of file CLI11.h.

◆ parentSeparator()

ConfigBase * parentSeparator ( char sep)
inline

Specify the separator to use for parent layers.

Definition at line 2775 of file CLI11.h.

◆ quoteCharacter()

ConfigBase * quoteCharacter ( char qString,
char qChar )
inline

Specify the quote characters used around strings and characters.

Definition at line 2764 of file CLI11.h.

◆ section() [1/2]

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

get the section

Definition at line 2782 of file CLI11.h.

◆ section() [2/2]

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

specify a particular section of the configuration file to use

Definition at line 2784 of file CLI11.h.

◆ sectionRef()

std::string & sectionRef ( )
inline

get a reference to the configuration section

Definition at line 2780 of file CLI11.h.

◆ to_config()

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

Convert an app into a configuration.

Implements Config.

Definition at line 9289 of file CLI11.h.

◆ valueSeparator()

ConfigBase * valueSeparator ( char vSep)
inline

Specify the delimiter between a name and value.

Definition at line 2759 of file CLI11.h.

Member Data Documentation

◆ arrayEnd

char arrayEnd = ']'
protected

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

Definition at line 2719 of file CLI11.h.

◆ arraySeparator

char arraySeparator = ','
protected

the character used to separate elements in an array

Definition at line 2721 of file CLI11.h.

◆ arrayStart

char arrayStart = '['
protected

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

Definition at line 2717 of file CLI11.h.

◆ characterQuote

char characterQuote = '\''
protected

the character to use around single characters

Definition at line 2727 of file CLI11.h.

◆ commentChar

char commentChar = '#'
protected

the character used for comments

Definition at line 2715 of file CLI11.h.

◆ configIndex

int16_t configIndex {-1}
protected

Specify the configuration index to use for arrayed sections.

Definition at line 2733 of file CLI11.h.

◆ configSection

std::string configSection {}
protected

Specify the configuration section that should be used.

Definition at line 2735 of file CLI11.h.

◆ maximumLayers

uint8_t maximumLayers {255}
protected

the maximum number of layers to allow

Definition at line 2729 of file CLI11.h.

◆ parentSeparatorChar

char parentSeparatorChar {'.'}
protected

the separator used to separator parent layers

Definition at line 2731 of file CLI11.h.

◆ stringQuote

char stringQuote = '"'
protected

the character to use around strings

Definition at line 2725 of file CLI11.h.

◆ valueDelimiter

char valueDelimiter = '='
protected

the character used separate the name from the value

Definition at line 2723 of file CLI11.h.


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