TSDuck Version 3.24-2000 (TSDuck - The MPEG Transport Stream Toolkit)
ts::Registry Class Reference

A class to encapsulate the access to the Windows registry. More...

Collaboration diagram for ts::Registry:

Public Types

typedef system specific Handle
 Handle to a registry key.
 

Static Public Member Functions

static bool CreateKey (const UString &key, bool is_volatile=false, Report &report=(*(static_cast< ts::Report *>(ts::NullReport::Instance()))))
 Create a registry key. More...
 
static bool DeleteKey (const UString &key, Report &report=(*(static_cast< ts::Report *>(ts::NullReport::Instance()))))
 Delete a registry key. More...
 
static bool DeleteValue (const UString &key, const UString &value_name, Report &report=(*(static_cast< ts::Report *>(ts::NullReport::Instance()))))
 Delete a value of a registry key. More...
 
static UString GetValue (const UString &key, const UString &value_name=UString(), Report &report=(*(static_cast< ts::Report *>(ts::NullReport::Instance()))))
 Get a value in a registry key as a string. More...
 
static bool NotifyEnvironmentChange (Report &report=(*(static_cast< ts::Report *>(ts::NullReport::Instance()))))
 Notify all applications that the environment was modified. More...
 
static bool NotifySettingChange (Report &report=(*(static_cast< ts::Report *>(ts::NullReport::Instance()))))
 Notify all applications of a setting change. More...
 
static bool SetValue (const UString &key, const UString &value_name, const UString &value, bool expandable=false, Report &report=(*(static_cast< ts::Report *>(ts::NullReport::Instance()))))
 Set the value of a registry key. More...
 
static bool SetValue (const UString &key, const UString &value_name, uint32_t value, Report &report=(*(static_cast< ts::Report *>(ts::NullReport::Instance()))))
 Set value of a registry key. More...
 
static bool SplitKey (const UString &key, Handle &root_key, UString &subkey, Report &report=(*(static_cast< ts::Report *>(ts::NullReport::Instance()))))
 Get the root key of a registry path. More...
 
static bool SplitKey (const UString &key, Handle &root_key, UString &midkey, UString &final_key, Report &report=(*(static_cast< ts::Report *>(ts::NullReport::Instance()))))
 Get the root key of a registry path. More...
 

Static Public Attributes

static const UString SystemEnvironmentKey
 Name of the registry key containining the system-defined environment variables.
 
static const UString UserEnvironmentKey
 Name of the registry key containining the user-defined environment variables.
 

Detailed Description

A class to encapsulate the access to the Windows registry.

Vocabulary :

  • Key : Node of the registry (kind of "directory").
  • Value_Name : Name of a value in a key.
  • Value : Value of the Value_Name.

This class is defined for all operating systems. So, it is possible to use it everywhere without complicated conditional compilation. However, all calls return an error on non-Windows systems.

Member Function Documentation

◆ GetValue()

static UString ts::Registry::GetValue ( const UString key,
const UString value_name = UString(),
Report report = (*(static_cast< ts::Report *>(ts::NullReport::Instance()))) 
)
static

Get a value in a registry key as a string.

Parameters
[in]keyRegistry key.
[in]value_nameName of the value in key.
[in,out]reportWhere to report error.
Returns
An empty string if non-existent or error.

◆ SetValue() [1/2]

static bool ts::Registry::SetValue ( const UString key,
const UString value_name,
const UString value,
bool  expandable = false,
Report report = (*(static_cast< ts::Report *>(ts::NullReport::Instance()))) 
)
static

Set the value of a registry key.

Parameters
[in]keyRegistry key.
[in]value_nameName of the value in key.
[in]valueValue to set in value_name.
[in]expandableIf true, set the type to REG_EXPAND_SZ. Otherwise, set type to REG_SZ.
[in,out]reportWhere to report error.
Returns
True on success, false on error.

◆ SetValue() [2/2]

static bool ts::Registry::SetValue ( const UString key,
const UString value_name,
uint32_t  value,
Report report = (*(static_cast< ts::Report *>(ts::NullReport::Instance()))) 
)
static

Set value of a registry key.

Set the data type as REG_DWORD.

Parameters
[in]keyRegistry key.
[in]value_nameName of the value in key.
[in]valueValue to set in value_name. Set the data type as REG_DWORD.
[in,out]reportWhere to report error.
Returns
True on success, false on error.

◆ DeleteValue()

static bool ts::Registry::DeleteValue ( const UString key,
const UString value_name,
Report report = (*(static_cast< ts::Report *>(ts::NullReport::Instance()))) 
)
static

Delete a value of a registry key.

Parameters
[in]keyRegistry key.
[in]value_nameName of the value in key.
[in,out]reportWhere to report error.
Returns
True on success, false on error.

◆ CreateKey()

static bool ts::Registry::CreateKey ( const UString key,
bool  is_volatile = false,
Report report = (*(static_cast< ts::Report *>(ts::NullReport::Instance()))) 
)
static

Create a registry key.

Parameters
[in]keyRegistry key to create.
[in]is_volatileIf true, create a "volatile" registry key.
[in,out]reportWhere to report error.
Returns
True on success, false on error.

◆ DeleteKey()

static bool ts::Registry::DeleteKey ( const UString key,
Report report = (*(static_cast< ts::Report *>(ts::NullReport::Instance()))) 
)
static

Delete a registry key.

Parameters
[in]keyRegistry key to delete.
[in,out]reportWhere to report error.
Returns
True on success, false on error.

◆ SplitKey() [1/2]

static bool ts::Registry::SplitKey ( const UString key,
Handle root_key,
UString subkey,
Report report = (*(static_cast< ts::Report *>(ts::NullReport::Instance()))) 
)
static

Get the root key of a registry path.

Parameters
[in]keyRegistry key to split.
[out]root_keyHandle to the root key.
[out]subkeySubkey name.
[in,out]reportWhere to report error.
Returns
True on success, false on error.

◆ SplitKey() [2/2]

static bool ts::Registry::SplitKey ( const UString key,
Handle root_key,
UString midkey,
UString final_key,
Report report = (*(static_cast< ts::Report *>(ts::NullReport::Instance()))) 
)
static

Get the root key of a registry path.

Parameters
[in]keyRegistry key to split.
[out]root_keyHandle to the root key.
[out]midkeyMiddle key name (without root key and final component).
[out]final_keyFinal component of the key.
[in,out]reportWhere to report error.
Returns
True on success, false on error.

◆ NotifySettingChange()

static bool ts::Registry::NotifySettingChange ( Report report = (*(static_cast< ts::Report *>(ts::NullReport::Instance()))))
static

Notify all applications of a setting change.

Parameters
[in,out]reportWhere to report error.
Returns
True on success, false on error.

◆ NotifyEnvironmentChange()

static bool ts::Registry::NotifyEnvironmentChange ( Report report = (*(static_cast< ts::Report *>(ts::NullReport::Instance()))))
static

Notify all applications that the environment was modified.

Parameters
[in,out]reportWhere to report error.
Returns
True on success, false on error.

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