![]() |
TSDuck v3.43-4441
MPEG Transport Stream Toolkit
|
Repository of dynamically registered features. More...
#include <tsFeatures.h>
Classes | |
class | Register |
A class to register a feature of the application. More... | |
Public Types | |
using | GetVersionFunc = UString(*)() |
Profile of a function return a version string for a feature. | |
using | index_t = Names::int_t |
Each feature is assigned a unique positive number. | |
enum | Support { ALWAYS , SUPPORTED , UNSUPPORTED } |
Describe the level of support for a feature. More... | |
Public Member Functions | |
std::list< std::pair< UString, UString > > | getAllVersions () |
Get the version of all features. | |
UString | getVersion (const UString &option) |
Get the version of a feature, if supported. | |
UString | getVersion (index_t index) |
Get the version of a feature, if supported. | |
bool | isSupported (const UString &option) |
Check if a feature is supported. | |
bool | isSupported (index_t index) |
Check if a feature is supported. | |
index_t | registerFeature (const UString &option, const fs::path &library) |
Register a feature which is in another shared image. | |
index_t | registerFeature (const UString &option, const UString &name, Support support, GetVersionFunc get_version) |
Register a feature. | |
const Names & | supportEnum () const |
Enumeration of optional features. | |
const Names & | versionEnum () const |
Enumeration of versioned features. | |
Static Public Member Functions | |
static Features & | Instance () |
Get the instance of the singleton of this class. | |
Repository of dynamically registered features.
|
static |
Get the instance of the singleton of this class.
index_t ts::Features::registerFeature | ( | const UString & | option, |
const UString & | name, | ||
Support | support, | ||
GetVersionFunc | get_version | ||
) |
Register a feature.
[in] | option | Feature name as used in command line options. |
[in] | name | Feature name as used on display. |
[in] | support | Level of support. |
[in] | get_version | Function returning the version of the feature. Can be null (no identified version). |
Register a feature which is in another shared image.
If a feature with the same option name is already registered, do nothing. Otherwise, the library name is stored for later usage. The first time the feature is searched, the shared library is loaded. If the load succeeds and the initialization of the shared image registered a feature with the same name, the feature becomes defined. Otherwise, the feature is definitely marked as unsupported.
[in] | option | Feature name as used in command line options. |
[in] | library | Name of a shared image (typically without directory). |
|
inline |
Enumeration of optional features.
Typically used to implement the --support command line option.
|
inline |
Enumeration of versioned features.
Typically used to implement the --version command line option.
bool ts::Features::isSupported | ( | index_t | index | ) |
Check if a feature is supported.
[in] | index | Index of the feature as returned in supportEnum(). |
bool ts::Features::isSupported | ( | const UString & | option | ) |
Check if a feature is supported.
[in] | option | Command line option of the feature. |
Get the version of a feature, if supported.
[in] | index | Index of the feature as returned in versionEnum(). |
Get the version of a feature, if supported.
[in] | option | Command line option of the feature. |
Get the version of all features.