Reader class for CSV files.
More...
#include <reader.hpp>
|
| std::unique_ptr< ConfigBase > | read (CLI::App *app, bool verbose) override |
| | Method to read the configuration from the CSV file.
|
| |
| virtual | ~ReaderBase ()=default |
| | Virtual destructor for ReaderBase.
|
| |
|
| std::vector< std::string > | splitCsvLine (const std::string &line) const |
| | Helper method to split a CSV line into individual fields.
|
| |
|
| 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.
|
| |
Reader class for CSV files.
This class extends ReaderBase and implements reading configuration data from CSV files.
◆ read()
| std::unique_ptr< ConfigBase > ReaderCSV::read |
( |
CLI::App * |
app, |
|
|
bool |
verbose |
|
) |
| |
|
overridevirtual |
Method to read the configuration from the CSV file.
- Parameters
-
| app | The CLI app subcommand containing the options for the CSV input. |
- Returns
- A unique pointer to a ConfigBase object representing the read configuration.
Implements ReaderBase.
◆ splitCsvLine()
| std::vector< std::string > ReaderCSV::splitCsvLine |
( |
const std::string & |
line | ) |
const |
|
private |
Helper method to split a CSV line into individual fields.
- Parameters
-
- Returns
- A vector of strings representing the individual fields.
◆ ReaderCSVTester
Friend test fixture class for unit testing.
The documentation for this class was generated from the following files: