Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Oct 10, 2006, 4:23:28 PM (18 years ago)
Author:
bensch
Message:

many doxygen tags

File:
1 edited

Legend:

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

    r9880 r9881  
    88#ifndef _INI_PARSER_H
    99#define _INI_PARSER_H
    10 
    11 #define PARSELINELENGHT     512       //!< how many chars to read at once
    1210
    1311#include <string>
     
    2220public:
    2321  ////////////////////////////////////
    24   /// A Node for a Ini-Node. The base of all INI-elements.
     22  /// A class for a Ini-Node. The base of all INI-elements.
    2523  class Node
    2624  {
    2725  public:
    2826    Node(const std::string& name, const std::string& comment = "");
     27    //! Simple destructor
    2928    virtual ~Node() {};
     29    /** @returns the name of the Node */
    3030    const std::string& name() const  { return _name; };
     31    /** @returns the Comment of the Node */
    3132    const std::string& comment() const  { return _comment; };
     33    /** @param name the name to set for this node */
    3234    void setName(const std::string& name) { this->_name = name; };
     35    /** @param comment the Comment to set for this node */
    3336    void setComment(const std::string& comment) { this->_comment = comment; };
    3437
     38    /** @param name the name to compare against this nodes name @returns true on match */
    3539    bool operator==(const std::string& name) const { return _name == name; };
    36     bool operator==(const Node& node) const { return this->_name == node._name; };
    37 
     40
     41    /** @brief displays some debug information about the node */
    3842    virtual void debug() const = 0;
    3943
     
    4852  public:
    4953    Entry(const std::string& name, const std::string& value = "", const std::string& comment = "");
     54    /** @returns the Value of the Entry */
    5055    const std::string& value() const { return _value; };
     56    /** @param value sets the value of the Entry */
    5157    void setValue (const std::string& value) { _value = value; };
    5258
     
    5460
    5561  public:
    56     typedef std::list<Entry>                    list;
    57     typedef list::iterator                      iterator;
    58     typedef list::const_iterator                const_iterator;
    59 
    60   private:
    61     std::string         _value;    //!< value of a given Entry
     62    typedef std::list<Entry>       list;           //!< A Type definition for lists of Entries.
     63    typedef list::iterator         iterator;       //!< A Type definition for iterators of Entries.
     64    typedef list::const_iterator   const_iterator; //!< A Type definition for constant iterators of Entries.
     65
     66  private:
     67    std::string                    _value;         //!< value of a given Entry
    6268  };
    6369
     
    7581    const std::string& getEntryComment(const std::string& entryName) const;
    7682
     83    /** @returns the List of Entries */
    7784    const Entry::list& entries() const { return _entries; }
    7885    Entry* getEntry(const std::string& entryName);
    7986
    8087    Entry::const_iterator getEntryIt(const std::string& entryName) const;
     88    /** @returns an Iterator pointing to the beginning of the entries. */
    8189    Entry::iterator begin() { return _entries.begin(); };
     90    /** @returns a constant Iterator pointing to the beginning of the entries */
    8291    Entry::const_iterator begin() const { return _entries.begin(); };
     92    /** @returns an Iterator pointing to the end of the entries */
    8393    Entry::iterator end() { return _entries.end(); };
     94    /** @returns a constant Iterator pointing to the end of the entries */
    8495    Entry::const_iterator end() const { return _entries.end(); };
    8596
     
    89100
    90101  public:
    91     typedef std::list<Section>                  list;
    92     typedef list::iterator                      iterator;
    93     typedef list::const_iterator                const_iterator;
    94 
    95   private:
    96     Entry::list     _entries;  //!< a list of entries for this section
     102    typedef std::list<Section>      list;            //!< A Type definition for lists of Sections
     103    typedef list::iterator          iterator;        //!< A Type definition for iterators of Sectionlists.
     104    typedef list::const_iterator    const_iterator;  //!< A Type definition for constant iterators of Sectionlists.
     105
     106  private:
     107    Entry::list                     _entries;        //!< a list of entries for this section
    97108  };
    98109
     
    107118    bool setSectionComment(const std::string& sectionName, const std::string& comment);
    108119
     120    /** @returns list of all sections */
    109121    const Section::list& sections() const { return _sections; }
    110122    Section* getSection(const std::string& sectionName);
    111123
    112124    Section::const_iterator getSectionIt(const std::string& sectionName) const;
     125    /** @returns an Iterator poining to the beginning of the Sections List */
    113126    Section::iterator begin() { return _sections.begin(); };
     127    /** @returns a constant Iterator poining to the beginning of the Sections List */
    114128    Section::const_iterator begin() const { return _sections.begin(); };
     129    /** @returns an Iterator poining to the end of the Sections List */
    115130    Section::iterator end() { return _sections.end(); };
     131    /** @returns a constant Iterator poining to the end of the Sections List */
    116132    Section::const_iterator end() const { return _sections.end(); };
    117133
     
    128144
    129145  private:
    130     Section::list            _sections;        //!< a list of all stored Sections of the Parser.
     146    Section::list       _sections;        //!< a list of all stored Sections of the Parser.
    131147  };
    132148
     
    142158  /// Read and Write the File
    143159  bool readFile(const std::string& fileName, bool keepSettings = false);
    144   bool writeFile(const std::string& fileName) const;
     160  bool writeFile(const std::string& fileName = "") const;
    145161
    146162  void setFileComment(const std::string& fileComment);
     163  /** @returns comments for the File. */
    147164  const std::string& getFileComment() const { return this->_document.comment(); };
    148165
     
    150167  Section& addSection(const std::string& sectionName);
    151168  // iterate through sections with these Functions
     169  //! see Section::getSection()
    152170  Section* getSection(const std::string& sectionName) { return this->_document.getSection(sectionName); };
    153171  Section::const_iterator getSectionIt(const std::string& sectionName) const;
    154172
     173  //! see Section::begin()
    155174  Section::iterator begin() { return this->_document.begin(); };
     175  //! see Section::begin()
    156176  Section::const_iterator begin() const { return this->_document.begin(); };
     177    //! see Section::end()
    157178  Section::iterator end() { return this->_document.end(); };
     179    //! see Section::end()
    158180  Section::const_iterator end() const { return this->_document.end(); };
    159181
     
    175197  void setNodeComment(Node* node, std::list<std::string>* comments);
    176198private:
    177   std::string                      _fileName;
    178   Document                         _document;
     199  std::string                      _fileName;        //!< The name of the File that is parsed here.
     200  Document                         _document;        //!< The Document inside of the file.
    179201
    180202  static const std::string         _emptyString;     //!< Just an Empty String that will be returned if nothing else is found.
Note: See TracChangeset for help on using the changeset viewer.