Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/util/preferences.h @ 7703

Last change on this file since 7703 was 7661, checked in by bensch, 19 years ago

orxonox/trunk: merged the QT_GUI back to the trunk
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/qt_gui . -r7607:HEAD

absolutely no conflicts :)

File size: 2.1 KB
RevLine 
[6380]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
[6388]14class IniFilePrefsReader;
[6380]15
16typedef struct {
[7236]17  std::string name;
[6380]18  MultiType value;
[6388]19  bool modified;
[6380]20} prefItem;
21
22typedef struct {
[7236]23  std::string sectionName;
[6380]24  std::list<prefItem> items;
25} prefSection ;
26
27
28//! A default singleton class.
29class Preferences : public BaseObject {
30
31 public:
32   virtual ~Preferences(void);
33  /** @returns a Pointer to the only object of this Class */
34   inline static Preferences* getInstance(void) { if (!singletonRef) singletonRef = new Preferences();  return singletonRef; };
35
36   //check if this entry exists
[7248]37   bool sectionExists(const std::string& section );
[7236]38   bool exists(const std::string& section, const std::string& name);
[6380]39
[7236]40   void setString(const std::string& section, const std::string& name, const std::string& value, bool dontSetModified = false);
41   void setInt(const std::string& section, const std::string& name, int value, bool dontSetModified = false);
42   void setFloat(const std::string& section, const std::string& name, float value, bool dontSetModified = false);
[7243]43   void setMultiType(const std::string& section, const std::string& name, const MultiType& value, bool dontSetModified = false);
[6380]44
[7661]45   std::string getString(const std::string& section, const std::string& name, const std::string& defaultValue);
[7236]46   int getInt(const std::string& section, const std::string& name, int defaultValue);
47   float getFloat(const std::string& section, const std::string& name, float defaultValue);
48   MultiType getMultiType(const std::string& section, const std::string& name, const MultiType& defaultValue);
[6380]49
[7236]50   void setUserIni(const std::string& fileName);
[6380]51
[6388]52   bool save();
53
[6381]54   void debug();
[7661]55
[7248]56   std::list<std::string> listKeys( const std::string section );
[6381]57
58
[6380]59 private:
60   Preferences(void);
61   static Preferences* singletonRef;
62
63   std::list<prefSection> data;
[6388]64
65   std::list<IniFilePrefsReader*> iniFilePrefsReaders;
66
[7244]67   std::string fileName;
[6388]68
[6380]69};
70
71#endif /* _PREFERENCES_H */
Note: See TracBrowser for help on using the repository browser.