Representation of a ".names" file, containing names for identifiers.
More...
#include <tsNamesFile.h>
|
enum class | Predefined {
DTV = 0
,
IP = 1
,
OUI = 2
,
DEKTEC = 3
,
HIDES = 4
} |
| Identifiers for some predefined TSDuck names files. More...
|
|
using | Value = uint64_t |
| Largest integer type we manage in the repository of names.
|
|
|
| NamesFile (const UString &fileName, bool mergeExtensions=false) |
| Constructor.
|
|
virtual | ~NamesFile () |
| Virtual destructor.
|
|
UString | configurationFile () const |
| Get the complete path of the configuration file from which the names were loaded.
|
|
size_t | errorCount () const |
| Get the number of errors in the configuration file.
|
|
bool | nameExists (const UString §ionName, Value value) const |
| Check if a name exists in a specified section.
|
|
UString | nameFromSection (const UString §ionName, Value value, NamesFlags flags=NamesFlags::NAME, size_t bits=0, Value alternateValue=0) const |
| Get a name from a specified section.
|
|
UString | nameFromSectionWithFallback (const UString §ionName, Value value1, Value value2, NamesFlags flags=NamesFlags::NAME, size_t bits=0, Value alternateValue=0) const |
| Get a name from a specified section, with alternate fallback value.
|
|
Representation of a ".names" file, containing names for identifiers.
In an instance of NamesFile, all names are loaded from one configuration file.
◆ Predefined
Identifiers for some predefined TSDuck names files.
Using an idenfier is faster than looking for a file name.
Enumerator |
---|
DTV | All Digital TV definitions (MPEG, DVB, ATSC, ISDB).
|
IP | Internet protocols definitions.
|
OUI | IEEE Organizationally Unique Identifiers.
|
DEKTEC | Dektec devices definitions.
|
HIDES | HiDes modulators definitions.
|
◆ NamesFile()
ts::NamesFile::NamesFile |
( |
const UString & |
fileName, |
|
|
bool |
mergeExtensions = false |
|
) |
| |
Constructor.
Using this constructor directly is discouraged. Use Instance() instead.
- Parameters
-
[in] | fileName | Configuration file name. Typically without directory name. Without directory, the file is automatically searched in the TSDuck configuration directory. |
[in] | mergeExtensions | If true, merge the content of names files from TSDuck extensions. |
- See also
- Instance(const UString&, bool);
-
Instance(Predefined, bool);
◆ Instance() [1/2]
static const NamesFile * ts::NamesFile::Instance |
( |
const UString & |
fileName, |
|
|
bool |
mergeExtensions = false |
|
) |
| |
|
static |
Get a common instance of NamesFile for a given configuration file.
The file is loaded once and the instance is created the first time. When the same file is requested again, the same instance is returned.
- Parameters
-
[in] | fileName | Configuration file name without directory name. The file is searched in the TSDuck configuration directory. |
[in] | mergeExtensions | If true, merge the content of names files from TSDuck extensions when the file is loaded the first time. |
- Returns
- A pointer to the NamesFile instance for that file. Never return a null pointer. In case of error (non existent file for instance), an empty instance is returned for that file.
◆ Instance() [2/2]
Get a common instance of NamesFile for a predefined configuration file.
The file is loaded once and the instance is created the first time. When the same file is requested again, the same instance is returned.
- Parameters
-
[in] | index | Identifier of the predefined file to get. |
- Returns
- A pointer to the NamesFile instance for that file. Never return a null pointer. In case of error (non existent file for instance), an empty instance is returned for that file.
◆ DeleteInstance()
static void ts::NamesFile::DeleteInstance |
( |
Predefined |
index | ) |
|
|
static |
Delete a common instance of NamesFile for a predefined configuration file.
This should never be necessary unless TSDuck extensions are loaded on the fly. This never happens since extensions are registered in macro TS_REGISTER_NAMES_FILE. This is useful in test programs only.
- Parameters
-
[in] | index | Identifier of the predefined file to get. |
◆ configurationFile()
UString ts::NamesFile::configurationFile |
( |
| ) |
const |
|
inline |
Get the complete path of the configuration file from which the names were loaded.
- Returns
- The complete path of the configuration file. Empty if does not exist.
◆ errorCount()
size_t ts::NamesFile::errorCount |
( |
| ) |
const |
|
inline |
Get the number of errors in the configuration file.
- Returns
- The number of errors in the configuration file.
◆ nameExists()
bool ts::NamesFile::nameExists |
( |
const UString & |
sectionName, |
|
|
Value |
value |
|
) |
| const |
Check if a name exists in a specified section.
- Parameters
-
[in] | sectionName | Name of section to search. Not case-sensitive. |
[in] | value | Value to get the name for. |
- Returns
- True if a name exists for value in sectionName.
◆ nameFromSection()
Get a name from a specified section.
- Parameters
-
[in] | sectionName | Name of section to search. Not case-sensitive. |
[in] | value | Value to get the name for. |
[in] | flags | Presentation flags. |
[in] | bits | Nominal size in bits of the data, optional. |
[in] | alternateValue | Display this integer value if flags ALTERNATE is set. |
- Returns
- The corresponding name.
◆ nameFromSectionWithFallback()
Get a name from a specified section, with alternate fallback value.
- Parameters
-
[in] | sectionName | Name of section to search. Not case-sensitive. |
[in] | value1 | Value to get the name for. |
[in] | value2 | Alternate value if no name is found for value1. |
[in] | flags | Presentation flags. |
[in] | bits | Nominal size in bits of the data, optional. |
[in] | alternateValue | Display this integer value if flags ALTERNATE is set. |
- Returns
- The corresponding name.
◆ Formatted()
Format a name using flags.
- Parameters
-
[in] | value | Value for the name. |
[in] | name | Name for the value. |
[in] | flags | Presentation flags. |
[in] | bits | Nominal size in bits of the data, optional. |
[in] | alternateValue | Display this integer value if flags ALTERNATE is set. |
- Returns
- The corresponding name.
◆ UnregisterExtensionFile()
static void ts::NamesFile::UnregisterExtensionFile |
( |
const UString & |
filename | ) |
|
|
static |
Unregister a previously registered extension.
- Parameters
-
[in] | filename | Name of the names file to unregister, |
The documentation for this class was generated from the following file: