]> cygwin.com Git - cygwin-apps/setup.git/blob - UserSettings.cc
2003-03-10 Robert Collins <rbtcollins@hotmail.com>
[cygwin-apps/setup.git] / UserSettings.cc
1 /*
2 * Copyright (c) 2003, Robert Collins
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * A copy of the GNU General Public License can be found at
10 * http://www.gnu.org/
11 *
12 * Written by Robert Collins <rbtcollins@hotmail.com>
13 *
14 */
15
16 #if 0
17 static const char *cvsid =
18 "\n%%% $Id$\n";
19 #endif
20
21 #include "site.h"
22 #include "win32.h"
23 #include <stdio.h>
24 #include <stdlib.h>
25 #include <string.h>
26 #include <process.h>
27 #include <algorithm>
28
29 #include "LogSingleton.h"
30 #include "io_stream.h"
31
32 #include "port.h"
33 #include "Exception.h"
34 #include "UserSettings.h"
35
36 using namespace std;
37
38 UserSettings &
39 UserSettings::Instance()
40 {
41 return Instance_;
42 if (Instance_.inited != 42)
43 Instance_.init ();
44 return Instance_;
45 }
46
47 void
48 UserSettings::init ()
49 {
50 inited = 42;
51 }
52
53 UserSettings UserSettings::Instance_;
54
55 void
56 UserSettings::registerSetting(UserSetting &aSetting)
57 {
58 settings.push_back(&aSetting);
59 }
60
61 void
62 UserSettings::deRegisterSetting(UserSetting &aSetting)
63 {
64 Settings::iterator i = find(settings.begin(), settings.end(), &aSetting);
65 if (i == settings.end())
66 throw new Exception ("__LINE__ __FILE__", String ("Attempt to deregister non registered setting!"), APPERR_LOGIC_ERROR);
67 settings.erase(i);
68 }
This page took 0.035899 seconds and 5 git commands to generate.