Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9884 in orxonox.OLD for trunk/src/lib/parser/preferences


Ignore:
Timestamp:
Oct 12, 2006, 9:51:45 AM (18 years ago)
Author:
bensch
Message:

some movements

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/parser/preferences/preferences.h

    r9869 r9884  
    1515class IniFilePrefsReader;
    1616
    17 typedef struct {
    18   std::string name;
    19   MultiType value;
    20   bool modified;
    21 } prefItem;
     17//! A default singleton class.
     18class Preferences : public BaseObject
     19{
     20  ObjectListDeclaration(Preferences);
     21public:
     22  virtual ~Preferences(void);
     23  /** @returns a Pointer to the only object of this Class */
     24  inline static Preferences* getInstance(void) { if (!singletonRef) singletonRef = new Preferences();  return singletonRef; };
    2225
    23 typedef struct {
    24   std::string sectionName;
    25   std::list<prefItem> items;
    26 } prefSection ;
     26  //check if this entry exists
     27  bool sectionExists(const std::string& section );
     28  bool exists(const std::string& section, const std::string& name);
     29
     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);
     34
     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);
     39
     40  void setUserIni(const std::string& fileName);
     41
     42  bool save();
     43
     44  void debug();
     45
     46  std::list<std::string> listKeys( const std::string section );
     47
     48private:
     49  typedef struct
     50  {
     51    std::string name;
     52    MultiType value;
     53    bool modified;
     54  }
     55  prefItem;
     56
     57  typedef struct
     58  {
     59    std::string sectionName;
     60    std::list<prefItem> items;
     61  }
     62  prefSection ;
    2763
    2864
    29 //! A default singleton class.
    30 class Preferences : public BaseObject {
    31   ObjectListDeclaration(Preferences);
    32  public:
    33    virtual ~Preferences(void);
    34   /** @returns a Pointer to the only object of this Class */
    35    inline static Preferences* getInstance(void) { if (!singletonRef) singletonRef = new Preferences();  return singletonRef; };
     65private:
     66  Preferences(void);
    3667
    37    //check if this entry exists
    38    bool sectionExists(const std::string& section );
    39    bool exists(const std::string& section, const std::string& name);
     68private:
     69  static Preferences* singletonRef;
    4070
    41    void setString(const std::string& section, const std::string& name, const std::string& value, bool dontSetModified = false);
    42    void setInt(const std::string& section, const std::string& name, int value, bool dontSetModified = false);
    43    void setFloat(const std::string& section, const std::string& name, float value, bool dontSetModified = false);
    44    void setMultiType(const std::string& section, const std::string& name, const MultiType& value, bool dontSetModified = false);
     71  std::list<prefSection> data;
    4572
    46    std::string getString(const std::string& section, const std::string& name, const std::string& defaultValue);
    47    int getInt(const std::string& section, const std::string& name, int defaultValue);
    48    float getFloat(const std::string& section, const std::string& name, float defaultValue);
    49    MultiType getMultiType(const std::string& section, const std::string& name, const MultiType& defaultValue);
     73  std::list<IniFilePrefsReader*> iniFilePrefsReaders;
    5074
    51    void setUserIni(const std::string& fileName);
    52 
    53    bool save();
    54 
    55    void debug();
    56 
    57    std::list<std::string> listKeys( const std::string section );
    58 
    59 
    60  private:
    61    Preferences(void);
    62    static Preferences* singletonRef;
    63 
    64    std::list<prefSection> data;
    65 
    66    std::list<IniFilePrefsReader*> iniFilePrefsReaders;
    67 
    68    std::string fileName;
     75  std::string fileName;
    6976
    7077};
Note: See TracChangeset for help on using the changeset viewer.