diff options
author | Jean-Francois Mauguit <jfmauguit@mac.com> | 2024-09-24 09:03:25 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-24 09:03:25 -0400 |
commit | bab614c421ed7ae329d26bf028c4a3b1d2450f5a (patch) | |
tree | 12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Wasabi/api/config/config.h | |
parent | 4bde6044fddf053f31795b9eaccdd2a5a527d21f (diff) | |
parent | 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (diff) | |
download | winamp-bab614c421ed7ae329d26bf028c4a3b1d2450f5a.tar.gz |
Merge pull request #5 from WinampDesktop/community
Merge to main
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 |