cfl_tokenreader.cpp
Go to the documentation of this file.
1 /** @file cfl_tokenreader.cpp @brief Class TokenReader */
2 
3 /* FAU Discrete Event Systems Library (libfaudes)
4 
5 Copyright (C) 2006 Bernd Opitz
6 Copyright (C) 2006. 2010 Thomas Moor
7 Exclusive copyright is granted to Klaus Schmidt
8 
9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Lesser General Public
11 License as published by the Free Software Foundation; either
12 version 2.1 of the License, or (at your option) any later version.
13 
14 This library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
18 
19 You should have received a copy of the GNU Lesser General Public
20 License along with this library; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 
23 
24 
25 
26 #include "cfl_tokenwriter.h"
27 #include "cfl_tokenreader.h"
28 
29 namespace faudes {
30 
31 // TokenReader(mode,instring)
32 TokenReader::TokenReader(Mode mode, const std::string& rInString)
33  : mMode(mode), mpStream(NULL), mFileName("")
34 {
35  switch(mode) {
36  case String:
37  // use mSStream
38  FD_DV("TokenReader::Tokenreader(String, ...): " << rInString);
39  mpSStream= new std::istringstream(rInString, std::istringstream::in | std::istringstream::binary);
41  Rewind();
42  break;
43  case File:
44  // set up mFStream
45  FD_DV("TokenReader::Tokenreader(File, \"" << rInString <<"\")");
46  mFStream.exceptions(std::ios::badbit|std::ios::failbit);
47  try{
48  mFStream.open(rInString.c_str(), std::ios::in | std::ios::binary);
49  }
50  catch (std::ios::failure&) {
51  std::stringstream errstr;
52  errstr << "Exception opening/reading file \""<< rInString << "\"";
53  throw Exception("TokenReader::TokenReader", errstr.str(), 1);
54  }
55  mFileName=rInString;
57  Rewind();
58  break;
59  default:
60  std::stringstream errstr;
61  errstr << "Invalid Mode / Not implemented";
62  throw Exception("TokenReader::TokenReader(mode,instring)", errstr.str(), 1);
63  }
64 }
65 
66 
67 // TokenReader(rFilename)
68 TokenReader::TokenReader(const std::string& rFilename)
69  : mMode(File), mpStream(NULL), mFileName(rFilename)
70 {
71  // set up mFStream
72  FD_DV("TokenReader::Tokenreader(File, \"" << rFilename <<"\")");
73  mFStream.exceptions(std::ios::badbit|std::ios::failbit);
74  try{
75  mFStream.open(rFilename.c_str(), std::ios::in | std::ios::binary);
76  }
77  catch (std::ios::failure&) {
78  std::stringstream errstr;
79  errstr << "Exception opening/reading file \""<< rFilename << "\"";
80  throw Exception("TokenReader::TokenReader", errstr.str(), 1);
81  }
82  mFileName=rFilename;
84  Rewind();
85 }
86 
87 
88 // destruct
90  if(mMode==String) delete mpSStream;
91 }
92 
93 // Stream()
94 std::istream* TokenReader::Streamp(void) {
95  return mpStream;
96 }
97 
98 // Rewind()
99 void TokenReader::Rewind(void) {
100  FD_DV("TokenReader::Rewind: \"" << mFileName <<"\"");
101  try {
102  mpStream->clear();
103  mpStream->seekg(0);
105  mLevel=0;
106  mLineCount=1;
107  mFilePos=0;
108  mFaudesComments=true;
109  mLevelState.resize(mLevel+1);
110  mLevelState.back().mLabel="OUTER";
111  mLevelState.back().mStartPosition=mFilePos;
112  mLevelState.back().mStartLine=mLineCount;
113  mLevelState.back().mStartPeek=mPeekToken;
114  mLevelState.back().mFaudesComments=mFaudesComments;
115  }
116  catch (std::ios::failure&) {
117  std::stringstream errstr;
118  errstr << "Exception opening/reading file in "<< FileLine();
119  throw Exception("TokenReader::Rewind", errstr.str(), 1);
120  }
121 }
122 
123 
124 // FileName()
125 std::string TokenReader::FileName(void) const {
126  return mFileName;
127 }
128 
129 // Peek(token)
130 bool TokenReader::Peek(Token& token) {
131  // read to peek buffer
132  if(mPeekToken.IsNone()) {
133  try{
135  } catch (std::ios::failure&) {
136  std::stringstream errstr;
137  errstr << "Exception opening/reading file in "<< FileLine();
138  throw Exception("TokenReader::Peek", errstr.str(), 1);
139  }
140  }
141  // get from peek buffer
142  token=mPeekToken;
143  // peek begin on empty section
144  if(token.IsEmpty()) token.ClrEnd();
145  // done
146  FD_DV("TokenReader: Peek: " << token.Str());
147  return !token.IsNone();
148 }
149 
150 // Get(token)
151 bool TokenReader::Get(Token& token) {
152  bool res;
153  // fill peek buffer
154  if(!Peek(token)) return false;
155  // get token from peek buffer
156  token=mPeekToken;
157  // invalidate buffer: case a
159  // invalidate buffer: case b
160  if(mPeekToken.IsEmpty()) {
161  FD_DV("TokenReader: fake end : " << mPeekToken.Str());
162  token.ClrEnd();
163  mPeekToken.SetEnd(std::string(mPeekToken.StringValue()));
164  }
165  // ignore misbehavong <br> tag in by level management
166  if(token.IsBegin("br") || token.IsEnd("br")) return true;
167  // track state (level of nested sections, filepos etc)
168  mFilePos=mpStream->tellg();
169  if(token.IsBegin()) {
170  // track level
171  mLevel++;
172  // update state
173  if(token.StringValue()=="ReferencePage") mFaudesComments=false;
174  if(token.StringValue()=="html") mFaudesComments=false;
175  if(token.StringValue()=="Html") mFaudesComments=false;
176  if(token.StringValue()=="HTML") mFaudesComments=false;
177  // record state
178  mLevelState.resize(mLevel+1);
179  mLevelState.back().mLabel=token.StringValue();
180  mLevelState.back().mStartPosition=mFilePos;
181  mLevelState.back().mStartLine=mLineCount;
182  mLevelState.back().mStartPeek=mPeekToken;
183  mLevelState.back().mFaudesComments=mFaudesComments;
184  }
185  if(token.IsEnd()) {
186 #ifdef FAUDES_CHECKED
187  if(token.StringValue()!=mLevelState.back().mLabel)
188  FD_WARN("TokenReader::Get(): end of section \"" << token.StringValue() << "\" at " << FileLine()
189  << " should match \"" << mLevelState.back().mLabel << "\" at line " << mLevelState.back().mStartLine );
190 #endif
191  if(mLevel<1) {
192 #ifdef FAUDES_CHECKED
193  FD_WARN("TokenReader::Get(): Unbalanced end of section \"" << token.StringValue() << "\" at " << FileLine());
194 #endif
195  token.SetNone();
196  return false;
197  }
198  mLevel--;
199  mLevelState.pop_back();
200  mFaudesComments=mLevelState.back().mFaudesComments;
201  }
202  FD_DV("TokenReader:Get(): " << token.Str());
203 
204  return res;
205 }
206 
207 // SeekBegin(label)
208 void TokenReader::SeekBegin(const std::string& rLabel) {
209  Token token;
210  SeekBegin(rLabel,token);
211 }
212 
213 // SeekBegin(label)
214 void TokenReader::SeekBegin(const std::string& rLabel, Token& rToken) {
215  // search for begin at any descending level, no rewind
216  FD_DV("TokenReader::SeekBegin: " << rLabel << " at " << FileLine() << " level " << mLevel);
217  int level=mLevel;
218  for (;;) {
219  // swollow some plain text (e.g. html may contain plain text that cannot be tokenized properly)
220  std::string swallow;
221  ReadCharacterData(swallow);
222  // exception: did not get a token at all (incl. eof)
223  if(!Peek(rToken)) {
224  Rewind();
225  std::stringstream errstr;
226  errstr << "Section \"" << rLabel << "\" expected at " << FileLine() << " no more tokens";
227  throw Exception("TokenReader::SeekBegin", errstr.str(), 51);
228  }
229  // exception: current section ends
230  if((rToken.Type() == Token::End) && (mLevel == level)) {
231  mpStream->seekg(mLevelState[level].mStartPosition);
232  mFilePos=mLevelState[level].mStartPosition;
233  mLineCount=mLevelState[level].mStartLine;
234  mPeekToken=mLevelState[level].mStartPeek;
235  mFaudesComments=mLevelState[level].mFaudesComments;
236  std::stringstream errstr;
237  errstr << "Section \"" << rLabel << "\" expected at " << FileLine()
238  << "current section ended unexpected. Found: " << rToken.StringValue() << " Type " << rToken.Type();
239  throw Exception("TokenReader::SeekBegin", errstr.str(), 51);
240  }
241  // success: found begin section
242  if ((rToken.IsBegin()) && (rToken.StringValue() == rLabel))
243  break;
244  // go on seeking
245  Get(rToken);
246  }
247 }
248 
249 // ReadBegin(label)
250 void TokenReader::ReadBegin(const std::string& rLabel) {
251  Token token;
252  ReadBegin(rLabel,token);
253 }
254 
255 // ReadBegin(label,token)
256 void TokenReader::ReadBegin(const std::string& rLabel, Token& rToken) {
257  FD_DV("Looking for Section \"" << rLabel << "\"");
258  try {
259  int level=mLevel;
260  int repcnt=0;
261  long int startpos=mFilePos;
262  FD_DV("section level " << level << " current pos " << startpos << " begin of section " << mLevelState[level].mStartPosition);
263  // search for begin at current level
264  for (;;) {
265  // swallow some plain text (e.g. html may contain plain text that cannot be tokenized properly)
266  std::string swallow;
267  ReadCharacterData(swallow);
268  // exception: did not get a token at all (incl eof)
269  if(!Peek(rToken)) {
270  std::stringstream errstr;
271  errstr << "Section \"" << rLabel << "\" expected at " << FileLine() << ", no token at all";
272  throw Exception("TokenReader::ReadBegin Peek", errstr.str(), 51);
273  }
274  // success: found begin section
275  if((rToken.IsBegin()) && (rToken.StringValue() == rLabel) && (mLevel==level)) {
276  Get(rToken);
277  break;
278  }
279  // exception: did not find begin label
280  if((mFilePos>=startpos) && (repcnt==1)) {
281  std::stringstream errstr;
282  errstr << "Section \"" << rLabel << "\" expected at " << FileLine() << ", did not find begin label";
283  throw Exception("TokenReader::ReadBegin: Missing", errstr.str(), 51);
284  }
285  // exception: did not find begin label
286  if(repcnt>1) {
287  std::stringstream errstr;
288  errstr << "Section \"" << rLabel << "\" expected at " << FileLine() << ", did not find begin label";
289  throw Exception("TokenReader::ReadBegin: Missing", errstr.str(), 51);
290  }
291  // rewind once when current section ends
292  if(rToken.IsEnd() && !rToken.IsBegin() && (mLevel == level)) {
293  mpStream->seekg(mLevelState[level].mStartPosition);
294  mFilePos=mLevelState[level].mStartPosition;
295  mLineCount=mLevelState[level].mStartLine;
296  mPeekToken=mLevelState[level].mStartPeek;
297  mFaudesComments=mLevelState[level].mFaudesComments;
298  repcnt++;
299  continue;
300  }
301  // skip this token
302  Get(rToken);
303  }
304  }
305  // catch my seek/tell errors
306  catch (std::ios::failure&) {
307  std::stringstream errstr;
308  errstr << "Section \"" << rLabel << "\" expected at " << FileLine();
309  throw Exception("TokenReader::ReadBegin Rewind", errstr.str(), 1);
310  }
311 }
312 
313 
314 // ExistsBegin(label)
315 bool TokenReader::ExistsBegin(const std::string& rLabel) {
316  FD_DV("TokenReader::ExistsBegin(): looking for Section \"" << rLabel << "\"");
317  try {
318  int level=mLevel;
319  int rwcnt=0;
320  long int startpos=mFilePos;
321  FD_DV("section level " << level << " current pos " << startpos << " begin of section " << mLevelState[level].mStartPosition);
322  Token token;
323  // search for begin at current level
324  for(;;) {
325  // swallow some plain text (e.g. html may contain plain text that cannot be tokenized properly)
326  std::string swallow;
327  ReadCharacterData(swallow);
328  // fail: did not get a token at all (e.g. eof)
329  if(!Peek(token)) {
330  return false;
331  }
332  // success: found begin section
333  if((token.IsBegin()) && (token.StringValue() == rLabel) && (mLevel==level)) {
334  return true;
335  }
336  // rewind once when current section ends
337  if(token.IsEnd() && (mLevel == level) && (rwcnt==0)) {
338  mpStream->seekg(mLevelState[level].mStartPosition);
339  mFilePos=mLevelState[level].mStartPosition;
340  mLineCount=mLevelState[level].mStartLine;
341  mPeekToken=mLevelState[level].mStartPeek;
342  mFaudesComments=mLevelState[level].mFaudesComments;
343  rwcnt++;;
344  if(rwcnt>1) return false; // survive funny mFilePos in e.g. empty sections
345  continue;
346  }
347  // fail: did not find begin label are one turn around
348  if((mFilePos>=startpos) && (rwcnt>0) && (mLevel == level)) {
349  return false;
350  }
351  // skip this token
352  Get(token);
353  }
354  }
355  // catch my seek/tell errors
356  catch (std::ios::failure&) {
357  std::stringstream errstr;
358  errstr << "IO Error while scanning Section \"" << rLabel << "\" at " << FileLine();
359  throw Exception("TokenReader::ExistsBegin IO", errstr.str(), 1);
360  }
361  return false;
362 }
363 
364 // ReadEnd(label)
365 void TokenReader::ReadEnd(const std::string& rLabel) {
366  FD_DV("TokenReader::ReadEnd: " << rLabel << " at " << FileLine() );
367  // search for end at current level
368  int level=mLevel;
369  Token token;
370  for (;;) {
371  // swallow some plain text (e.g. html may contain plain text that cannot be tokenized properly)
372  std::string swallow;
373  ReadCharacterData(swallow);
374  // exception: did not get a token at all
375  if(!Peek(token)) {
376  std::stringstream errstr;
377  errstr << "end of section \"" << rLabel << "\" expected at " << FileLine();
378  throw Exception("TokenReader::ReadEnd", errstr.str(), 51);
379  }
380  // success: found end of current section
381  if(token.IsEnd() && !token.IsBegin() && (token.StringValue() == rLabel) && (mLevel==level)) {
382  Get(token);
383  break;
384  }
385  // exception: current section ends with unexpected label
386  if(mLevel<level) {
387  std::stringstream errstr;
388  errstr << "end of Section \"" << rLabel << "\" expected at " << FileLine();
389  throw Exception("TokenReader::ReadEnd", errstr.str(), 51);
390  }
391  // get the token and continue
392  Get(token);
393  //std::cout << token.Str() << "\n";
394  }
395 }
396 
397 // Recover()
398 bool TokenReader::Recover(int level) {
399  // paranoia
400  if(level<0) return false;
401  // trivial cases
402  if(level>mLevel) return false;
403  if(level==mLevel) return true;
404  // loop until match
405  Token token;
406  while(Get(token))
407  if(mLevel<=level) break;
408  // done
409  return level==mLevel;
410 }
411 
412 // Recover()
413 bool TokenReader::Reset(int level) {
414  // paranoia
415  if(level>mLevel) return false;
416  // coonvenience arg: negative becomed reset this level
417  if(level<0) level=mLevel;
418  // trivial case
419  if(level==0) {
420  Rewind();
421  return true;
422  }
423  // loop until end
424  Token token;
425  while(Peek(token)) {
426  if((mLevel==level) && token.IsEnd()) break;
427  if(mLevel<level) return false;
428  Get(token);
429  }
430  // do the rewind
431  mpStream->seekg(mLevelState[level].mStartPosition);
432  mFilePos=mLevelState[level].mStartPosition;
433  mLineCount=mLevelState[level].mStartLine;
434  mPeekToken=mLevelState[level].mStartPeek;
435  mFaudesComments=mLevelState[level].mFaudesComments;
436  return true;
437 }
438 
439 // Eos(label)
440 bool TokenReader::Eos(const std::string& rLabel) {
441  // peek token and check for end of section
442  Token token;
443  Peek(token);
444  if(token.IsEnd(rLabel)) return true;
445  return false;
446 }
447 
448 
449 // ReadInteger()
450 long int TokenReader::ReadInteger(void) {
451  Token token;
452  Peek(token);
453  if(!token.IsInteger()) {
454  std::stringstream errstr;
455  errstr << "Integer expected at " << FileLine();
456  throw Exception("TokenReader::TokenReader", errstr.str(), 50);
457  }
458  Get(token);
459  return token.IntegerValue();
460 }
461 
462 // ReadFloat()
464  Token token;
465  Peek(token);
466  if((!token.IsFloat()) && (!token.IsInteger())) {
467  std::stringstream errstr;
468  errstr << "Float expected at " << FileLine();
469  throw Exception("TokenReader::TokenReader", errstr.str(), 50);
470  }
471  Get(token);
472  return token.FloatValue();
473 }
474 
475 // ReadString()
476 std::string TokenReader::ReadString(void) {
477  Token token;
478  Peek(token);
479  if(!token.IsString()) {
480  std::stringstream errstr;
481  errstr << "String expected at " << FileLine();
482  throw Exception("TokenReader::TokenReader", errstr.str(), 50);
483  }
484  Get(token);
485  return token.StringValue();
486 }
487 
488 
489 // ReadOption()
490 std::string TokenReader::ReadOption(void) {
491  Token token;
492  Peek(token);
493  if(!token.IsOption()) {
494  std::stringstream errstr;
495  errstr << "Option expected at " << FileLine();
496  throw Exception("TokenReader::TokenReader", errstr.str(), 50);
497  }
498  Get(token);
499  return token.OptionValue();
500 }
501 
502 // ReadBinary()
503 void TokenReader::ReadBinary(std::string& rData) {
504  Token token;
505  Peek(token);
506  if(!token.IsBinary()) {
507  std::stringstream errstr;
508  errstr << "Binary string expected at " << FileLine();
509  throw Exception("TokenReader::TokenReader", errstr.str(), 50);
510  }
511  Get(token);
512  rData = token.StringValue();
513 }
514 
515 
516 // ReadText()
517 void TokenReader::ReadText(const std::string& rLabel, std::string& rText) {
518  // insist in my begin tag
519  Token token;
520  Peek(token);
521  if(!token.IsBegin(rLabel)) {
522  std::stringstream errstr;
523  errstr << "Text element \""<< rLabel << "\" expected at " << FileLine();
524  throw Exception("TokenReader::TokenReader", errstr.str(), 50);
525  }
526  Get(token);
527  // do my text reading
528  int ll=Token::ReadEscapedString(mpStream,'<',rText);
529  if(ll<0) {
530  std::stringstream errstr;
531  errstr << "Text expected at " << FileLine();
532  throw Exception("TokenReader::TokenReader", errstr.str(), 50);
533  }
534  mLineCount+=ll;
535  // strip leading/trailing linefeeds
536  static const std::string line="\n\r\v";
537  std::size_t pos1=rText.find_first_not_of(line);
538  if(pos1!=std::string::npos)
539  rText=rText.substr(pos1);
540  else
541  rText.clear();
542  std::size_t pos2=rText.find_last_not_of(line);
543  if(pos2!=std::string::npos)
544  rText.erase(pos2+1);
545  // strip leading/trailing white if all in one line
546  static const std::string white=" \t";
547  if(pos1==0) {
548  pos1=rText.find_first_not_of(white);
549  if(pos1!=std::string::npos)
550  rText=rText.substr(pos1);
551  else
552  rText.clear();
553  std::size_t pos2=rText.find_last_not_of(white);
554  if(pos2!=std::string::npos)
555  rText.erase(pos2+1);
556  }
557  // insist in my end tag
558  Peek(token);
559  if(!token.IsEnd(rLabel)) {
560  std::stringstream errstr;
561  errstr << "End of text element \""<< rLabel << "\" expected at " << FileLine();
562  throw Exception("TokenReader::TokenReader", errstr.str(), 50);
563  }
564  Get(token);
565 }
566 
567 // ReadVerbatim()
568 void TokenReader::ReadVerbatim(const std::string& rLabel, std::string& rString) {
569  // insist in my tag
570  Token token;
571  Peek(token);
572  if(!token.IsBegin(rLabel)) {
573  std::stringstream errstr;
574  errstr << "Verbatim element \""<< rLabel << "\" expected at " << FileLine();
575  throw Exception("TokenReader::TokenReader", errstr.str(), 50);
576  }
577  Get(token);
578  rString.clear();
579  // loop cdata
580  int cnt=0;
581  rString.clear();
582  while(Peek(token)) {
583  if(!token.IsString()) break;
584  if(cnt>0 && !token.IsCdata()) break;
585  Get(token);
586  rString.append(token.StringValue());
587  cnt++;
588  }
589  // strip leading/trailing linefeeds
590  static const std::string line="\n\r\v";
591  std::size_t pos1=rString.find_first_not_of(line);
592  if(pos1!=std::string::npos)
593  rString=rString.substr(pos1);
594  else
595  rString.clear();
596  std::size_t pos2=rString.find_last_not_of(line);
597  if(pos2!=std::string::npos)
598  rString.erase(pos2+1);
599  // insist in my end tag
600  Peek(token);
601  if(!token.IsEnd(rLabel)) {
602  std::stringstream errstr;
603  errstr << "End of verbatim element \""<< rLabel << "\" expected at " << FileLine();
604  throw Exception("TokenReader::TokenReader", errstr.str(), 50);
605  }
606  Get(token);
607 }
608 
609 // ReadCharacterData()
610 void TokenReader::ReadCharacterData(std::string& rData) {
611  // if we have a markup token in the buffer there is no character data except white space
612  if(mPeekToken.IsBegin() || mPeekToken.IsEnd()) {
613  FD_DV("TokenReader::ReadCharacterData(): tag in buffer");
614  rData=mPeekToken.PreceedingSpace();
616  return;
617  }
618  // do my own reading
620  if(ll<0) {
621  std::stringstream errstr;
622  errstr << "Missformed character data at " << FileLine() << ": " << rData;
623  throw Exception("TokenReader::TokenReader", errstr.str(), 50);
624  }
625  mLineCount+=ll;
626  // prepend peek buffers string value (better: need rewind!)
627  if(mPeekToken.IsString())
628  rData=mPeekToken.StringValue() + " " + rData;
629  // invalidate buffer
631 }
632 
633 // ReadSection()
634 void TokenReader::ReadSection(std::string& rSectionString) {
635  // record current level
636  int clevel = Level();
637  // setup token writer for destination // need a better interface here: provide string buffer
639  tw.Endl(true);
640  // token copy loop
641  while(true) {
642  // see whether we can grab and copy some character data
643  std::string cdata;
644  ReadCharacterData(cdata);
645  tw.WriteCharacterData(cdata);
646  // break end of my level
647  Token token;
648  if(!Peek(token)) break;
649  if(token.IsEnd() && !token.IsBegin() && Level()==clevel)
650  break;
651  // get and copy markup token
652  Get(token);
653  token.PreceedingSpace("n"); // explicit no formating
654  tw.Write(token);
655  }
656  // done
657  rSectionString=tw.Str();
658 }
659 
660 
661 // Line()
662 int TokenReader::Line(void) const {
663  return mLineCount;
664 }
665 
666 // FileLine()
667 std::string TokenReader::FileLine(void) const {
668  if(mFileName!="")
669  return "("+ mFileName + ":" + ToStringInteger(mLineCount) +")";
670  else
671  return "(#" + ToStringInteger(mLineCount) +")";
672 }
673 
674 } // namespace faudes
#define FD_DV(message)
#define FD_WARN(message)
Class TokenReader.
Class TokenWriter.
long int ReadInteger(void)
std::string FileLine(void) const
void ReadBinary(std::string &rData)
void ReadCharacterData(std::string &rData)
void ReadText(const std::string &rLabel, std::string &rText)
std::string ReadOption(void)
bool Eos(const std::string &rLabel)
void SeekBegin(const std::string &rLabel)
void ReadVerbatim(const std::string &rLabel, std::string &rText)
bool Reset(int level=-1)
int Level(void) const
void ReadEnd(const std::string &rLabel)
bool Recover(int level)
std::string ReadString(void)
std::istringstream * mpSStream
void ReadSection(std::string &rSectionString)
void ReadBegin(const std::string &rLabel)
std::istream * mpStream
std::ifstream mFStream
bool Get(Token &token)
bool Peek(Token &token)
std::istream * Streamp(void)
int Line(void) const
bool ExistsBegin(const std::string &rLabel)
TokenReader(Mode mode, const std::string &rInString="")
std::string FileName(void) const
std::vector< LState > mLevelState
std::string Str(void)
void WriteCharacterData(const std::string &rCharData)
void Write(Token &rToken)
bool IsCdata(void) const
Definition: cfl_token.cpp:254
bool IsBinary(void) const
Definition: cfl_token.cpp:249
void SetNone(void)
Definition: cfl_token.cpp:73
const std::string & PreceedingSpace(void) const
Definition: cfl_token.cpp:189
std::string Str(void) const
Definition: cfl_token.cpp:1297
const std::string & StringValue(void) const
Definition: cfl_token.cpp:178
void ClrEnd(void)
Definition: cfl_token.cpp:161
@ End
<\label> (end of section)
Definition: cfl_token.h:85
bool IsString(void) const
Definition: cfl_token.cpp:244
Int IntegerValue(void) const
Definition: cfl_token.cpp:167
bool IsNone(void) const
Definition: cfl_token.cpp:214
bool IsInteger(void) const
Definition: cfl_token.cpp:219
static int ReadCharacterData(std::istream *pStream, std::string &rString, bool fcomments)
Definition: cfl_token.cpp:919
static int ReadEscapedString(std::istream *pStream, char stop, std::string &rString)
Definition: cfl_token.cpp:858
bool IsEmpty(void) const
Definition: cfl_token.cpp:281
bool IsBegin(void) const
Definition: cfl_token.cpp:259
const std::string & OptionValue(void) const
Definition: cfl_token.cpp:184
int Read(std::istream *pStream, bool fcomments=true)
Definition: cfl_token.cpp:1206
bool IsEnd(void) const
Definition: cfl_token.cpp:270
bool IsFloat(void) const
Definition: cfl_token.cpp:234
bool IsOption(void) const
Definition: cfl_token.cpp:239
void SetEnd(const std::string &rName)
Definition: cfl_token.cpp:99
faudes::Float FloatValue(void) const
Definition: cfl_token.cpp:173
TokenType Type(void) const
Definition: cfl_token.cpp:199
std::string ToStringInteger(Int number)
Definition: cfl_utils.cpp:43

libFAUDES 2.33c --- 2025.05.15 --- c++ api documentaion by doxygen