]> cygwin.com Git - cygwin-apps/setup.git/blame - UserSettings.h
Use solver to check for problems and produce a list of package transactions
[cygwin-apps/setup.git] / UserSettings.h
CommitLineData
f26f525f
CF
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*/
ead15931 12
c93bc6d0
MB
13#ifndef SETUP_USERSETTINGS_H
14#define SETUP_USERSETTINGS_H
ead15931 15
08678720 16#include <string>
f26f525f
CF
17#include "io_stream.h"
18
19class UserSettings
20{
21private:
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
32public:
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
44private:
45 void extend_table (ssize_t);
46 io_stream *open_settings (const char *, std::string&);
47
ead15931
RC
48};
49
f26f525f 50#endif // SETUP_USERSETTINGS_H
This page took 0.062706 seconds and 5 git commands to generate.