|
SBB Host
Host communication with the self balancing bike.
|
A class for configuration-file reading. More...
#include <IniReader.h>
Public Member Functions | |
| IniReader (const char *name) | |
| Constructor. More... | |
| ~IniReader () | |
| Desctructor. More... | |
| bool | getInt (const char *key, int *val) |
| Get integer variable. More... | |
| bool | getDouble (const char *key, double *val) |
| Get double variable. More... | |
| bool | getHex (const char *key, unsigned int *val) |
| Get an hex number. More... | |
| bool | getString (const char *key, std::string *val) |
| Get string variable. More... | |
| bool | getStringArray (const char *key, std::vector< std::string > *str_array) |
| Get a string vector. More... | |
| bool | getDoubleArray (const char *key, std::vector< double > *double_array) |
| Get a double vector. More... | |
| bool | isOpen () |
| Check if open correctly. More... | |
Private Attributes | |
| File * | p_file |
| Poinnter to the File object. More... | |
| std::string | _name |
| Name of the configuration file. More... | |
A class for configuration-file reading.
Class for reading and parsing of configuration files (e.g. with *.ini extension). File format used is the following
| IniReader::IniReader | ( | const char * | name | ) |
Constructor.
Default constructor for the file class.
| name | The name of the configuration file to use. File is not open. |
| IniReader::~IniReader | ( | ) |
Desctructor.
Default destructor.
| bool IniReader::getDouble | ( | const char * | key, |
| double * | val | ||
| ) |
Get double variable.
Function to get a double variable. The configuration file is open and closed at the end of the operation.
| key | Name of the variable. |
| val | Pointer to the double variable to store the value. |
| bool IniReader::getDoubleArray | ( | const char * | key, |
| std::vector< double > * | double_array | ||
| ) |
Get a double vector.
Function to get a vector of double. The configuration file is open and closed at the end of the operation.
| key | Name of the list. |
| double_array | Pointer to the std::vector<std::double> variable to store the values. |
| bool IniReader::getHex | ( | const char * | key, |
| unsigned int * | val | ||
| ) |
Get an hex number.
Function to get a hex number as an unsigned int variable. The configuration file is open and closed at the end of the operation.
| key | Name of the variable. |
| val | Pointer to the unsigned int variable to store the hex value. |
| bool IniReader::getInt | ( | const char * | key, |
| int * | val | ||
| ) |
Get integer variable.
Function to get an integer variable. The configuration file is open and closed at the end of the operation.
| key | Name of the variable. |
| val | Pointer to the int variable to store the value. |
| bool IniReader::getString | ( | const char * | key, |
| std::string * | val | ||
| ) |
Get string variable.
Function to get a string variable. The configuration file is open and closed at the end of the operation.
| key | Name of the variable. |
| val | Pointer to the std::string variable to store the string. |
| bool IniReader::getStringArray | ( | const char * | key, |
| std::vector< std::string > * | str_array | ||
| ) |
Get a string vector.
Function to get a vector of strings. The configuration file is open and closed at the end of the operation.
| key | Name of the list. |
| str_array | Pointer to the std::vector<std::string> variable to store the strings. |
| bool IniReader::isOpen | ( | ) |
Check if open correctly.
Function check if the file is open correctly.
|
private |
Name of the configuration file.