]> cygwin.com Git - cygwin-apps/setup.git/blob - UserSettings.h
Don't propagate actions down category tree into obsolete categories
[cygwin-apps/setup.git] / UserSettings.h
1 /* UserSettings.h
2
3 Copyright (c) 2009, Christopher Faylor
4
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.
9
10 A copy of the GNU General Public License can be found at http://www.gnu.org
11 */
12
13 #ifndef SETUP_USERSETTINGS_H
14 #define SETUP_USERSETTINGS_H
15
16 #include <string>
17 #include "io_stream.h"
18
19 class UserSettings
20 {
21 private:
22 struct Element
23 {
24 const char *key;
25 const char *value;
26 } **table;
27 ssize_t table_len;
28
29 std::string filename;
30 std::string cwd;
31
32 public:
33 static class UserSettings *global;
34 UserSettings (std::string);
35 static UserSettings& instance() {return *global;}
36
37 const char *get (const char *);
38 unsigned int get_index (const char *key);
39 io_stream *open (const char *);
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 save ();
43
44 private:
45 void extend_table (ssize_t);
46 io_stream *open_settings (const char *, std::string&);
47
48 };
49
50 #endif // SETUP_USERSETTINGS_H
This page took 0.035941 seconds and 5 git commands to generate.