Adds further ext deps as-is binaries copies from customers env.
Qt6 Migration CI / migrate (push) Canceled after 0s
Qt6 Migration CI / migrate (push) Canceled after 0s
This commit is contained in:
3700 files changed
+2132394
No files matched your search
+61
@@ -0,0 +1,61 @@
|
||||
#pragma once
|
||||
|
||||
#include "ddkit/base/Config.hpp"
|
||||
#include "ddkit/base/IConfigWrite.hpp"
|
||||
|
||||
#include <set>
|
||||
#include <map>
|
||||
|
||||
namespace ddkit {
|
||||
namespace base {
|
||||
|
||||
/// @brief ConfigRw (ReadWrite) is constructed with a normal Config (read, from a file) and enables overwrite of keys as well.
|
||||
/// additionally it may be checked, which keys are allowed
|
||||
class ConfigRw : public IConfig,
|
||||
public IConfigWrite {
|
||||
|
||||
public:
|
||||
ConfigRw();
|
||||
ConfigRw(Config& config);
|
||||
ConfigRw(const ConfigRw&);
|
||||
void operator=(const ConfigRw&);
|
||||
|
||||
// IConfig
|
||||
bool hasKey(const std::string& key) const override;
|
||||
std::string getStringValue(const std::string& key) const override;
|
||||
int getIntValue(const std::string& key) const override;
|
||||
int64_t getInt64Value(const std::string& key) const override;
|
||||
bool getBoolValue(const std::string& key) const override;
|
||||
|
||||
// IConfigWrite
|
||||
void setStringValue(const std::string& key, const std::string& value) override;
|
||||
void setIntValue(const std::string& key, int value) override;
|
||||
void setInt64Value(const std::string& key, int64_t value) override;
|
||||
void setBoolValue(const std::string& key, bool value) override;
|
||||
|
||||
// activate checks. i.e. foo.bar -> section foo and key bar
|
||||
void registerKnownConfigKey(
|
||||
const std::string& section,
|
||||
const std::string& key);
|
||||
|
||||
void checkConfig() const; // check in file (only for corresponding top-level)
|
||||
|
||||
private:
|
||||
// the 'real' BaseConfig (ConfigFile from ConfigLoader)
|
||||
Config m_config;
|
||||
|
||||
// the overwritten key-values
|
||||
std::vector<std::string> m_keys;
|
||||
std::map<std::string, std::string> m_key2stringValue;
|
||||
std::map<std::string, int> m_key2intValue;
|
||||
std::map<std::string, int64_t> m_key2int64Value;
|
||||
std::map<std::string, bool> m_key2boolValue;
|
||||
|
||||
// keys allowed
|
||||
std::map<std::string, std::vector<std::string>> m_knownKeysMap;
|
||||
void checkKey(const std::string& key) const;
|
||||
void checkConfig(const std::string& prefix) const; // check in file
|
||||
};
|
||||
|
||||
} // namespace base
|
||||
} // namespace ddkit
|
||||
Reference in new issue
Block a user