|
Medical Imaging Interaction Toolkit
2026.06.00
Medical Imaging Interaction Toolkit
|
Simple INI-style configuration file reader. More...
#include <mitkConfigFileReader.h>

Public Member Functions | |
| ConfigFileReader (std::string const &configFile) | |
| Construct a ConfigFileReader and immediately parse the given file. More... | |
| void | ReadFile (std::string const &filePath) |
| Read and parse a configuration file from disk. More... | |
| void | ReadStream (std::istream &stream) |
| Parse configuration data from an input stream. More... | |
| std::string | Value (std::string const §ion, std::string const &entry) const |
| Retrieve a string value from the configuration. More... | |
| std::string | Value (const std::string §ion, const std::string &entry, const std::string &standard) |
| Retrieve a string value, returning a default if the entry does not exist. More... | |
| int | IntValue (const std::string §ion, const std::string &entry) const |
| Retrieve an integer value from the configuration. More... | |
| int | IntValue (const std::string §ion, const std::string &entry, int standard) |
| Retrieve an integer value, returning a default if the entry does not exist. More... | |
| std::vector< std::string > | Vector (std::string const §ion, unsigned int index) const |
| Retrieve a list block's content lines by section name and index. More... | |
| unsigned int | ListSize (std::string const §ion) const |
| Get the number of list blocks with the given section name. More... | |
| unsigned int | ListSize (std::string const §ion, unsigned int standard) |
| Get the number of list blocks, returning a default if none exist. More... | |
Protected Types | |
| typedef std::map< std::string, std::string > | ContentType |
| typedef std::map< std::string, std::vector< std::string > > | ListContentType |
Protected Member Functions | |
| std::string | Trim (std::string const &source, char const *delim=" \t\r\n") |
| std::string | RemoveComment (std::string const &source, char const *delim="#;") |
| std::string | ListIndex (std::string const §ion, unsigned int index) const |
| std::string | ContentIndex (std::string const §ion, std::string const &entry) const |
| std::string | ListSizeIndex (std::string const §ion) const |
Protected Attributes | |
| ContentType | m_ConfigContent |
| ListContentType | m_ListContent |
| std::map< std::string, unsigned int > | m_ListSize |
Simple INI-style configuration file reader.
Reads configuration files that contain sections enclosed in square brackets, key=value pairs within those sections, and list blocks enclosed in curly braces. Comments beginning with '#' are stripped. Lookups are case-insensitive.
Example file format:
Definition at line 42 of file mitkConfigFileReader.h.
|
protected |
Definition at line 47 of file mitkConfigFileReader.h.
|
protected |
Definition at line 48 of file mitkConfigFileReader.h.
|
inline |
Construct a ConfigFileReader and immediately parse the given file.
| [in] | configFile | Path to the configuration file to read. |
Definition at line 108 of file mitkConfigFileReader.h.
References ReadFile().
|
inlineprotected |
Definition at line 86 of file mitkConfigFileReader.h.
Referenced by IntValue(), ReadStream(), and Value().
|
inline |
Retrieve an integer value from the configuration.
| [in] | section | The section name. |
| [in] | entry | The key name within the section. |
| std::string | If the entry does not exist. |
Definition at line 219 of file mitkConfigFileReader.h.
References Value().
Referenced by IntValue().
|
inline |
Retrieve an integer value, returning a default if the entry does not exist.
| [in] | section | The section name. |
| [in] | entry | The key name within the section. |
| [in] | standard | Default value to return and store if the entry is missing. |
Definition at line 235 of file mitkConfigFileReader.h.
References ContentIndex(), IntValue(), and m_ConfigContent.
|
inlineprotected |
Definition at line 77 of file mitkConfigFileReader.h.
Referenced by ReadStream(), and Vector().
|
inline |
Get the number of list blocks with the given section name.
| [in] | section | The list section name. |
| std::string | If no list blocks with the given section exist. |
Definition at line 273 of file mitkConfigFileReader.h.
References ListSizeIndex(), and m_ListSize.
Referenced by ListSize(), and ReadStream().
|
inline |
Get the number of list blocks, returning a default if none exist.
| [in] | section | The list section name. |
| [in] | standard | Default count to return and store if no blocks exist. |
Definition at line 289 of file mitkConfigFileReader.h.
References ListSize(), ListSizeIndex(), and m_ListSize.
|
inlineprotected |
Definition at line 94 of file mitkConfigFileReader.h.
Referenced by ListSize(), and ReadStream().
|
inline |
Read and parse a configuration file from disk.
| [in] | filePath | Path to the configuration file. |
Definition at line 118 of file mitkConfigFileReader.h.
References ReadStream().
Referenced by ConfigFileReader().
|
inline |
Parse configuration data from an input stream.
Processes sections ([...]), list blocks ({...}), and key=value pairs. Comments starting with '#' are removed.
| [in] | stream | The input stream to read from. |
Definition at line 133 of file mitkConfigFileReader.h.
References ContentIndex(), ListIndex(), ListSize(), ListSizeIndex(), m_ConfigContent, m_ListContent, m_ListSize, RemoveComment(), and Trim().
Referenced by ReadFile().
|
inlineprotected |
Definition at line 68 of file mitkConfigFileReader.h.
References Trim().
Referenced by ReadStream().
|
inlineprotected |
Definition at line 54 of file mitkConfigFileReader.h.
Referenced by ReadStream(), and RemoveComment().
|
inline |
Retrieve a string value, returning a default if the entry does not exist.
| [in] | section | The section name. |
| [in] | entry | The key name within the section. |
| [in] | standard | Default value to return and store if the entry is missing. |
Definition at line 199 of file mitkConfigFileReader.h.
References ContentIndex(), m_ConfigContent, and Value().
|
inline |
Retrieve a string value from the configuration.
| [in] | section | The section name. |
| [in] | entry | The key name within the section. |
| std::string | If the entry does not exist. |
Definition at line 182 of file mitkConfigFileReader.h.
References ContentIndex(), and m_ConfigContent.
Referenced by IntValue(), and Value().
|
inline |
Retrieve a list block's content lines by section name and index.
| [in] | section | The list section name. |
| [in] | index | Zero-based index of the list block (multiple blocks with the same name are indexed sequentially). |
| std::string | If the entry does not exist. |
Definition at line 257 of file mitkConfigFileReader.h.
References ListIndex(), and m_ListContent.
|
protected |
Definition at line 50 of file mitkConfigFileReader.h.
Referenced by IntValue(), ReadStream(), and Value().
|
protected |
Definition at line 51 of file mitkConfigFileReader.h.
Referenced by ReadStream(), and Vector().
|
protected |
Definition at line 52 of file mitkConfigFileReader.h.
Referenced by ListSize(), and ReadStream().