Base class for Reader classes.
More...
#include <reader.hpp>
|
| virtual | ~ReaderBase ()=default |
| | Virtual destructor for ReaderBase.
|
| |
| virtual std::unique_ptr< ConfigBase > | read (CLI::App *app, bool verbose)=0 |
| | Read the configuration from the input.
|
| |
|
| std::string | filename |
| | The input filename to read from.
|
| |
| char | sep |
| | Field separator character.
|
| |
| char | quote |
| | Quote/delimiter character.
|
| |
|
| static std::string | trim (const std::string &untrimmed_str) |
| | Helper static method to trim leading and trailing whitespace from a string.
|
| |
| static bool | parseBool (const std::string &bool_str, bool &out) |
| | Helper static method to parse a boolean value from a string.
|
| |
| static bool | parseDouble (const std::string &double_str, double &out) |
| | Helper static method to parse a double value from a string.
|
| |
| static bool | parseInt (const std::string &int_str, int &out) |
| | Helper static method to parse an integer value from a string.
|
| |
| static bool | parseMethod (const std::string &method_str, Method &out) |
| | Helper static method to parse a Method enum value from a string.
|
| |
| static std::unique_ptr< ConfigBase > | make_config_from_map (const std::unordered_map< std::string, std::string > &config_map) |
| | Helper static method to create a ConfigBase object from a map of string key-value pairs.
|
| |
Base class for Reader classes.
This abstract base class defines the interface for Reader classes that read configuration data from various file formats (e.g., CSV, DAT) and produce ConfigBase objects.
◆ ~ReaderBase()
| virtual ReaderBase::~ReaderBase |
( |
| ) |
|
|
virtualdefault |
◆ make_config_from_map()
| std::unique_ptr< ConfigBase > ReaderBase::make_config_from_map |
( |
const std::unordered_map< std::string, std::string > & |
config_map | ) |
|
|
staticprotected |
Helper static method to create a ConfigBase object from a map of string key-value pairs.
- Parameters
-
| config_map | The map containing configuration key-value pairs. |
- Returns
- A unique pointer to a ConfigBase object representing the configuration.
◆ parseBool()
| bool ReaderBase::parseBool |
( |
const std::string & |
bool_str, |
|
|
bool & |
out |
|
) |
| |
|
staticprotected |
Helper static method to parse a boolean value from a string.
- Parameters
-
| bool_str | The input string representing a boolean value. |
| out | A reference to store the parsed boolean value. |
- Returns
- true if parsing was successful, false otherwise.
◆ parseDouble()
| bool ReaderBase::parseDouble |
( |
const std::string & |
double_str, |
|
|
double & |
out |
|
) |
| |
|
staticprotected |
Helper static method to parse a double value from a string.
- Parameters
-
| double_str | The input string representing a double value. |
| out | A reference to store the parsed double value. |
- Returns
- true if parsing was successful, false otherwise.
◆ parseInt()
| bool ReaderBase::parseInt |
( |
const std::string & |
int_str, |
|
|
int & |
out |
|
) |
| |
|
staticprotected |
Helper static method to parse an integer value from a string.
- Parameters
-
| int_str | The input string representing an integer value. |
| out | A reference to store the parsed integer value. |
- Returns
- true if parsing was successful, false otherwise.
◆ parseMethod()
| bool ReaderBase::parseMethod |
( |
const std::string & |
method_str, |
|
|
Method & |
out |
|
) |
| |
|
staticprotected |
Helper static method to parse a Method enum value from a string.
- Parameters
-
| method_str | The input string representing a Method. |
| out | A reference to store the parsed Method value. |
- Returns
- true if parsing was successful, false otherwise.
◆ read()
| virtual std::unique_ptr< ConfigBase > ReaderBase::read |
( |
CLI::App * |
app, |
|
|
bool |
verbose |
|
) |
| |
|
pure virtual |
Read the configuration from the input.
- Parameters
-
| app | The CLI app subcommand containing the options for a specific input type. |
- Returns
- A unique pointer to a ConfigBase object representing the read configuration.
Implemented in ReaderCSV, ReaderDAT, and ReaderCLI.
◆ trim()
| std::string ReaderBase::trim |
( |
const std::string & |
untrimmed_str | ) |
|
|
staticprotected |
Helper static method to trim leading and trailing whitespace from a string.
- Parameters
-
| untrimmed_str | The input string to be trimmed. |
- Returns
- The trimmed string.
◆ ReaderBaseTester
Friend test fixture class for unit testing.
◆ filename
| std::string ReaderBase::filename |
The input filename to read from.
◆ quote
Quote/delimiter character.
◆ sep
Field separator character.
The documentation for this class was generated from the following files: