A singleton which contains the TSDuck configuration file.
More...
#include <tsDuckConfigFile.h>
A singleton which contains the TSDuck configuration file.
◆ FileStyle
System-specific style of default configuration file name.
Enumerator |
---|
LOCAL_SYSTEM | Same as local operating system.
|
UNIX_STYLE | $HOME/.appname
|
WINDOWS_STYLE | appname.ini in same directory as executable
|
◆ Instance()
Get the instance of the singleton of this class.
- Returns
- The instance of the singleton of this class.
◆ value()
Get the value of an entry.
A section with the name of the executable is searched first. Then, the global section is used.
- Parameters
-
[in] | entry | Entry name. |
[in] | defvalue | Default value. |
- Returns
- The value in the entry or defvalue if entry does not exist.
◆ getValues()
Get all values of an entry.
A section with the name of the executable is searched first. Then, the global section is used.
- Parameters
-
[in] | entry | Entry name. |
[out] | values | Vector of values. |
◆ DefaultFileName()
Get the default configuration file name.
- Parameters
-
[in] | style | System style for file name. |
[in] | app_name | Application name (default: executable base name). |
- Returns
- The default configuration file name for the application.
◆ fileName()
fs::path ts::ConfigFile::fileName |
( |
| ) |
const |
|
inlineinherited |
Get the latest loaded file.
- Returns
- The name of the latest loaded file.
◆ load()
Reload the configuration from a file.
- Parameters
-
[in] | filename | A file name to read. |
[in,out] | report | Where to report errors. |
- Returns
- True on success, false on error.
◆ merge() [1/2]
Merge the configuration from a file.
The values which are read from the specified file override previous values.
- Parameters
-
[in] | filename | A file name to read. |
[in,out] | report | Where to report errors. |
- Returns
- True on success, false on error.
◆ merge() [2/2]
void ts::ConfigFile::merge |
( |
std::istream & |
strm | ) |
|
|
inherited |
Merge the configuration from a file.
The values which are read from the specified file override previous values.
- Parameters
-
[in,out] | strm | Opened input text stream to read the configuration file. |
◆ save() [1/2]
Save a configuration file.
- Parameters
-
[in] | filename | A file name to write. If no file name is specified, use the file name from constructor or last load() or merge(). |
[in,out] | report | Where to report errors. |
- Returns
- True on success, false on error.
◆ save() [2/2]
std::ostream & ts::ConfigFile::save |
( |
std::ostream & |
strm | ) |
const |
|
inherited |
Save a configuration file in a stream.
- Parameters
-
[in,out] | strm | Opened output text stream to write the configuration file. |
- Returns
- A reference to strm.
◆ sectionCount()
size_t ts::ConfigFile::sectionCount |
( |
| ) |
const |
|
inlineinherited |
Get the number of sections in the file.
- Returns
- The number of sections in the file.
◆ getSectionNames()
void ts::ConfigFile::getSectionNames |
( |
UStringVector & |
names | ) |
const |
|
inherited |
Get the names of all sections.
- Parameters
-
[out] | names | Returned names of all sections. |
◆ section() [1/2]
Get a reference to a section inside the configuration file instance.
Create the section if it does not exist.
- Parameters
-
[in] | name | The section name. |
- Returns
- A reference to the section.
◆ section() [2/2]
Get a reference to a section inside the configuration file instance.
Create the section if it does not exist.
- Parameters
-
[in] | name | The section name. |
- Returns
- A read-only reference to the section.
◆ operator[]() [1/2]
Index operator: get a reference to a section inside the configuration file instance.
Create the section if it does not exist.
- Parameters
-
[in] | name | The section name. |
- Returns
- A reference to the section.
◆ operator[]() [2/2]
Index operator: get a reference to a section inside the configuration file instance.
Create the section if it does not exist.
- Parameters
-
[in] | name | The section name. |
- Returns
- A read-only reference to the section.
◆ deleteSection()
void ts::ConfigFile::deleteSection |
( |
const UString & |
name | ) |
|
|
inlineinherited |
Delete a section.
- Parameters
-
[in] | name | The section name to delete. |
The documentation for this class was generated from the following file: