scim  1.4.18
scim::DummyConfig Class Reference

A dummy implementation of interface class scim::ConfigBase. More...

#include <scim_config_base.h>

Public Member Functions

 DummyConfig ()
 
virtual ~DummyConfig ()
 
virtual bool valid () const
 Check if this Config object is valid. More...
 
virtual String get_name () const
 Return the name of this configuration module. More...
 
virtual bool read (const String &key, String *ret) const
 Read a string from the given key. More...
 
virtual bool read (const String &key, int *ret) const
 Read an int value from the given key. More...
 
virtual bool read (const String &key, double *ret) const
 Read a double value from the given key. More...
 
virtual bool read (const String &key, bool *ret) const
 Read a bool value from the given key. More...
 
virtual bool read (const String &key, std::vector< String > *ret) const
 Read a string list from the given key. More...
 
virtual bool read (const String &key, std::vector< int > *ret) const
 Read an int list from the given key. More...
 
virtual bool write (const String &key, const String &value)
 Write a string to the given key. More...
 
virtual bool write (const String &key, int value)
 Write an int value to the given key. More...
 
virtual bool write (const String &key, double value)
 Write a double value to the given key. More...
 
virtual bool write (const String &key, bool value)
 Write a bool value to the given key. More...
 
virtual bool write (const String &key, const std::vector< String > &value)
 Write a string list to the given key. More...
 
virtual bool write (const String &key, const std::vector< int > &value)
 Write an int list to the given key. More...
 
virtual bool flush ()
 Permanently writes all changes. More...
 
virtual bool erase (const String &key)
 Erase a key and its value. More...
 
virtual bool reload ()
 Reload the configurations from storage. More...
 
- Public Member Functions inherited from scim::ConfigBase
 ConfigBase ()
 Contrustor. More...
 
virtual ~ConfigBase ()
 Virtual destructor empty but ensures that dtor of all derived classes is virtual. More...
 
String read (const String &key, const String &defVal=String()) const
 Read a string from the given key with a default fallback value. More...
 
int read (const String &key, int defVal) const
 Read an int value from the given key with a default fallback value. More...
 
double read (const String &key, double defVal) const
 Read a double value from the given key with a default fallback value. More...
 
bool read (const String &key, bool defVal) const
 Read a bool value from the given key with a default fallback value. More...
 
std::vector< Stringread (const String &key, const std::vector< String > &defVal) const
 Read a string list from the given key with a default fallback value. More...
 
std::vector< int > read (const String &key, const std::vector< int > &defVal) const
 Read an int list from the given key with a default fallback value. More...
 
Connection signal_connect_reload (ConfigSlotVoid *slot)
 connect the given slot to the reload signal. More...
 
- Public Member Functions inherited from scim::ReferencedObject
bool is_referenced () const
 
void ref ()
 Increase an object's reference count by one. More...
 
void unref ()
 

Additional Inherited Members

- Static Public Member Functions inherited from scim::ConfigBase
static ConfigPointer set (const ConfigPointer &p_config)
 Set the default global Config object. More...
 
static ConfigPointer get (bool create_on_demand=true, const String &default_module=String(""))
 Get the default global Config object. More...
 
- Protected Member Functions inherited from scim::ReferencedObject
 ReferencedObject ()
 Constructor. More...
 
virtual ~ReferencedObject ()=0
 Destructor. More...
 
void set_referenced (bool reference)
 

Detailed Description

A dummy implementation of interface class scim::ConfigBase.

The read methods will just return false and the default value (if available). The write methods will do nothing.

Constructor & Destructor Documentation

◆ DummyConfig()

scim::DummyConfig::DummyConfig ( )

◆ ~DummyConfig()

virtual scim::DummyConfig::~DummyConfig ( )
virtual

Member Function Documentation

◆ valid()

virtual bool scim::DummyConfig::valid ( ) const
virtual

Check if this Config object is valid.

Returns
true if its valid and ready to work.

Implements scim::ConfigBase.

◆ get_name()

virtual String scim::DummyConfig::get_name ( ) const
virtual

Return the name of this configuration module.

This name must be same as the config module's name.

Implements scim::ConfigBase.

◆ read() [1/6]

virtual bool scim::DummyConfig::read ( const String key,
String ret 
) const
virtual

Read a string from the given key.

Parameters
key- the key to be read.
ret- the result will be stored into *ret.
Returns
true if the string is read successfully, otherwise return false.

Implements scim::ConfigBase.

◆ read() [2/6]

virtual bool scim::DummyConfig::read ( const String key,
int *  ret 
) const
virtual

Read an int value from the given key.

Parameters
key- the key to be read.
ret- the result will be stored into *ret.
Returns
true if the value is read successfully, otherwise return false.

Implements scim::ConfigBase.

◆ read() [3/6]

virtual bool scim::DummyConfig::read ( const String key,
double *  ret 
) const
virtual

Read a double value from the given key.

Parameters
key- the key to be read.
ret- the result will be stored into *ret.
Returns
true if the value is read successfully, otherwise return false.

Implements scim::ConfigBase.

◆ read() [4/6]

virtual bool scim::DummyConfig::read ( const String key,
bool *  ret 
) const
virtual

Read a bool value from the given key.

Parameters
key- the key to be read.
ret- the result will be stored into *ret.
Returns
true if the value is read successfully, otherwise return false.

Implements scim::ConfigBase.

◆ read() [5/6]

virtual bool scim::DummyConfig::read ( const String key,
std::vector< String > *  ret 
) const
virtual

Read a string list from the given key.

Parameters
key- the key to be read.
ret- the result will be stored into *ret.
Returns
true if the string list is read successfully, otherwise return false.

Implements scim::ConfigBase.

◆ read() [6/6]

virtual bool scim::DummyConfig::read ( const String key,
std::vector< int > *  ret 
) const
virtual

Read an int list from the given key.

Parameters
key- the key to be read.
ret- the result will be stored into *ret.
Returns
true if the int list is read successfully, otherwise return false.

Implements scim::ConfigBase.

◆ write() [1/6]

virtual bool scim::DummyConfig::write ( const String key,
const String value 
)
virtual

Write a string to the given key.

Parameters
key- the key to be written.
value- the string to be written to the key.
Returns
true if success, otherwise false.

Implements scim::ConfigBase.

◆ write() [2/6]

virtual bool scim::DummyConfig::write ( const String key,
int  value 
)
virtual

Write an int value to the given key.

Parameters
key- the key to be written.
value- the int value to be written to the key.
Returns
true if success, otherwise false.

Implements scim::ConfigBase.

◆ write() [3/6]

virtual bool scim::DummyConfig::write ( const String key,
double  value 
)
virtual

Write a double value to the given key.

Parameters
key- the key to be written.
value- the double value to be written to the key.
Returns
true if success, otherwise false.

Implements scim::ConfigBase.

◆ write() [4/6]

virtual bool scim::DummyConfig::write ( const String key,
bool  value 
)
virtual

Write a bool value to the given key.

Parameters
key- the key to be written.
value- the bool value to be written to the key.
Returns
true if success, otherwise false.

Implements scim::ConfigBase.

◆ write() [5/6]

virtual bool scim::DummyConfig::write ( const String key,
const std::vector< String > &  value 
)
virtual

Write a string list to the given key.

Parameters
key- the key to be written.
value- the string list to be written to the key.
Returns
true if success, otherwise false.

Implements scim::ConfigBase.

◆ write() [6/6]

virtual bool scim::DummyConfig::write ( const String key,
const std::vector< int > &  value 
)
virtual

Write an int list to the given key.

Parameters
key- the key to be written.
value- the int list to be written to the key.
Returns
true if success, otherwise false.

Implements scim::ConfigBase.

◆ flush()

virtual bool scim::DummyConfig::flush ( )
virtual

Permanently writes all changes.

Returns
true if success.

Implements scim::ConfigBase.

◆ erase()

virtual bool scim::DummyConfig::erase ( const String key)
virtual

Erase a key and its value.

Parameters
key- the key to be erased.
Returns
true if success.

Implements scim::ConfigBase.

◆ reload()

virtual bool scim::DummyConfig::reload ( )
virtual

Reload the configurations from storage.

All modified keys after the last flush maybe lost.

The derived method should call this base method after reload the configurations successfully, in order to emit the reload signal.

The derived method should have some machanism to avoid reload again if there is no update after the previous reload.

Returns
true if success.

Implements scim::ConfigBase.


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