Ocean
Ocean::Platform::Win::Registry Class Reference

This class provides windows registry functionalities. More...

Public Types

enum  RootType { ROOT_CLASSES_ROOT , ROOT_CURRENT_USER , ROOT_LOCAL_MACHINE , ROOT_USERS }
 Definition of different registry root types. More...
 
enum  ValueType {
  VALUE_INVALID , VALUE_DATA , VALUE_INTEGER32 , VALUE_INTEGER64 ,
  VALUE_STRING , VALUE_STRINGS
}
 Definition of different registry value types. More...
 
typedef std::vector< std::string > Names
 Definition of a vector holding key or value names. More...
 

Static Public Member Functions

static HKEY translateRoot (const RootType root)
 Translates a root type. More...
 
static HKEY openKey (const RootType root, const std::string &path)
 Opens a registry key and returns the received key handle. More...
 
static HKEY openKey (const HKEY key, const std::string &name)
 Opens a registry key and returns the received key handle. More...
 
static bool closeKey (const HKEY key)
 Closes a registry key. More...
 
static bool createKey (const RootType root, const std::string &path)
 Creates a new key. More...
 
static ValueType valueType (const HKEY key, const std::string &name)
 Returns the type of a value. More...
 
static bool setValue (const RootType root, const std::string &path, const std::string &name, const int value)
 Sets a value of a key. More...
 
static bool setValue (const HKEY key, const std::string &name, const int value)
 Sets a value of a key. More...
 
static bool setValue (const RootType root, const std::string &path, const std::string &name, const long long value)
 Sets a value of a key. More...
 
static bool setValue (const HKEY key, const std::string &name, const long long value)
 Sets a value of a key. More...
 
static bool setValue (const RootType root, const std::string &path, const std::string &name, const std::string &value)
 Sets a value of a key. More...
 
static bool setValue (const HKEY key, const std::string &name, const std::string &value)
 Sets a value of a key. More...
 
static bool setValue (const RootType root, const std::string &path, const std::string &name, const Names &value)
 Sets a value of a key. More...
 
static bool setValue (const HKEY key, const std::string &name, const Names &value)
 Sets a value of a key. More...
 
static bool setValue (const RootType root, const std::string &path, const std::string &name, const unsigned char *value, const unsigned int size)
 Sets a value of a key. More...
 
static bool setValue (const HKEY key, const std::string &name, const unsigned char *value, const unsigned int size)
 Sets a value of a key. More...
 
static int value (const RootType root, const std::string &path, const std::string &name, const int value)
 Returns a key value. More...
 
static int value (const HKEY key, const std::string &name, const int value)
 Returns a key value. More...
 
static long long value (const RootType root, const std::string &path, const std::string &name, const long long value)
 Returns a key value. More...
 
static long long value (const HKEY key, const std::string &name, const long long value)
 Returns a key value. More...
 
static std::string value (const RootType root, const std::string &path, const std::string &name, const std::string &value)
 Returns a key value. More...
 
static std::string value (const HKEY key, const std::string &name, const std::string &value)
 Returns a key value. More...
 
static Names value (const RootType root, const std::string &path, const std::string &name, const Names &value)
 Returns a key value. More...
 
static Names value (const HKEY key, const std::string &name, const Names &value)
 Returns a key value. More...
 
static Names values (const RootType root, const std::string &path)
 Returns all values specified for a key. More...
 
static Names values (const HKEY key)
 Returns all values specified for a key. More...
 
static Names keys (const RootType root, const std::string &path)
 Returns all sub keys specified for a key. More...
 
static Names keys (const HKEY key)
 Returns all sub keys specified for a key. More...
 

Detailed Description

This class provides windows registry functionalities.

Member Typedef Documentation

◆ Names

typedef std::vector<std::string> Ocean::Platform::Win::Registry::Names

Definition of a vector holding key or value names.

Member Enumeration Documentation

◆ RootType

Definition of different registry root types.

Enumerator
ROOT_CLASSES_ROOT 

Classes root type.

ROOT_CURRENT_USER 

Current user root type.

ROOT_LOCAL_MACHINE 

Local machine root type.

ROOT_USERS 

Users root type.

◆ ValueType

Definition of different registry value types.

Enumerator
VALUE_INVALID 

Invalid value type.

VALUE_DATA 

Data value type.

VALUE_INTEGER32 

32 bit integer value type.

VALUE_INTEGER64 

64 bit integer value type.

VALUE_STRING 

String value type.

VALUE_STRINGS 

Multi string value type.

Member Function Documentation

◆ closeKey()

static bool Ocean::Platform::Win::Registry::closeKey ( const HKEY  key)
static

Closes a registry key.

Parameters
keyKey to close
Returns
True, if succeeded

◆ createKey()

static bool Ocean::Platform::Win::Registry::createKey ( const RootType  root,
const std::string &  path 
)
static

Creates a new key.

Parameters
rootKey root
pathPath and name of the new key
Returns
True, if succeeded

◆ keys() [1/2]

static Names Ocean::Platform::Win::Registry::keys ( const HKEY  key)
static

Returns all sub keys specified for a key.

Parameters
keyKey to return the sub keys from
Returns
Sub key names

◆ keys() [2/2]

static Names Ocean::Platform::Win::Registry::keys ( const RootType  root,
const std::string &  path 
)
static

Returns all sub keys specified for a key.

Parameters
rootKey root
pathPath and name of the key to return the keys from
Returns
Sub key names

◆ openKey() [1/2]

static HKEY Ocean::Platform::Win::Registry::openKey ( const HKEY  key,
const std::string &  name 
)
static

Opens a registry key and returns the received key handle.

Parameters
keyBase registry key
nameThe name of the new sub key
Returns
Received key handle

◆ openKey() [2/2]

static HKEY Ocean::Platform::Win::Registry::openKey ( const RootType  root,
const std::string &  path 
)
static

Opens a registry key and returns the received key handle.

Parameters
rootKey root to open
pathPath and name of the key to open
Returns
Received key handle

◆ setValue() [1/10]

static bool Ocean::Platform::Win::Registry::setValue ( const HKEY  key,
const std::string &  name,
const int  value 
)
static

Sets a value of a key.

Parameters
keyBase registry key
nameThe name of the value to set
valueValue to set
Returns
True, if succeeded

◆ setValue() [2/10]

static bool Ocean::Platform::Win::Registry::setValue ( const HKEY  key,
const std::string &  name,
const long long  value 
)
static

Sets a value of a key.

Parameters
keyBase registry key
nameThe name of the value to set
valueValue to set
Returns
True, if succeeded

◆ setValue() [3/10]

static bool Ocean::Platform::Win::Registry::setValue ( const HKEY  key,
const std::string &  name,
const Names value 
)
static

Sets a value of a key.

Parameters
keyBase registry key
nameThe name of the value to set
valueValue to set
Returns
True, if succeeded

◆ setValue() [4/10]

static bool Ocean::Platform::Win::Registry::setValue ( const HKEY  key,
const std::string &  name,
const std::string &  value 
)
static

Sets a value of a key.

Parameters
keyBase registry key
nameThe name of the value to set
valueValue to set
Returns
True, if succeeded

◆ setValue() [5/10]

static bool Ocean::Platform::Win::Registry::setValue ( const HKEY  key,
const std::string &  name,
const unsigned char *  value,
const unsigned int  size 
)
static

Sets a value of a key.

Parameters
keyBase registry key
nameThe name of the value to set
valueValue buffer to set
sizeSize of the value to set in bytes
Returns
True, if succeeded

◆ setValue() [6/10]

static bool Ocean::Platform::Win::Registry::setValue ( const RootType  root,
const std::string &  path,
const std::string &  name,
const int  value 
)
static

Sets a value of a key.

Parameters
rootKey root
pathPath and name of the key to set the value for
nameThe name of the value to set
valueValue to set
Returns
True, if succeeded

◆ setValue() [7/10]

static bool Ocean::Platform::Win::Registry::setValue ( const RootType  root,
const std::string &  path,
const std::string &  name,
const long long  value 
)
static

Sets a value of a key.

Parameters
rootKey root
pathPath and name of the key to set the value for
nameThe name of the value to set
valueValue to set
Returns
True, if succeeded

◆ setValue() [8/10]

static bool Ocean::Platform::Win::Registry::setValue ( const RootType  root,
const std::string &  path,
const std::string &  name,
const Names value 
)
static

Sets a value of a key.

Parameters
rootKey root
pathPath and name of the key to set the value for
nameThe name of the value to set
valueValue to set
Returns
True, if succeeded

◆ setValue() [9/10]

static bool Ocean::Platform::Win::Registry::setValue ( const RootType  root,
const std::string &  path,
const std::string &  name,
const std::string &  value 
)
static

Sets a value of a key.

Parameters
rootKey root
pathPath and name of the key to set the value for
nameThe name of the value to set
valueValue to set
Returns
True, if succeeded

◆ setValue() [10/10]

static bool Ocean::Platform::Win::Registry::setValue ( const RootType  root,
const std::string &  path,
const std::string &  name,
const unsigned char *  value,
const unsigned int  size 
)
static

Sets a value of a key.

Parameters
rootKey root
pathPath and name of the key to set the value for
nameThe name of the value to set
valueValue buffer to set
sizeSize of the value to set in bytes
Returns
True, if succeeded

◆ translateRoot()

static HKEY Ocean::Platform::Win::Registry::translateRoot ( const RootType  root)
static

Translates a root type.

Parameters
rootRoot type to translate
Returns
Translated root type as key handle

◆ value() [1/8]

static int Ocean::Platform::Win::Registry::value ( const HKEY  key,
const std::string &  name,
const int  value 
)
static

Returns a key value.

Parameters
keyBase registry key
nameThe name of the value to return
valueDefault value top return if the key does not hold the specified value
Returns
Key value or specified default value

◆ value() [2/8]

static long long Ocean::Platform::Win::Registry::value ( const HKEY  key,
const std::string &  name,
const long long  value 
)
static

Returns a key value.

Parameters
keyBase registry key
nameThe name of the value to return
valueDefault value top return if the key does not hold the specified value
Returns
Key value or specified default value

◆ value() [3/8]

static Names Ocean::Platform::Win::Registry::value ( const HKEY  key,
const std::string &  name,
const Names value 
)
static

Returns a key value.

Parameters
keyBase registry key
nameThe name of the value to return
valueDefault value top return if the key does not hold the specified value
Returns
Key value or specified default value

◆ value() [4/8]

static std::string Ocean::Platform::Win::Registry::value ( const HKEY  key,
const std::string &  name,
const std::string &  value 
)
static

Returns a key value.

Parameters
keyBase registry key
nameThe name of the value to return
valueDefault value top return if the key does not hold the specified value
Returns
Key value or specified default value

◆ value() [5/8]

static int Ocean::Platform::Win::Registry::value ( const RootType  root,
const std::string &  path,
const std::string &  name,
const int  value 
)
static

Returns a key value.

Parameters
rootKey root
pathPath and name of the key to return the value from
nameThe name of the value to return
valueDefault value top return if the key does not hold the specified value
Returns
Key value or specified default value

◆ value() [6/8]

static long long Ocean::Platform::Win::Registry::value ( const RootType  root,
const std::string &  path,
const std::string &  name,
const long long  value 
)
static

Returns a key value.

Parameters
rootKey root
pathPath and name of the key to return the value from
nameThe name of the value to return
valueDefault value top return if the key does not hold the specified value
Returns
Key value or specified default value

◆ value() [7/8]

static Names Ocean::Platform::Win::Registry::value ( const RootType  root,
const std::string &  path,
const std::string &  name,
const Names value 
)
static

Returns a key value.

Parameters
rootKey root
pathPath and name of the key to return the value from
nameThe name of the value to return
valueDefault value top return if the key does not hold the specified value
Returns
Key value or specified default value

◆ value() [8/8]

static std::string Ocean::Platform::Win::Registry::value ( const RootType  root,
const std::string &  path,
const std::string &  name,
const std::string &  value 
)
static

Returns a key value.

Parameters
rootKey root
pathPath and name of the key to return the value from
nameThe name of the value to return
valueDefault value top return if the key does not hold the specified value
Returns
Key value or specified default value

◆ values() [1/2]

static Names Ocean::Platform::Win::Registry::values ( const HKEY  key)
static

Returns all values specified for a key.

Parameters
keyKey to return the values from
Returns
Value names

◆ values() [2/2]

static Names Ocean::Platform::Win::Registry::values ( const RootType  root,
const std::string &  path 
)
static

Returns all values specified for a key.

Parameters
rootKey root
pathPath and name of the key to return the values from
Returns
Value names

◆ valueType()

static ValueType Ocean::Platform::Win::Registry::valueType ( const HKEY  key,
const std::string &  name 
)
static

Returns the type of a value.

Parameters
keyBase registry key
nameValue name
Returns
Value type

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