Changeset 5945 in orxonox.OLD for trunk/src/lib/parser/ini_parser/ini_parser.h
- Timestamp:
- Dec 6, 2005, 11:39:05 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/parser/ini_parser/ini_parser.h
r5944 r5945 27 27 struct IniEntry 28 28 { 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 31 32 }; 33 32 34 //! a struct for Sections in the Parser's file 33 35 struct IniSection 34 36 { 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 37 40 }; 38 41 //////////////////////////////////// … … 42 45 ~IniParser (); 43 46 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 44 52 bool readFile(const char* fileName); 45 53 bool writeFile(const char* fileName) const; 46 54 55 void setFileComment(const char* fileComment); 56 const char* getFileComment() const { return this->comment; }; 57 47 58 bool addSection(const char* sectionName); 48 59 bool getSection(const char* sectionName); 60 void setSectionComment(const char* comment, const char* sectionName); 61 const char* getSectionComment(const char* sectionNane) const; 49 62 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 53 64 void firstSection(); 54 65 const char* nextSection(); 55 66 56 /** @returns the fileName we have opened. */57 const char* getFileName() const { return this->fileName; };58 67 59 68 bool addVar(const char* entryName, const char* value, const char* sectionName = NULL); 60 69 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; 61 72 73 // iterate Through Variables with these Functions. 62 74 void firstVar(); 63 75 bool nextVar(); 64 76 77 78 // retrieving functions when iterating. 65 79 const char* getCurrentSection() const; 66 80 const char* getCurrentName() const; 67 81 const char* getCurrentValue() const; 68 82 83 84 // maintenance. 69 85 void debug() const; 70 86 … … 74 90 void setFileName(const char* fileName); 75 91 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 76 95 private: 77 96 char* fileName; //!< The name of the File that was parsed. 97 char* comment; //!< A Comment for the header of this File. 78 98 std::list<IniSection> sections; //!< a list of all stored Sections of the Parser 79 99 std::list<IniSection>::iterator currentSection; //!< the current selected Section 80 100 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.) 81 103 }; 82 104
Note: See TracChangeset
for help on using the changeset viewer.