diff options
author | Jef <jef@targetspot.com> | 2024-09-24 08:54:57 -0400 |
---|---|---|
committer | Jef <jef@targetspot.com> | 2024-09-24 08:54:57 -0400 |
commit | 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch) | |
tree | 12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Wasabi/api/config/config.h | |
parent | 537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff) | |
download | winamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz |
Initial community commit
Diffstat (limited to 'Src/Wasabi/api/config/config.h')
-rw-r--r-- | Src/Wasabi/api/config/config.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/Src/Wasabi/api/config/config.h b/Src/Wasabi/api/config/config.h new file mode 100644 index 00000000..0f027b61 --- /dev/null +++ b/Src/Wasabi/api/config/config.h @@ -0,0 +1,43 @@ +#ifndef _CONFIG_H +#define _CONFIG_H + +#include <bfc/string/bfcstring.h> +#include <bfc/pair.h> +#include <bfc/critsec.h> +#include <bfc/string/StringW.h> + +class StringPair : public Pair<StringW, StringW> +{ +public: + StringPair(StringW &_a, const wchar_t *_b) + { + b=_b; + a.swap(_a); + } +}; + +class ConfigFile +{ +public: + ConfigFile(const wchar_t *section, const wchar_t *name); + ~ConfigFile(); + + static void initialize(); + + void setInt(const wchar_t *name, int val); + int getInt(const wchar_t *name, int default_val); + + void setString(const wchar_t *name, const wchar_t *str); + int getString(const wchar_t *name, wchar_t *buf, int buf_len, const wchar_t *default_str); + + int getStringLen(const wchar_t *name); + +private: + StringW sectionname; + StringW prettyname; + StringPair *getPair(const wchar_t *name); + StringPair *makePair(const wchar_t *name, const wchar_t *value); + CriticalSection cs; +}; + +#endif |