ledger-core
Public Member Functions | List of all members
ledger::core::api::Preferences Class Referenceabstract

#include <Preferences.hpp>

+ Inheritance diagram for ledger::core::api::Preferences:

Public Member Functions

virtual std::string getString (const std::string &key, const std::string &fallbackValue)=0
 
virtual int32_t getInt (const std::string &key, int32_t fallbackValue)=0
 
virtual int64_t getLong (const std::string &key, int64_t fallbackValue)=0
 
virtual bool getBoolean (const std::string &key, bool fallbackValue)=0
 
virtual std::vector< std::string > getStringArray (const std::string &key, const std::vector< std::string > &fallbackValue)=0
 
virtual std::vector< uint8_t > getData (const std::string &key, const std::vector< uint8_t > &fallbackValue)=0
 
virtual bool contains (const std::string &key)=0
 
virtual std::shared_ptr< PreferencesEditoredit ()=0
 

Detailed Description

Interface for accessing and modifying custom preferences. Preferences are key - value data which will be persisted to the filesystem. They can be local or stored with the Ledger API backend (encrypted by a user secret). This can be used to attach application data to the libledger-core modules (i.e. a wallet pool, a wallet, an account, an operation). This interface is highly inspired by Android SharedPreferences.

Member Function Documentation

◆ contains()

virtual bool ledger::core::api::Preferences::contains ( const std::string &  key)
pure virtual

Checks whether the Preferences contains the given key.

Returns
true the preferences contains the key, false otherwise.

Implemented in ledger::core::Preferences.

◆ edit()

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

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

Returns
An interface for editting preferences.

Implemented in ledger::core::Preferences.

◆ getBoolean()

virtual bool ledger::core::api::Preferences::getBoolean ( const std::string &  key,
bool  fallbackValue 
)
pure virtual

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

Returns
The data associated with the key or fallbackValue.

Implemented in ledger::core::Preferences.

◆ getData()

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

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

Returns
The data associated with the key or fallbackValue.

Implemented in ledger::core::Preferences.

◆ getInt()

virtual int32_t ledger::core::api::Preferences::getInt ( const std::string &  key,
int32_t  fallbackValue 
)
pure virtual

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

Returns
The data associated with the key or fallbackValue.

Implemented in ledger::core::Preferences.

◆ getLong()

virtual int64_t ledger::core::api::Preferences::getLong ( const std::string &  key,
int64_t  fallbackValue 
)
pure virtual

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

Returns
The data associated with the key or fallbackValue.

Implemented in ledger::core::Preferences.

◆ getString()

virtual std::string ledger::core::api::Preferences::getString ( const std::string &  key,
const std::string &  fallbackValue 
)
pure virtual

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

Returns
The data associated with the key or fallbackValue.

Implemented in ledger::core::Preferences.

◆ getStringArray()

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

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

Returns
The data associated with the key or fallbackValue.

Implemented in ledger::core::Preferences.


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