ledger-core
Public Member Functions | Protected Member Functions | Friends | List of all members
ledger::core::Preferences Class Reference
+ Inheritance diagram for ledger::core::Preferences:
+ Collaboration diagram for ledger::core::Preferences:

Public Member Functions

 Preferences (PreferencesBackend &backend, const std::vector< uint8_t > &keyPrefix)
 
std::string getString (const std::string &key, const std::string &fallbackValue) override
 
int32_t getInt (const std::string &key, int32_t fallbackValue) override
 
int64_t getLong (const std::string &key, int64_t fallbackValue) override
 
bool getBoolean (const std::string &key, bool fallbackValue) override
 
std::vector< std::string > getStringArray (const std::string &key, const std::vector< std::string > &fallbackValue) override
 
bool contains (const std::string &key) override
 
std::shared_ptr< api::PreferencesEditoredit () override
 
std::shared_ptr< PreferencesEditoreditor ()
 
std::vector< uint8_t > getData (const std::string &key, const std::vector< uint8_t > &fallbackValue) override
 
template<typename T >
Option< T > getObject (const std::string &key)
 
void iterate (std::function< bool(leveldb::Slice &&, leveldb::Slice &&)> f, Option< std::string > begin=Option< std::string >())
 
template<typename T >
void iterate (std::function< bool(leveldb::Slice &&key, const T &value)> f, Option< std::string > begin=Option< std::string >())
 
std::shared_ptr< PreferencesgetSubPreferences (std::string prefix)
 

Protected Member Functions

std::vector< uint8_t > wrapKey (const std::string &key) const
 

Friends

class ledger::core::PreferencesEditor
 

Member Function Documentation

◆ contains()

bool ledger::core::Preferences::contains ( const std::string &  key)
overridevirtual

Checks whether the Preferences contains the given key.

Returns
true the preferences contains the key, false otherwise.

Implements ledger::core::api::Preferences.

◆ edit()

std::shared_ptr< api::PreferencesEditor > ledger::core::Preferences::edit ( )
overridevirtual

Get a preferences editor in order to add/modify/remove data.

Returns
An interface for editting preferences.

Implements ledger::core::api::Preferences.

◆ getBoolean()

bool ledger::core::Preferences::getBoolean ( const std::string &  key,
bool  fallbackValue 
)
overridevirtual

Retrieves the value associated with the given key or fallback to the default value.

Returns
The data associated with the key or fallbackValue.

Implements ledger::core::api::Preferences.

◆ getData()

std::vector< uint8_t > ledger::core::Preferences::getData ( const std::string &  key,
const std::vector< uint8_t > &  fallbackValue 
)
overridevirtual

Retrieves the value associated with the given key or fallback to the default value.

Returns
The data associated with the key or fallbackValue.

Implements ledger::core::api::Preferences.

◆ getInt()

int32_t ledger::core::Preferences::getInt ( const std::string &  key,
int32_t  fallbackValue 
)
overridevirtual

Retrieves the value associated with the given key or fallback to the default value.

Returns
The data associated with the key or fallbackValue.

Implements ledger::core::api::Preferences.

◆ getLong()

int64_t ledger::core::Preferences::getLong ( const std::string &  key,
int64_t  fallbackValue 
)
overridevirtual

Retrieves the value associated with the given key or fallback to the default value.

Returns
The data associated with the key or fallbackValue.

Implements ledger::core::api::Preferences.

◆ getString()

std::string ledger::core::Preferences::getString ( const std::string &  key,
const std::string &  fallbackValue 
)
overridevirtual

Retrieves the value associated with the given key or fallback to the default value.

Returns
The data associated with the key or fallbackValue.

Implements ledger::core::api::Preferences.

◆ getStringArray()

std::vector< std::string > ledger::core::Preferences::getStringArray ( const std::string &  key,
const std::vector< std::string > &  fallbackValue 
)
overridevirtual

Retrieves the value associated with the given key or fallback to the default value.

Returns
The data associated with the key or fallbackValue.

Implements ledger::core::api::Preferences.


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