ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-4/src/io/SectionParserManager.cpp
(Generate patch)

Comparing branches/new_design/OOPSE-4/src/io/SectionParserManager.cpp (file contents):
Revision 1765 by tim, Mon Nov 22 20:55:52 2004 UTC vs.
Revision 1801 by tim, Tue Nov 30 04:43:29 2004 UTC

# Line 30 | Line 30 | SectionParserManager::~SectionParserManager() {
30   SectionParserManager::~SectionParserManager() {
31      SectionParserManager::iterator i;
32      for (i = sectionParsers_.begin(); i != sectionParsers_.end(); ++i) {
33 <        delete (i->sp);
33 >        delete (i->sectionParser);
34      }
35      sectionParsers_.clear();
36   }
37  
38 < void SectionParserManager::parse(ifstrstream& input, ForceField& ff) {
38 > void SectionParserManager::parse(std::istream& input, ForceField& ff) {
39  
40      //reset active flags
41      SectionParserManager::iterator i;
# Line 49 | Line 49 | void SectionParserManager::parse(ifstrstream& input, F
49      //scan through the input stream and find section names        
50      while(input.getline(buffer, bufferSize)) {
51          ++lineNo;
52 <        line = LeftTrim(buffer);
53 <
52 >        /**@todo implement trimLeft() */
53 >        //std::string line = LeftTrim(buffer);
54 >        std::string line= buffer;
55          //a line begins with "//" is comment
56          if ( line.empty() || (line.size() >= 2 && line[0] == '/' && line[1] == '/')) {
57              continue;
# Line 67 | Line 68 | void SectionParserManager::parse(ifstrstream& input, F
68  
69                  std::string section = tokenizer.nextToken();
70  
71 <                i = std::find_if(sectionParsers_.begin(), sectionParsers_.end(), predict);
71 >                i = std::find_if(sectionParsers_.begin(), sectionParsers_.end(), SameSectionParserFunctor(section));
72                  if (i == sectionParsers_.end()){
73                      //can not find corresponding section parser
74                      std::cerr << "Can not find corresponding section parser for section: " << section << std::endl;
75                  } else {
76                      i->isActive = true;
77                      i->lineNo = lineNo;
78 <                    i->offset = input->tellg();
78 >                    i->offset = input.tellg();
79                  }
80                  
81              }
# Line 86 | Line 87 | void SectionParserManager::parse(ifstrstream& input, F
87      //invoke parser
88      for (i = sectionParsers_.begin(); i != sectionParsers_.end(); ++i) {
89          if (i->isActive) {
90 <            input->seekg(i->offset);
90 >            input.seekg(i->offset);
91              (i->sectionParser)->parse(input, ff, i->lineNo);
92          }
93      }
# Line 171 | Line 172 | iterator SectionParserManager::findSectionParser(const
172   }
173  
174  
175 < iterator SectionParserManager::findSectionParser(const std::string& sectionName) {
175 > SectionParserManager::iterator SectionParserManager::findSectionParser(const std::string& sectionName) {
176      SectionParserManager::iterator i;
177      for (i = sectionParsers_.begin(); i != sectionParsers_.end(); ++i) {
178          if (i->sectionParser->getSectionName() == sectionName) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines