summaryrefslogtreecommitdiffstats
path: root/src/OverridesSettingsRepository.h
diff options
context:
space:
mode:
authortycho <work.tycho@gmail.com>2015-05-19 12:55:23 +0200
committertycho <work.tycho@gmail.com>2015-05-19 12:55:23 +0200
commit95e06ab93ff98c7bcffcf8a68a479802c8a56fe3 (patch)
tree87e8224964c12b746e34701dfffbcd3201889cdf /src/OverridesSettingsRepository.h
parentFixed a lot of warnings (diff)
parentMerge pull request #2019 from mc-server/OverrideArgs (diff)
downloadcuberite-95e06ab93ff98c7bcffcf8a68a479802c8a56fe3.tar
cuberite-95e06ab93ff98c7bcffcf8a68a479802c8a56fe3.tar.gz
cuberite-95e06ab93ff98c7bcffcf8a68a479802c8a56fe3.tar.bz2
cuberite-95e06ab93ff98c7bcffcf8a68a479802c8a56fe3.tar.lz
cuberite-95e06ab93ff98c7bcffcf8a68a479802c8a56fe3.tar.xz
cuberite-95e06ab93ff98c7bcffcf8a68a479802c8a56fe3.tar.zst
cuberite-95e06ab93ff98c7bcffcf8a68a479802c8a56fe3.zip
Diffstat (limited to '')
-rw-r--r--src/OverridesSettingsRepository.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/OverridesSettingsRepository.h b/src/OverridesSettingsRepository.h
new file mode 100644
index 000000000..04a53997f
--- /dev/null
+++ b/src/OverridesSettingsRepository.h
@@ -0,0 +1,52 @@
+
+#pragma once
+
+#include "SettingsRepositoryInterface.h"
+
+#include <unordered_map>
+
+class cOverridesSettingsRepository : public cSettingsRepositoryInterface
+{
+
+public:
+ cOverridesSettingsRepository(std::unique_ptr<cSettingsRepositoryInterface> a_Main, std::unique_ptr<cSettingsRepositoryInterface> a_Overrides);
+
+ virtual ~cOverridesSettingsRepository() = default;
+
+ virtual bool KeyExists(const AString keyname) const override;
+
+ virtual bool HasValue(const AString & a_KeyName, const AString & a_ValueName) const override;
+
+ virtual int AddKeyName(const AString & keyname) override;
+
+ virtual bool AddKeyComment(const AString & keyname, const AString & comment) override;
+
+ virtual AString GetKeyComment(const AString & keyname, const int commentID) const override;
+
+ virtual bool DeleteKeyComment(const AString & keyname, const int commentID) override;
+
+ virtual void AddValue (const AString & a_KeyName, const AString & a_ValueName, const AString & a_Value) override;
+
+ virtual std::vector<std::pair<AString, AString>> GetValues(AString a_keyName) override;
+
+ virtual AString GetValue (const AString & keyname, const AString & valuename, const AString & defValue = "") const override;
+
+ virtual AString GetValueSet (const AString & keyname, const AString & valuename, const AString & defValue = "") 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 GetValueSetB(const AString & keyname, const AString & valuename, const bool defValue = false) override;
+
+ virtual bool SetValue (const AString & a_KeyName, const AString & a_ValueName, const AString & a_Value, const bool a_CreateIfNotExists = true) override;
+ virtual bool SetValueI(const AString & a_KeyName, const AString & a_ValueName, const int a_Value, const bool a_CreateIfNotExists = true) override;
+
+ virtual bool DeleteValue(const AString & keyname, const AString & valuename) override;
+
+ virtual bool Flush() override;
+
+private:
+
+ std::unique_ptr<cSettingsRepositoryInterface> m_Main;
+ std::unique_ptr<cSettingsRepositoryInterface> m_Overrides;
+
+};
+