Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/parser/preferences/preferences.h @ 10388

Last change on this file since 10388 was 9884, checked in by bensch, 18 years ago

some movements

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