Cuberite
A lightweight, fast and extensible game server for Minecraft
Public Member Functions | Private Attributes | List of all members
cOverridesSettingsRepository Class Reference

#include <OverridesSettingsRepository.h>

Inheritance diagram for cOverridesSettingsRepository:
Inheritance graph
[legend]
Collaboration diagram for cOverridesSettingsRepository:
Collaboration graph
[legend]

Public Member Functions

virtual bool AddKeyComment (const AString &keyname, const AString &comment) override
 Add a key comment, will always fail if the repository does not support comments. More...
 
virtual int AddKeyName (const AString &keyname) override
 Add a key name. More...
 
virtual void AddValue (const AString &a_KeyName, const AString &a_ValueName, const AString &a_Value) override
 Adds a new value to the specified key. More...
 
 cOverridesSettingsRepository (std::unique_ptr< cSettingsRepositoryInterface > a_Main, cSettingsRepositoryInterface &a_Overrides)
 
virtual bool DeleteKeyComment (const AString &keyname, const int commentID) override
 Delete a key comment, will always fail if the repository does not support comments. More...
 
virtual bool DeleteValue (const AString &keyname, const AString &valuename) override
 Deletes the specified key, value pair. More...
 
virtual bool Flush () override
 Writes the changes to the backing store, if the repository has one. More...
 
virtual AString GetKeyComment (const AString &keyname, const int commentID) const override
 Return a key comment, returns "" for repositories that do not return comments. More...
 
virtual AString GetValue (const AString &keyname, const AString &valuename, const AString &defValue="") const override
 Get the value at the specified key and value, returns defValue on failure. More...
 
virtual std::vector< std::pair< AString, AString > > GetValues (AString a_keyName) override
 returns a vector containing a name, value pair for each value under the key More...
 
virtual AString GetValueSet (const AString &keyname, const AString &valuename, const AString &defValue="") override
 Gets the value; if not found, write the default to the repository. More...
 
virtual bool GetValueSetB (const AString &keyname, const AString &valuename, const bool defValue=false) override
 
virtual int GetValueSetI (const AString &keyname, const AString &valuename, const int defValue=0) override
 
virtual Int64 GetValueSetI (const AString &keyname, const AString &valuename, const Int64 defValue=0) override
 
virtual bool HasValue (const AString &a_KeyName, const AString &a_ValueName) const override
 Returns true iff the specified value exists. More...
 
virtual bool KeyExists (const AString keyname) const override
 Returns true iff the specified key exists. More...
 
virtual bool SetValue (const AString &a_KeyName, const AString &a_ValueName, const AString &a_Value, const bool a_CreateIfNotExists=true) override
 Overwrites the value of the key, value pair Specify the optional parameter as false if you do not want the value created if it doesn't exist. More...
 
virtual bool SetValueI (const AString &a_KeyName, const AString &a_ValueName, const int a_Value, const bool a_CreateIfNotExists=true) override
 
virtual ~cOverridesSettingsRepository () override=default
 
- Public Member Functions inherited from cSettingsRepositoryInterface
 cSettingsRepositoryInterface ()=default
 
 DISALLOW_COPY_AND_ASSIGN (cSettingsRepositoryInterface)
 
virtual ~cSettingsRepositoryInterface ()=default
 

Private Attributes

std::unique_ptr< cSettingsRepositoryInterfacem_Main
 
cSettingsRepositoryInterfacem_Overrides
 

Additional Inherited Members

- Public Types inherited from cSettingsRepositoryInterface
enum  errors { noID = -1 }
 

Detailed Description

Definition at line 6 of file OverridesSettingsRepository.h.

Constructor & Destructor Documentation

◆ cOverridesSettingsRepository()

cOverridesSettingsRepository::cOverridesSettingsRepository ( std::unique_ptr< cSettingsRepositoryInterface a_Main,
cSettingsRepositoryInterface a_Overrides 
)

Definition at line 5 of file OverridesSettingsRepository.cpp.

◆ ~cOverridesSettingsRepository()

virtual cOverridesSettingsRepository::~cOverridesSettingsRepository ( )
overridevirtualdefault

Member Function Documentation

◆ AddKeyComment()

bool cOverridesSettingsRepository::AddKeyComment ( const AString keyname,
const AString comment 
)
overridevirtual

Add a key comment, will always fail if the repository does not support comments.

Implements cSettingsRepositoryInterface.

Definition at line 49 of file OverridesSettingsRepository.cpp.

◆ AddKeyName()

int cOverridesSettingsRepository::AddKeyName ( const AString keyname)
overridevirtual

Add a key name.

Return value is not required to mean anything

Implements cSettingsRepositoryInterface.

Definition at line 33 of file OverridesSettingsRepository.cpp.

◆ AddValue()

void cOverridesSettingsRepository::AddValue ( const AString a_KeyName,
const AString a_ValueName,
const AString a_Value 
)
overridevirtual

Adds a new value to the specified key.

If a value of the same name already exists, creates another one

Implements cSettingsRepositoryInterface.

Definition at line 92 of file OverridesSettingsRepository.cpp.

◆ DeleteKeyComment()

bool cOverridesSettingsRepository::DeleteKeyComment ( const AString keyname,
const int  commentID 
)
overridevirtual

Delete a key comment, will always fail if the repository does not support comments.

Implements cSettingsRepositoryInterface.

Definition at line 78 of file OverridesSettingsRepository.cpp.

◆ DeleteValue()

bool cOverridesSettingsRepository::DeleteValue ( const AString keyname,
const AString valuename 
)
overridevirtual

Deletes the specified key, value pair.

Implements cSettingsRepositoryInterface.

Definition at line 250 of file OverridesSettingsRepository.cpp.

◆ Flush()

bool cOverridesSettingsRepository::Flush ( )
overridevirtual

Writes the changes to the backing store, if the repository has one.

Implements cSettingsRepositoryInterface.

Definition at line 266 of file OverridesSettingsRepository.cpp.

◆ GetKeyComment()

AString cOverridesSettingsRepository::GetKeyComment ( const AString keyname,
const int  commentID 
) const
overridevirtual

Return a key comment, returns "" for repositories that do not return comments.

Implements cSettingsRepositoryInterface.

Definition at line 63 of file OverridesSettingsRepository.cpp.

◆ GetValue()

AString cOverridesSettingsRepository::GetValue ( const AString keyname,
const AString valuename,
const AString defValue = "" 
) const
overridevirtual

Get the value at the specified key and value, returns defValue on failure.

Implements cSettingsRepositoryInterface.

Definition at line 138 of file OverridesSettingsRepository.cpp.

◆ GetValues()

std::vector< std::pair< AString, AString > > cOverridesSettingsRepository::GetValues ( AString  a_keyName)
overridevirtual

returns a vector containing a name, value pair for each value under the key

Implements cSettingsRepositoryInterface.

Definition at line 108 of file OverridesSettingsRepository.cpp.

◆ GetValueSet()

AString cOverridesSettingsRepository::GetValueSet ( const AString keyname,
const AString valuename,
const AString defValue = "" 
)
overridevirtual

Gets the value; if not found, write the default to the repository.

Implements cSettingsRepositoryInterface.

Definition at line 154 of file OverridesSettingsRepository.cpp.

◆ GetValueSetB()

bool cOverridesSettingsRepository::GetValueSetB ( const AString keyname,
const AString valuename,
const bool  defValue = false 
)
overridevirtual

Implements cSettingsRepositoryInterface.

Definition at line 202 of file OverridesSettingsRepository.cpp.

◆ GetValueSetI() [1/2]

int cOverridesSettingsRepository::GetValueSetI ( const AString keyname,
const AString valuename,
const int  defValue = 0 
)
overridevirtual

Implements cSettingsRepositoryInterface.

Definition at line 170 of file OverridesSettingsRepository.cpp.

◆ GetValueSetI() [2/2]

Int64 cOverridesSettingsRepository::GetValueSetI ( const AString keyname,
const AString valuename,
const Int64  defValue = 0 
)
overridevirtual

Implements cSettingsRepositoryInterface.

Definition at line 186 of file OverridesSettingsRepository.cpp.

◆ HasValue()

bool cOverridesSettingsRepository::HasValue ( const AString a_KeyName,
const AString a_ValueName 
) const
overridevirtual

Returns true iff the specified value exists.

Implements cSettingsRepositoryInterface.

Definition at line 24 of file OverridesSettingsRepository.cpp.

◆ KeyExists()

bool cOverridesSettingsRepository::KeyExists ( const AString  keyname) const
overridevirtual

Returns true iff the specified key exists.

Implements cSettingsRepositoryInterface.

Definition at line 15 of file OverridesSettingsRepository.cpp.

◆ SetValue()

bool cOverridesSettingsRepository::SetValue ( const AString a_KeyName,
const AString a_ValueName,
const AString a_Value,
const bool  a_CreateIfNotExists = true 
)
overridevirtual

Overwrites the value of the key, value pair Specify the optional parameter as false if you do not want the value created if it doesn't exist.

Returns true if value set, false otherwise.

Implements cSettingsRepositoryInterface.

Definition at line 218 of file OverridesSettingsRepository.cpp.

◆ SetValueI()

bool cOverridesSettingsRepository::SetValueI ( const AString a_KeyName,
const AString a_ValueName,
const int  a_Value,
const bool  a_CreateIfNotExists = true 
)
overridevirtual

Implements cSettingsRepositoryInterface.

Definition at line 234 of file OverridesSettingsRepository.cpp.

Member Data Documentation

◆ m_Main

std::unique_ptr<cSettingsRepositoryInterface> cOverridesSettingsRepository::m_Main
private

Definition at line 46 of file OverridesSettingsRepository.h.

◆ m_Overrides

cSettingsRepositoryInterface* cOverridesSettingsRepository::m_Overrides
private

Definition at line 47 of file OverridesSettingsRepository.h.


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