Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/preferences/src/lib/util/preferences.h @ 6381

Last change on this file since 6381 was 6381, checked in by rennerc, 18 years ago

preferences: added debug function

File size: 1.5 KB
Line 
1/*!
2 * @file proto_singleton.h
3 * @brief Definition of the ... singleton Class
4*/
5
6#ifndef _PREFERENCES_H
7#define _PREFERENCES_H
8
9#include "base_object.h"
10#include "multi_type.h"
11
12// FORWARD DECLARATION
13
14
15typedef struct {
16  char* name;
17  MultiType value;
18} prefItem;
19
20typedef struct {
21  char* sectionName;
22  std::list<prefItem> items;
23} prefSection ;
24
25
26//! A default singleton class.
27class Preferences : public BaseObject {
28
29 public:
30   virtual ~Preferences(void);
31  /** @returns a Pointer to the only object of this Class */
32   inline static Preferences* getInstance(void) { if (!singletonRef) singletonRef = new Preferences();  return singletonRef; };
33
34   //check if this entry exists
35   bool exists(const char* section, const char* name);
36
37   void setString(const char* section, const char* name, const char* value);
38   void setInt(const char* section, const char* name, int value);
39   void setFloat(const char* section, const char* name, float value);
40   void setMultiType(const char* section, const char* name, const MultiType& value);
41
42   const char* getString(const char* section, const char* name, const char* defaultValue);
43   int getInt(const char* section, const char* name, int defaultValue);
44   float getFloat(const char* section, const char* name, float defaultValue);
45   MultiType getMultiType(const char* section, const char* name, const MultiType& defaultValue);
46
47
48   void debug();
49
50
51 private:
52   Preferences(void);
53   static Preferences* singletonRef;
54
55   std::list<prefSection> data;
56};
57
58#endif /* _PREFERENCES_H */
Note: See TracBrowser for help on using the repository browser.