| 1 | 
< | 
 /* | 
| 1 | 
> | 
/* | 
| 2 | 
  | 
 * Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. | 
| 3 | 
  | 
 * | 
| 4 | 
  | 
 * The University of Notre Dame grants you ("Licensee") a | 
| 48 | 
  | 
#include "utils/StringTokenizer.hpp" | 
| 49 | 
  | 
 | 
| 50 | 
  | 
namespace oopse { | 
| 51 | 
+ | 
   | 
| 52 | 
+ | 
  class ForceField; | 
| 53 | 
+ | 
   | 
| 54 | 
+ | 
  /** | 
| 55 | 
+ | 
  * @class SectionParser SectionParser.hpp "io/SectionParser.hpp" | 
| 56 | 
+ | 
   * @todo document | 
| 57 | 
+ | 
   */ | 
| 58 | 
+ | 
  class SectionParser { | 
| 59 | 
+ | 
  public: | 
| 60 | 
+ | 
    virtual ~SectionParser() {} | 
| 61 | 
+ | 
    void parse(std::istream& input, ForceField& ff, int lineNo); | 
| 62 | 
+ | 
     | 
| 63 | 
+ | 
    const std::string& getSectionName() const { | 
| 64 | 
+ | 
      return sectionName_; | 
| 65 | 
+ | 
    } | 
| 66 | 
+ | 
    virtual void validateSection() {} | 
| 67 | 
+ | 
  protected: | 
| 68 | 
+ | 
    void setSectionName(const std::string& sectionName) { | 
| 69 | 
+ | 
      sectionName_ = sectionName; | 
| 70 | 
+ | 
    } | 
| 71 | 
+ | 
     | 
| 72 | 
+ | 
  private: | 
| 73 | 
+ | 
    bool isEndSection(const std::string& line); | 
| 74 | 
+ | 
    virtual void parseLine(ForceField& ff, const std::string& line, int lineNo) = 0; | 
| 75 | 
  | 
 | 
| 76 | 
< | 
class ForceField; | 
| 76 | 
> | 
     | 
| 77 | 
> | 
    std::string sectionName_; | 
| 78 | 
> | 
  }; | 
| 79 | 
  | 
 | 
| 54 | 
– | 
    /** | 
| 55 | 
– | 
     * @class SectionParser SectionParser.hpp "io/SectionParser.hpp" | 
| 56 | 
– | 
     * @todo document | 
| 57 | 
– | 
     */ | 
| 58 | 
– | 
    class SectionParser { | 
| 59 | 
– | 
        public: | 
| 60 | 
– | 
            virtual ~SectionParser() {} | 
| 61 | 
– | 
            void parse(std::istream& input, ForceField& ff, int lineNo); | 
| 80 | 
  | 
 | 
| 63 | 
– | 
            const std::string& getSectionName() const { | 
| 64 | 
– | 
                return sectionName_; | 
| 65 | 
– | 
            } | 
| 66 | 
– | 
 | 
| 67 | 
– | 
        protected: | 
| 68 | 
– | 
            void setSectionName(const std::string& sectionName) { | 
| 69 | 
– | 
                sectionName_ = sectionName; | 
| 70 | 
– | 
            } | 
| 71 | 
– | 
             | 
| 72 | 
– | 
        private: | 
| 73 | 
– | 
 | 
| 74 | 
– | 
            bool isEndSection(const std::string& line); | 
| 75 | 
– | 
            virtual void parseLine(ForceField& ff, const std::string& line, int lineNo) = 0; | 
| 76 | 
– | 
            std::string sectionName_; | 
| 77 | 
– | 
    }; | 
| 78 | 
– | 
 | 
| 79 | 
– | 
 | 
| 81 | 
  | 
} | 
| 82 | 
  | 
 | 
| 83 | 
  | 
#endif //IO_SECTIONPARSER_HPP |