Changeset 9883 in orxonox.OLD for trunk/src/lib/parser/ini_parser/ini_parser.cc
- Timestamp:
- Oct 12, 2006, 9:21:29 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/parser/ini_parser/ini_parser.cc
r9881 r9883 16 16 now the File is parsed at the initialisation, 17 17 and informations is gathered there. 18 2006-10-10: Complete reimplementation again :) 19 New STL-like style. The Parser has no state itself 20 Elements as Nodes 18 21 */ 19 22 … … 264 267 * @return True on success (section was found). 265 268 */ 266 bool IniParser::Document::setSection Comment(const std::string& sectionName, const std::string& comment)269 bool IniParser::Document::setSectionsComment(const std::string& sectionName, const std::string& comment) 267 270 { 268 271 Section::iterator section = std::find(this->_sections.begin(), this->_sections.end(), sectionName); … … 276 279 } 277 280 278 281 /** 282 * @brief Retrieves the comment for a specified section 283 * @param sectionName The name of the section 284 * @returns The Comment of the section. 285 */ 286 const std::string& IniParser::Document::getSectionsComment(const std::string& sectionName) const 287 { 288 Section::const_iterator section = std::find(this->_sections.begin(), this->_sections.end(), sectionName); 289 if (section != this->_sections.end()) 290 { 291 return (*section).comment(); 292 } 293 else 294 return IniParser::_emptyString; 295 } 279 296 280 297 /** … … 607 624 } 608 625 609 void IniParser::setFileComment(const std::string& fileComment)610 {611 this->_document.setComment(fileComment);612 }613 614 /**615 * @brief adds a section to the list of Sections,616 * if no Section list is availiable, it will create it617 * @param sectionName the Name of the section to add618 * @return true on success... there is only success or segfault :)619 */620 IniParser::Section& IniParser::addSection(const std::string& sectionName)621 {622 return this->_document.addSection(sectionName);623 }624 625 626 /**627 * @brief adds a new Entry to either the currentSection or the section called by sectionName628 * @param entryName the Name of the Entry to add629 * @param value the value to assign to this entry630 * @param sectionName if NULL then this entry will be set to the currentSection631 * otherwise to the section refered to by sectionName.632 * If both are NULL no entry will be added633 * @return The Entry, that was added.634 */635 bool IniParser::addEntry(const std::string& sectionName, const std::string& entryName, const std::string& value, const std::string& comment)636 {637 return this->_document.addEntry(sectionName, entryName, value, comment);638 }639 640 /**641 * @brief edits the entry speciefied by entryName in sectionName/currentSection or creates it if it doesn't exist642 * @param entryName the Name of the Entry to add643 * @param value the value to assign to this entry644 * @param sectionName if NULL then this entry will be set to the currentSection645 * otherwise to the section refered to by sectionName.646 * If both are NULL no entry will be added647 * @return true if everything is ok false on error648 */649 bool IniParser::editEntry(const std::string& sectionName, const std::string& entryName, const std::string& value, bool createMissing)650 {651 return this->_document.editEntry(sectionName, entryName, value, createMissing);652 }653 654 655 /**656 * @brief directly acesses an entry in a section657 * @param sectionName: the section where the entry is to be found658 * @param entryName: the name of the entry to find659 * @param defaultValue: what should be returned in case the entry cannot be found660 * @return The Value of the Entry.661 */662 const std::string& IniParser::getValue(const std::string& sectionName, const std::string& entryName, const std::string& defaultValue) const663 {664 return this->_document.getValue(sectionName, entryName, defaultValue);665 }666 667 /**668 * Set the Comment of a specified Entry.669 * @param comment the Comment to set670 * @param entryName the Name of the Entry671 * @param sectionName the Name of the Section672 */673 void IniParser::setEntryComment(const std::string& sectionName, const std::string& entryName, const std::string& comment)674 {675 this->_document.setEntryComment(sectionName, entryName, comment);676 }677 678 /**679 * @param entryName the Entry to query for680 * @param sectionName the Section to Query for681 * @returns the queried Comment.682 */683 const std::string& IniParser::getEntryComment(const std::string& sectionName, const std::string& entryName) const684 {685 return this->_document.getEntryComment(sectionName, entryName);686 }687 626 688 627 /**
Note: See TracChangeset
for help on using the changeset viewer.