A singleton which contains the TSDuck configuration file. More...
Public Types | |
enum | FileStyle { LOCAL_SYSTEM, UNIX_STYLE, WINDOWS_STYLE } |
System-specific style of default configuration file name. More... | |
Public Member Functions | |
void | deleteSection (const UString &name) |
Delete a section. More... | |
UString | fileName () const |
Get the latest loaded file. More... | |
void | getSectionNames (UStringVector &names) const |
Get the names of all sections. More... | |
void | getValues (const UString &entry, UStringVector &values) const |
Get all values of an entry. More... | |
bool | load (const UString &filename, Report &report=(*(static_cast< ts::Report * >(ts::CerrReport::Instance())))) |
Reload the configuration from a file. More... | |
bool | merge (const UString &filename, Report &report=(*(static_cast< ts::Report * >(ts::CerrReport::Instance())))) |
Merge the configuration from a file. More... | |
void | merge (std::istream &strm) |
Merge the configuration from a file. More... | |
ConfigSection & | operator[] (const UString &name) |
Index operator: get a reference to a section inside the configuration file instance. More... | |
const ConfigSection & | operator[] (const UString &name) const |
Index operator: get a reference to a section inside the configuration file instance. More... | |
void | reset () |
Reset the content of the configuration. | |
bool | save (const UString &filename=UString(), Report &report=(*(static_cast< ts::Report * >(ts::CerrReport::Instance())))) const |
Save a configuration file. More... | |
std::ostream & | save (std::ostream &strm) const |
Save a configuration file in a stream. More... | |
ConfigSection & | section (const UString &name) |
Get a reference to a section inside the configuration file instance. More... | |
const ConfigSection & | section (const UString &name) const |
Get a reference to a section inside the configuration file instance. More... | |
size_t | sectionCount () const |
Get the number of sections in the file. More... | |
UString | value (const UString &entry, const UString &defvalue=UString()) const |
Get the value of an entry. More... | |
Static Public Member Functions | |
static UString | DefaultFileName (FileStyle style=LOCAL_SYSTEM, const UString &name=UString()) |
Get the default configuration file name. More... | |
static DuckConfigFile * | Instance () |
Get the instance of the singleton of this class. More... | |
A singleton which contains the TSDuck configuration file.
|
inherited |
|
static |
Get the instance of the singleton of this class.
UString ts::DuckConfigFile::value | ( | const UString & | entry, |
const UString & | defvalue = UString() |
||
) | const |
Get the value of an entry.
A section with the name of the executable is searched first. Then, the global section is used.
[in] | entry | Entry name. |
[in] | defvalue | Default value. |
void ts::DuckConfigFile::getValues | ( | const UString & | entry, |
UStringVector & | values | ||
) | const |
Get all values of an entry.
A section with the name of the executable is searched first. Then, the global section is used.
[in] | entry | Entry name. |
[out] | values | Vector of values. |
|
staticinherited |
Get the default configuration file name.
[in] | style | System style for file name. |
[in] | name | Application name (default: executable base name). |
|
inlineinherited |
Get the latest loaded file.
|
inherited |
Reload the configuration from a file.
[in] | filename | A file name to read. |
[in,out] | report | Where to report errors. |
|
inherited |
Merge the configuration from a file.
The values which are read from the specified file override previous values.
[in] | filename | A file name to read. |
[in,out] | report | Where to report errors. |
|
inherited |
Merge the configuration from a file.
The values which are read from the specified file override previous values.
[in,out] | strm | Opened input text stream to read the configuration file. |
|
inherited |
|
inherited |
Save a configuration file in a stream.
[in,out] | strm | Opened output text stream to write the configuration file. |
|
inlineinherited |
Get the number of sections in the file.
|
inherited |
Get the names of all sections.
[out] | names | Returned names of all sections. |
|
inlineinherited |
Get a reference to a section inside the configuration file instance.
Create the section if it does not exist.
[in] | name | The section name. |
|
inherited |
Get a reference to a section inside the configuration file instance.
Create the section if it does not exist.
[in] | name | The section name. |
|
inlineinherited |
Index operator: get a reference to a section inside the configuration file instance.
Create the section if it does not exist.
[in] | name | The section name. |
|
inlineinherited |
Index operator: get a reference to a section inside the configuration file instance.
Create the section if it does not exist.
[in] | name | The section name. |
|
inlineinherited |
Delete a section.
[in] | name | The section name to delete. |