TSDuck v3.46-4964
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
ts::ConfigSection Class Reference

#include <tsConfigSection.h>

Public Member Functions

 ConfigSection ()=default
void append (const UString &entry, bool val)
template<typename INT>
requires std::integral<INT>
void append (const UString &entry, const INT &val)
void append (const UString &entry, const std::vector< bool > &val)
template<typename INT>
requires std::integral<INT>
void append (const UString &entry, const std::vector< INT > &val)
void append (const UString &entry, const UChar *val)
void append (const UString &entry, const UString &val)
void append (const UString &entry, const UStringVector &val)
bool boolValue (const UString &entry, size_t index=0, bool defvalue=false) const
void clear ()
void deleteEntry (const UString &entry)
void getEntryNames (UStringVector &names) const
std::ostream & save (std::ostream &strm) const
void set (const UString &entry, bool val)
template<typename INT>
requires std::integral<INT>
void set (const UString &entry, const INT &val)
void set (const UString &entry, const std::vector< bool > &val)
template<typename INT>
requires std::integral<INT>
void set (const UString &entry, const std::vector< INT > &val)
void set (const UString &entry, const UChar *val)
void set (const UString &entry, const UString &val)
void set (const UString &entry, const UStringVector &val)
size_t size () const
template<typename INT>
requires std::integral<INT>
INT value (const UString &entry, size_t index=0, const INT &defvalue=static_cast< INT >(0)) const
UString value (const UString &entry, size_t index=0, const UString &defvalue=UString()) const
size_t valueCount (const UString &entry) const

Detailed Description

Representation of a "configuration section".

A configuration section contains a list of "entries". Each entry has one or more values. A value can be interpreted as a string, integer or boolean.

Constructor & Destructor Documentation

◆ ConfigSection()

ts::ConfigSection::ConfigSection ( )
default

Constructor.

Member Function Documentation

◆ clear()

void ts::ConfigSection::clear ( )
inline

Clear content of the section

◆ size()

size_t ts::ConfigSection::size ( ) const
inline

Get the number of entries in the section.

Returns
The number of entries in the section.

◆ getEntryNames()

void ts::ConfigSection::getEntryNames ( UStringVector & names) const

Get the names of all entries in the section.

Parameters
[out]namesThe returned names of all entries in the section.

◆ valueCount()

size_t ts::ConfigSection::valueCount ( const UString & entry) const

Get the number of values in an entry.

Parameters
[in]entryEntry name.
Returns
The number of values in entry or 0 if the entry does not exist.

◆ value() [1/2]

UString ts::ConfigSection::value ( const UString & entry,
size_t index = 0,
const UString & defvalue = UString() ) const

Get a value in an entry.

Parameters
[in]entryEntry name.
[in]indexIndex of the value in the entry.
[in]defvalueDefault value.
Returns
The value in the entry or defvalue if entry does not exist, or if index is out of range

◆ value() [2/2]

template<typename INT>
requires std::integral<INT>
INT ts::ConfigSection::value ( const UString & entry,
size_t index = 0,
const INT & defvalue = static_cast<INT>(0) ) const

Get an integer value in an entry.

Template Parameters
INTAn integer type.
Parameters
[in]entryEntry name.
[in]indexIndex of the value in the entry.
[in]defvalueDefault value.
Returns
The value in the entry or defvalue if entry does not exist, or if index is out of range.

◆ boolValue()

bool ts::ConfigSection::boolValue ( const UString & entry,
size_t index = 0,
bool defvalue = false ) const

Get a boolean value in an entry.

Parameters
[in]entryEntry name.
[in]indexIndex of the value in the entry.
[in]defvalueDefault value.
Returns
The value in the entry or defvalue if entry does not exist, or if index is out of range, or if the value cannot be interpreted as a boolean. Valid boolean representations are "true" / "yes" / "1" and "false" / "no" / "0".

◆ deleteEntry()

void ts::ConfigSection::deleteEntry ( const UString & entry)
inline

Delete an entry

Parameters
[in]entryEntry name.

◆ set() [1/7]

void ts::ConfigSection::set ( const UString & entry,
const UString & val )

Set the string value of an entry.

Parameters
[in]entryEntry name.
[in]valThe value to set.

◆ set() [2/7]

void ts::ConfigSection::set ( const UString & entry,
const UChar * val )
inline

Set the string value of an entry.

Parameters
[in]entryEntry name.
[in]valThe value to set.

◆ set() [3/7]

void ts::ConfigSection::set ( const UString & entry,
const UStringVector & val )

Set the value of an entry from a vector of strings.

Parameters
[in]entryEntry name.
[in]valThe values to set.

◆ set() [4/7]

void ts::ConfigSection::set ( const UString & entry,
bool val )

Set the boolean value of an entry.

Parameters
[in]entryEntry name.
[in]valThe value to set.

◆ set() [5/7]

void ts::ConfigSection::set ( const UString & entry,
const std::vector< bool > & val )

Set the value of an entry from a vector of booleans.

Parameters
[in]entryEntry name.
[in]valThe values to set.

◆ set() [6/7]

template<typename INT>
requires std::integral<INT>
void ts::ConfigSection::set ( const UString & entry,
const INT & val )
inline

Set the integer value of an entry.

Template Parameters
INTAn integer type.
Parameters
[in]entryEntry name.
[in]valThe value to set.

◆ set() [7/7]

template<typename INT>
requires std::integral<INT>
void ts::ConfigSection::set ( const UString & entry,
const std::vector< INT > & val )

Set the value of an entry from a vector of integers.

Template Parameters
INTAn integer type.
Parameters
[in]entryEntry name.
[in]valThe values to set.

◆ append() [1/7]

void ts::ConfigSection::append ( const UString & entry,
const UString & val )

Append a string value to an entry.

Parameters
[in]entryEntry name.
[in]valThe value to set.

◆ append() [2/7]

void ts::ConfigSection::append ( const UString & entry,
const UChar * val )
inline

Append a string value to an entry.

Parameters
[in]entryEntry name.
[in]valThe value to set.

◆ append() [3/7]

void ts::ConfigSection::append ( const UString & entry,
const UStringVector & val )

Append a vector of strings to an entry.

Parameters
[in]entryEntry name.
[in]valThe values to append.

◆ append() [4/7]

void ts::ConfigSection::append ( const UString & entry,
bool val )

Append a boolean value to an entry.

Parameters
[in]entryEntry name.
[in]valThe value to append.

◆ append() [5/7]

void ts::ConfigSection::append ( const UString & entry,
const std::vector< bool > & val )

Append a vector of booleans to an entry.

Parameters
[in]entryEntry name.
[in]valThe values to append.

◆ append() [6/7]

template<typename INT>
requires std::integral<INT>
void ts::ConfigSection::append ( const UString & entry,
const INT & val )

Append an integer value to an entry.

Template Parameters
INTAn integer type.
Parameters
[in]entryEntry name.
[in]valThe value to append.

◆ append() [7/7]

template<typename INT>
requires std::integral<INT>
void ts::ConfigSection::append ( const UString & entry,
const std::vector< INT > & val )

Append a vector of integers to an entry.

Template Parameters
INTAn integer type.
Parameters
[in]entryEntry name.
[in]valThe values to append.

◆ save()

std::ostream & ts::ConfigSection::save ( std::ostream & strm) const

Save the content of the section in a text streams.

Parameters
[in,out]strmAn standard stream in output mode.
Returns
A reference to the strm object.

The documentation for this class was generated from the following file: