Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5945 in orxonox.OLD for trunk/src/lib/parser/ini_parser/ini_parser.h


Ignore:
Timestamp:
Dec 6, 2005, 11:39:05 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: small rearangements

File:
1 edited

Legend:

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

    r5944 r5945  
    2727    struct IniEntry
    2828    {
    29       char*              name;     //!< name of a given Entry
    30       char*              value;    //!< value of a given Entry
     29      char*               comment;  //!< A Comment that is appendet to the Top of this Entry.
     30      char*               name;     //!< name of a given Entry
     31      char*               value;    //!< value of a given Entry
    3132    };
     33
    3234    //! a struct for Sections in the Parser's file
    3335    struct IniSection
    3436    {
    35       char*               name;    //!< name of a given section
    36       std::list<IniEntry> entries; //!< a list of entries for this section
     37      char*               comment;  //!< A Comment that is appendet to the Top of this Section.
     38      char*               name;     //!< name of a given section
     39      std::list<IniEntry> entries;  //!< a list of entries for this section
    3740    };
    3841    ////////////////////////////////////
     
    4245    ~IniParser ();
    4346
     47    /** @returns true if the file is opened, false otherwise*/
     48    bool isOpen() const { return (this->fileName != NULL)? true : false; };
     49    /** @returns the fileName we have opened. */
     50    const char* getFileName() const { return this->fileName; };
     51
    4452    bool readFile(const char* fileName);
    4553    bool writeFile(const char* fileName) const;
    4654
     55    void setFileComment(const char* fileComment);
     56    const char* getFileComment() const { return this->comment; };
     57
    4758    bool addSection(const char* sectionName);
    4859    bool getSection(const char* sectionName);
     60    void setSectionComment(const char* comment, const char* sectionName);
     61    const char* getSectionComment(const char* sectionNane) const;
    4962
    50     /** @returns true if the file is opened, false otherwise*/
    51     bool isOpen() const { return (this->fileName != NULL)? true : false; };
    52 
     63    // iterate through sections with these Functions
    5364    void firstSection();
    5465    const char* nextSection();
    5566
    56     /** @returns the fileName we have opened. */
    57     const char* getFileName() const { return this->fileName; };
    5867
    5968    bool addVar(const char* entryName, const char* value, const char* sectionName = NULL);
    6069    const char* getVar(const char* entryName, const char* sectionName, const char* defaultValue = "") const;
     70    const char* setEntryComment(const char* comment, const char* entryName, const char* sectionName);
     71    const char* getEntryComment(const char* entryName, const char* sectionName) const;
    6172
     73    // iterate Through Variables with these Functions.
    6274    void firstVar();
    6375    bool nextVar();
    6476
     77
     78    // retrieving functions when iterating.
    6579    const char* getCurrentSection() const;
    6680    const char* getCurrentName() const;
    6781    const char* getCurrentValue() const;
    6882
     83
     84    // maintenance.
    6985    void debug() const;
    7086
     
    7490    void setFileName(const char* fileName);
    7591
     92    std::list<IniSection>::const_iterator getSectionIT(const char* sectionName) const;
     93    std::list<IniEntry>::const_iterator getEntryIT(const char* entryName, const char* sectionName = NULL) const;
     94
    7695  private:
    7796    char*                            fileName;        //!< The name of the File that was parsed.
     97    char*                            comment;         //!< A Comment for the header of this File.
    7898    std::list<IniSection>            sections;        //!< a list of all stored Sections of the Parser
    7999    std::list<IniSection>::iterator  currentSection;  //!< the current selected Section
    80100    std::list<IniEntry>::iterator    currentEntry;    //!< the current selected entry (in currentSection)
     101
     102    std::list<char*>                 commentList;     //!< A list of Comments. (this is for temporary saving of Comments, that are inserted in front of Sections/Entries.)
    81103};
    82104
Note: See TracChangeset for help on using the changeset viewer.