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

Comparing branches/new_design/OOPSE-3.0/src/io/SectionParserManager.cpp (file contents):
Revision 1789 by tim, Mon Nov 29 15:27:43 2004 UTC vs.
Revision 1840 by tim, Fri Dec 3 00:26:07 2004 UTC

# Line 24 | Line 24
24   */
25  
26   #include "io/SectionParserManager.hpp"
27 + #include "utils/Trim.hpp"
28  
29   namespace oopse {
30  
# Line 49 | Line 50 | void SectionParserManager::parse(std::istream& input,
50      //scan through the input stream and find section names        
51      while(input.getline(buffer, bufferSize)) {
52          ++lineNo;
53 <        /**@todo implement trimLeft() */
54 <        //std::string line = LeftTrim(buffer);
54 <        std::string line= buffer;
53 >        
54 >        std::string line = trimLeftCopy(buffer);
55          //a line begins with "//" is comment
56          if ( line.empty() || (line.size() >= 2 && line[0] == '/' && line[1] == '/')) {
57              continue;
# Line 68 | Line 68 | void SectionParserManager::parse(std::istream& input,
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 87 | Line 87 | void SectionParserManager::parse(std::istream& input,
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 115 | Line 115 | void SectionParserManager::push_front(SectionParser* s
115      context.offset = 0;
116      context.isActive = false;
117  
118 +    sectionParsers_.push_front(context);
119   }
120  
121   void SectionParserManager::push_back(SectionParser* sp) {
# Line 137 | Line 138 | void SectionParserManager::push_back(SectionParser* sp
138      context.offset = 0;
139      context.isActive = false;
140  
141 +    sectionParsers_.push_back(context);
142 +
143   }
144  
145   void SectionParserManager::insert(SectionParser* sp, int priority) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines