Wire up de-DE and pl-PL translations
[cygwin-setup.git] / UserSettings.h
blob3de06e1d1adc844b176eb88fb9cb69e294d64c95
1 /* UserSettings.h
3 Copyright (c) 2009, Christopher Faylor
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 A copy of the GNU General Public License can be found at http://www.gnu.org
13 #ifndef SETUP_USERSETTINGS_H
14 #define SETUP_USERSETTINGS_H
16 #include <string>
17 #include "io_stream.h"
19 class UserSettings
21 private:
22 struct Element
24 const char *key;
25 const char *value;
26 } **table;
27 ssize_t table_len;
29 std::string filename;
30 std::string cwd;
32 public:
33 static class UserSettings *global;
34 UserSettings ();
35 static UserSettings& instance() {return *global;}
37 const char *get (const char *);
38 unsigned int get_index (const char *key);
39 io_stream *open (const char *); // opens an iostream you can write to set the value of key
40 const char *set (const char *, const char *);
41 const char *set (const char *key, const std::string val) {return set (key, val.c_str ());}
42 void load (std::string local_dir);
43 void save ();
45 private:
46 void extend_table (ssize_t);
47 io_stream *open_settings (const char *, std::string&);
51 #endif // SETUP_USERSETTINGS_H