Cuberite
A lightweight, fast and extensible game server for Minecraft
Public Types | Public Member Functions | List of all members
cSettingsRepositoryInterface Class Referenceabstract

#include <SettingsRepositoryInterface.h>

Inheritance diagram for cSettingsRepositoryInterface:
Inheritance graph
[legend]

Public Types

enum  errors { noID = -1 }
 

Public Member Functions

virtual bool AddKeyComment (const AString &keyname, const AString &comment)=0
 Add a key comment, will always fail if the repository does not support comments. More...
 
virtual int AddKeyName (const AString &keyname)=0
 Add a key name. More...
 
virtual void AddValue (const AString &a_KeyName, const AString &a_ValueName, const AString &a_Value)=0
 Adds a new value to the specified key. More...
 
 cSettingsRepositoryInterface ()=default
 
virtual bool DeleteKeyComment (const AString &keyname, const int commentID)=0
 Delete a key comment, will always fail if the repository does not support comments. More...
 
virtual bool DeleteValue (const AString &keyname, const AString &valuename)=0
 Deletes the specified key, value pair. More...
 
 DISALLOW_COPY_AND_ASSIGN (cSettingsRepositoryInterface)
 
virtual bool Flush ()=0
 Writes the changes to the backing store, if the repository has one. More...
 
virtual AString GetKeyComment (const AString &keyname, const int commentID) const =0
 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 =0
 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)=0
 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="")=0
 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)=0
 
virtual int GetValueSetI (const AString &keyname, const AString &valuename, const int defValue=0)=0
 
virtual Int64 GetValueSetI (const AString &keyname, const AString &valuename, const Int64 defValue=0)=0
 
virtual bool HasValue (const AString &a_KeyName, const AString &a_ValueName) const =0
 Returns true iff the specified value exists. More...
 
virtual bool KeyExists (const AString keyname) const =0
 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)=0
 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)=0
 
virtual ~cSettingsRepositoryInterface ()=default
 

Detailed Description

Definition at line 4 of file SettingsRepositoryInterface.h.

Member Enumeration Documentation

◆ errors

Enumerator
noID 

Definition at line 8 of file SettingsRepositoryInterface.h.

Constructor & Destructor Documentation

◆ cSettingsRepositoryInterface()

cSettingsRepositoryInterface::cSettingsRepositoryInterface ( )
default

◆ ~cSettingsRepositoryInterface()

virtual cSettingsRepositoryInterface::~cSettingsRepositoryInterface ( )
virtualdefault

Member Function Documentation

◆ AddKeyComment()

virtual bool cSettingsRepositoryInterface::AddKeyComment ( const AString keyname,
const AString comment 
)
pure virtual

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

Implemented in cOverridesSettingsRepository, cMemorySettingsRepository, and cIniFile.

◆ AddKeyName()

virtual int cSettingsRepositoryInterface::AddKeyName ( const AString keyname)
pure virtual

Add a key name.

Return value is not required to mean anything

Implemented in cOverridesSettingsRepository, cMemorySettingsRepository, and cIniFile.

◆ AddValue()

virtual void cSettingsRepositoryInterface::AddValue ( const AString a_KeyName,
const AString a_ValueName,
const AString a_Value 
)
pure virtual

Adds a new value to the specified key.

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

Implemented in cOverridesSettingsRepository, cMemorySettingsRepository, and cIniFile.

◆ DeleteKeyComment()

virtual bool cSettingsRepositoryInterface::DeleteKeyComment ( const AString keyname,
const int  commentID 
)
pure virtual

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

Implemented in cOverridesSettingsRepository, cMemorySettingsRepository, and cIniFile.

◆ DeleteValue()

virtual bool cSettingsRepositoryInterface::DeleteValue ( const AString keyname,
const AString valuename 
)
pure virtual

Deletes the specified key, value pair.

Implemented in cOverridesSettingsRepository, cMemorySettingsRepository, and cIniFile.

◆ DISALLOW_COPY_AND_ASSIGN()

cSettingsRepositoryInterface::DISALLOW_COPY_AND_ASSIGN ( cSettingsRepositoryInterface  )

◆ Flush()

virtual bool cSettingsRepositoryInterface::Flush ( )
pure virtual

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

Implemented in cOverridesSettingsRepository, cMemorySettingsRepository, and cIniFile.

◆ GetKeyComment()

virtual AString cSettingsRepositoryInterface::GetKeyComment ( const AString keyname,
const int  commentID 
) const
pure virtual

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

Implemented in cOverridesSettingsRepository, cMemorySettingsRepository, and cIniFile.

◆ GetValue()

virtual AString cSettingsRepositoryInterface::GetValue ( const AString keyname,
const AString valuename,
const AString defValue = "" 
) const
pure virtual

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

Implemented in cOverridesSettingsRepository, cMemorySettingsRepository, and cIniFile.

◆ GetValues()

virtual std::vector<std::pair<AString, AString> > cSettingsRepositoryInterface::GetValues ( AString  a_keyName)
pure virtual

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

Implemented in cOverridesSettingsRepository, cMemorySettingsRepository, and cIniFile.

◆ GetValueSet()

virtual AString cSettingsRepositoryInterface::GetValueSet ( const AString keyname,
const AString valuename,
const AString defValue = "" 
)
pure virtual

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

Implemented in cOverridesSettingsRepository, cMemorySettingsRepository, and cIniFile.

◆ GetValueSetB()

virtual bool cSettingsRepositoryInterface::GetValueSetB ( const AString keyname,
const AString valuename,
const bool  defValue = false 
)
pure virtual

◆ GetValueSetI() [1/2]

virtual int cSettingsRepositoryInterface::GetValueSetI ( const AString keyname,
const AString valuename,
const int  defValue = 0 
)
pure virtual

◆ GetValueSetI() [2/2]

virtual Int64 cSettingsRepositoryInterface::GetValueSetI ( const AString keyname,
const AString valuename,
const Int64  defValue = 0 
)
pure virtual

◆ HasValue()

virtual bool cSettingsRepositoryInterface::HasValue ( const AString a_KeyName,
const AString a_ValueName 
) const
pure virtual

Returns true iff the specified value exists.

Implemented in cOverridesSettingsRepository, cMemorySettingsRepository, and cIniFile.

◆ KeyExists()

virtual bool cSettingsRepositoryInterface::KeyExists ( const AString  keyname) const
pure virtual

Returns true iff the specified key exists.

Implemented in cOverridesSettingsRepository, cMemorySettingsRepository, and cIniFile.

◆ SetValue()

virtual bool cSettingsRepositoryInterface::SetValue ( const AString a_KeyName,
const AString a_ValueName,
const AString a_Value,
const bool  a_CreateIfNotExists = true 
)
pure virtual

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.

Implemented in cOverridesSettingsRepository, cMemorySettingsRepository, and cIniFile.

◆ SetValueI()

virtual bool cSettingsRepositoryInterface::SetValueI ( const AString a_KeyName,
const AString a_ValueName,
const int  a_Value,
const bool  a_CreateIfNotExists = true 
)
pure virtual

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