diff options
author | Max Horn | 2002-09-08 01:08:12 +0000 |
---|---|---|
committer | Max Horn | 2002-09-08 01:08:12 +0000 |
commit | 523d8e64c0bc66b75cdd7f12fc9d9d87b28a8c36 (patch) | |
tree | 01c96c7b834d32b05cf33b15b6631614d22da187 /common/config-file.h | |
parent | 943de561bf51d4e553be44fe612eab94e5c00391 (diff) | |
download | scummvm-rg350-523d8e64c0bc66b75cdd7f12fc9d9d87b28a8c36.tar.gz scummvm-rg350-523d8e64c0bc66b75cdd7f12fc9d9d87b28a8c36.tar.bz2 scummvm-rg350-523d8e64c0bc66b75cdd7f12fc9d9d87b28a8c36.zip |
rewrote config class; cleanup; code restructuring
svn-id: r4903
Diffstat (limited to 'common/config-file.h')
-rw-r--r-- | common/config-file.h | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/common/config-file.h b/common/config-file.h index eee4cfde59..594b4814c0 100644 --- a/common/config-file.h +++ b/common/config-file.h @@ -23,31 +23,39 @@ #ifndef CONFIG_FILE_H #define CONFIG_FILE_H -class hashconfig; +#include "common/util.h" +#include "common/map.h" +#include "common/str.h" class Config { public: - Config (const char * = "config.cfg", const char * = "default"); - ~Config (); - const char *get(const char *key, const char *dom = 0) const; - const int getInt(const char *key, int def = 0, const char *dom = 0) const; - const bool getBool(const char *key, bool def = false, const char *dom = 0) const; + typedef ScummVM::String String; - const char *set(const char *key, const char *value, const char *dom = 0); - const char *set(const char *key, int value, const char *dom = 0); - const char *set(const char *key, bool value, const char *dom = 0); + Config (const String & = String("config.cfg"), const String & = String("default")); + const char *get(const String &key, const String &dom = String()) const; + const int getInt(const String &key, int def = 0, const String &dom = String()) const; + const bool getBool(const String &key, bool def = false, const String &dom = String()) const; - void set_domain(const char *); + void set(const String &key, const String &value, const String &dom = String()); + void setInt(const String &key, int value, const String &dom = String()); + void setBool(const String &key, bool value, const String &dom = String()); + + void set_domain(const String &); void flush() const; - void rename_domain(const char *); - void delete_domain(const char *); - void change_filename(const char *); - void merge_config(const Config *); + void rename_domain(const String &); + void delete_domain(const String &); + void set_filename(const String &); + void merge_config(const Config &); void set_writing(bool); -private: - char *filename, *domain; - hashconfig **hash; - int ndomains; + +protected: + typedef ScummVM::StringMap StringMap; + typedef ScummVM::Map<String, StringMap> DomainMap; + + DomainMap domains; + String filename; + String defaultDomain; + bool willwrite; }; |