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 // TokenReader(stream)
89 TokenReader::TokenReader(std::istream& rStream)
90  : mMode(Stream), mpStream(NULL), mFileName("anonymous")
91 {
92  FD_DV("TokenReader::Tokenreader(Stream)");
93  mpStream=&rStream;
94  // do some testing?
95  if(mpStream->bad()){
96  std::stringstream errstr;
97  errstr << "Exception opening/reading anonymous stream";
98  throw Exception("TokenReader::TokenReader", errstr.str(), 1);
99  }
100 }
101 
102 // destruct
104  if(mMode==String) delete mpSStream;
105 }
106 
107 // Stream()
108 std::istream* TokenReader::Streamp(void) {
109  return mpStream;
110 }
111 
112 // Rewind()
114  FD_DV("TokenReader::Rewind: \"" << mFileName <<"\"");
115  try {
116  mpStream->clear();
117  mpStream->seekg(0);
119  mLevel=0;
120  mLineCount=1;
121  mFilePos=0;
122  mFaudesComments=true;
123  mLevelState.resize(mLevel+1);
124  mLevelState.back().mLabel="OUTER";
125  mLevelState.back().mStartPosition=mFilePos;
126  mLevelState.back().mStartLine=mLineCount;
127  mLevelState.back().mStartPeek=mPeekToken;
128  mLevelState.back().mFaudesComments=mFaudesComments;
129  }
130  catch (std::ios::failure&) {
131  std::stringstream errstr;
132  errstr << "Exception opening/reading file in "<< FileLine();
133  throw Exception("TokenReader::Rewind", errstr.str(), 1);
134  }
135 }
136 
137 
138 // FileName()
139 std::string TokenReader::FileName(void) const {
140  return mFileName;
141 }
142 
143 // Peek(token)
144 bool TokenReader::Peek(Token& token) {
145  // read to peek buffer
146  if(mPeekToken.IsNone()) {
147  try{
149  } catch (std::ios::failure&) {
150  std::stringstream errstr;
151  errstr << "Exception opening/reading file in "<< FileLine();
152  throw Exception("TokenReader::Peek", errstr.str(), 1);
153  }
154  }
155  // get from peek buffer
156  token=mPeekToken;
157  // peek begin on empty section
158  if(token.IsEmpty()) token.ClrEnd();
159  // done
160  FD_DV("TokenReader: Peek: " << token.Str());
161  return !token.IsNone();
162 }
163 
164 // Get(token)
165 bool TokenReader::Get(Token& token) {
166  // fill peek buffer
167  if(!Peek(token)) return false;
168  // get token from peek buffer
169  token=mPeekToken;
170  // invalidate buffer: case a
172  // invalidate buffer: case b
173  if(mPeekToken.IsEmpty()) {
174  FD_DV("TokenReader: fake end : " << mPeekToken.Str());
175  token.ClrEnd();
176  mPeekToken.SetEnd(std::string(mPeekToken.StringValue()));
177  }
178  // ignore misbehavong <br> tag in by level management
179  if(token.IsBegin("br") || token.IsEnd("br")) return true;
180  // track state (level of nested sections, filepos etc)
181  mFilePos=mpStream->tellg();
182  if(token.IsBegin()) {
183  // track level
184  mLevel++;
185  // update state
186  if(token.StringValue()=="ReferencePage") mFaudesComments=false;
187  if(token.StringValue()=="html") mFaudesComments=false;
188  if(token.StringValue()=="Html") mFaudesComments=false;
189  if(token.StringValue()=="HTML") mFaudesComments=false;
190  // record state
191  mLevelState.resize(mLevel+1);
192  mLevelState.back().mLabel=token.StringValue();
193  mLevelState.back().mStartPosition=mFilePos;
194  mLevelState.back().mStartLine=mLineCount;
195  mLevelState.back().mStartPeek=mPeekToken;
196  mLevelState.back().mFaudesComments=mFaudesComments;
197  }
198  if(token.IsEnd()) {
199 #ifdef FAUDES_CHECKED
200  if(token.StringValue()!=mLevelState.back().mLabel)
201  FD_WARN("TokenReader::Get(): end of section \"" << token.StringValue() << "\" at " << FileLine()
202  << " should match \"" << mLevelState.back().mLabel << "\" at line " << mLevelState.back().mStartLine );
203 #endif
204  if(mLevel<1) {
205 #ifdef FAUDES_CHECKED
206  FD_WARN("TokenReader::Get(): Unbalanced end of section \"" << token.StringValue() << "\" at " << FileLine());
207 #endif
208  token.SetNone();
209  return false;
210  }
211  mLevel--;
212  mLevelState.pop_back();
213  mFaudesComments=mLevelState.back().mFaudesComments;
214  }
215  FD_DV("TokenReader:Get(): " << token.Str());
216 
217  return true;
218 }
219 
220 // SeekBegin(label)
221 void TokenReader::SeekBegin(const std::string& rLabel) {
222  Token token;
223  SeekBegin(rLabel,token);
224 }
225 
226 // SeekBegin(label)
227 void TokenReader::SeekBegin(const std::string& rLabel, Token& rToken) {
228  // search for begin at any descending level, no rewind
229  FD_DV("TokenReader::SeekBegin: " << rLabel << " at " << FileLine() << " level " << mLevel);
230  int level=mLevel;
231  for (;;) {
232  // swollow some plain text (e.g. html may contain plain text that cannot be tokenized properly)
233  std::string swallow;
234  ReadCharacterData(swallow);
235  // exception: did not get a token at all (incl. eof)
236  if(!Peek(rToken)) {
237  Rewind();
238  std::stringstream errstr;
239  errstr << "Section \"" << rLabel << "\" expected at " << FileLine() << " no more tokens";
240  throw Exception("TokenReader::SeekBegin", errstr.str(), 51);
241  }
242  // exception: current section ends
243  if((rToken.Type() == Token::End) && (mLevel == level)) {
244  mpStream->seekg(mLevelState[level].mStartPosition);
245  mFilePos=mLevelState[level].mStartPosition;
246  mLineCount=mLevelState[level].mStartLine;
247  mPeekToken=mLevelState[level].mStartPeek;
248  mFaudesComments=mLevelState[level].mFaudesComments;
249  std::stringstream errstr;
250  errstr << "Section \"" << rLabel << "\" expected at " << FileLine()
251  << "current section ended unexpected. Found: " << rToken.StringValue() << " Type " << rToken.Type();
252  throw Exception("TokenReader::SeekBegin", errstr.str(), 51);
253  }
254  // success: found begin section
255  if ((rToken.IsBegin()) && (rToken.StringValue() == rLabel))
256  break;
257  // go on seeking
258  Get(rToken);
259  }
260 }
261 
262 // ReadBegin(label)
263 void TokenReader::ReadBegin(const std::string& rLabel) {
264  Token token;
265  ReadBegin(rLabel,token);
266 }
267 
268 // ReadBegin(label,token)
269 void TokenReader::ReadBegin(const std::string& rLabel, Token& rToken) {
270  FD_DV("Looking for Section \"" << rLabel << "\"");
271  try {
272  int level=mLevel;
273  int repcnt=0;
274  long int startpos=mFilePos;
275  FD_DV("section level " << level << " current pos " << startpos << " begin of section " << mLevelState[level].mStartPosition);
276  // search for begin at current level
277  for (;;) {
278  // swallow some plain text (e.g. html may contain plain text that cannot be tokenized properly)
279  std::string swallow;
280  ReadCharacterData(swallow);
281  // exception: did not get a token at all (incl eof)
282  if(!Peek(rToken)) {
283  std::stringstream errstr;
284  errstr << "Section \"" << rLabel << "\" expected at " << FileLine() << ", no token at all";
285  throw Exception("TokenReader::ReadBegin Peek", errstr.str(), 51);
286  }
287  // success: found begin section
288  if((rToken.IsBegin()) && (rToken.StringValue() == rLabel) && (mLevel==level)) {
289  Get(rToken);
290  break;
291  }
292  // exception: did not find begin label
293  if((mFilePos>=startpos) && (repcnt==1)) {
294  std::stringstream errstr;
295  errstr << "Section \"" << rLabel << "\" expected at " << FileLine() << ", did not find begin label";
296  throw Exception("TokenReader::ReadBegin: Missing", errstr.str(), 51);
297  }
298  // exception: did not find begin label
299  if(repcnt>1) {
300  std::stringstream errstr;
301  errstr << "Section \"" << rLabel << "\" expected at " << FileLine() << ", did not find begin label";
302  throw Exception("TokenReader::ReadBegin: Missing", errstr.str(), 51);
303  }
304  // rewind once when current section ends
305  if(rToken.IsEnd() && !rToken.IsBegin() && (mLevel == level)) {
306  mpStream->seekg(mLevelState[level].mStartPosition);
307  mFilePos=mLevelState[level].mStartPosition;
308  mLineCount=mLevelState[level].mStartLine;
309  mPeekToken=mLevelState[level].mStartPeek;
310  mFaudesComments=mLevelState[level].mFaudesComments;
311  repcnt++;
312  continue;
313  }
314  // skip this token
315  Get(rToken);
316  }
317  }
318  // catch my seek/tell errors
319  catch (std::ios::failure&) {
320  std::stringstream errstr;
321  errstr << "Section \"" << rLabel << "\" expected at " << FileLine();
322  throw Exception("TokenReader::ReadBegin Rewind", errstr.str(), 1);
323  }
324 }
325 
326 
327 // ExistsBegin(label)
328 bool TokenReader::ExistsBegin(const std::string& rLabel) {
329  FD_DV("TokenReader::ExistsBegin(): looking for Section \"" << rLabel << "\"");
330  try {
331  int level=mLevel;
332  int rwcnt=0;
333  long int startpos=mFilePos;
334  FD_DV("section level " << level << " current pos " << startpos << " begin of section " << mLevelState[level].mStartPosition);
335  Token token;
336  // search for begin at current level
337  for(;;) {
338  // swallow some plain text (e.g. html may contain plain text that cannot be tokenized properly)
339  std::string swallow;
340  ReadCharacterData(swallow);
341  // fail: did not get a token at all (e.g. eof)
342  if(!Peek(token)) {
343  return false;
344  }
345  // success: found begin section
346  if((token.IsBegin()) && (token.StringValue() == rLabel) && (mLevel==level)) {
347  return true;
348  }
349  // rewind once when current section ends
350  if(token.IsEnd() && (mLevel == level) && (rwcnt==0)) {
351  mpStream->seekg(mLevelState[level].mStartPosition);
352  mFilePos=mLevelState[level].mStartPosition;
353  mLineCount=mLevelState[level].mStartLine;
354  mPeekToken=mLevelState[level].mStartPeek;
355  mFaudesComments=mLevelState[level].mFaudesComments;
356  rwcnt++;;
357  if(rwcnt>1) return false; // survive funny mFilePos in e.g. empty sections
358  continue;
359  }
360  // fail: did not find begin label are one turn around
361  if((mFilePos>=startpos) && (rwcnt>0) && (mLevel == level)) {
362  return false;
363  }
364  // skip this token
365  Get(token);
366  }
367  }
368  // catch my seek/tell errors
369  catch (std::ios::failure&) {
370  std::stringstream errstr;
371  errstr << "IO Error while scanning Section \"" << rLabel << "\" at " << FileLine();
372  throw Exception("TokenReader::ExistsBegin IO", errstr.str(), 1);
373  }
374  return false;
375 }
376 
377 // ReadEnd(label)
378 void TokenReader::ReadEnd(const std::string& rLabel) {
379  FD_DV("TokenReader::ReadEnd: " << rLabel << " at " << FileLine() );
380  // search for end at current level
381  int level=mLevel;
382  Token token;
383  for (;;) {
384  // swallow some plain text (e.g. html may contain plain text that cannot be tokenized properly)
385  std::string swallow;
386  ReadCharacterData(swallow);
387  // exception: did not get a token at all
388  if(!Peek(token)) {
389  std::stringstream errstr;
390  errstr << "end of section \"" << rLabel << "\" expected at " << FileLine();
391  throw Exception("TokenReader::ReadEnd", errstr.str(), 51);
392  }
393  // success: found end of current section
394  if(token.IsEnd() && !token.IsBegin() && (token.StringValue() == rLabel) && (mLevel==level)) {
395  Get(token);
396  break;
397  }
398  // exception: current section ends with unexpected label
399  if(mLevel<level) {
400  std::stringstream errstr;
401  errstr << "end of Section \"" << rLabel << "\" expected at " << FileLine();
402  throw Exception("TokenReader::ReadEnd", errstr.str(), 51);
403  }
404  // get the token and continue
405  Get(token);
406  //std::cout << token.Str() << "\n";
407  }
408 }
409 
410 // Recover()
411 bool TokenReader::Recover(int level) {
412  // paranoia
413  if(level<0) return false;
414  // trivial cases
415  if(level>mLevel) return false;
416  if(level==mLevel) return true;
417  // loop until match
418  Token token;
419  while(Get(token))
420  if(mLevel<=level) break;
421  // done
422  return level==mLevel;
423 }
424 
425 // Recover()
426 bool TokenReader::Reset(int level) {
427  // paranoia
428  if(level>mLevel) return false;
429  // coonvenience arg: negative becomed reset this level
430  if(level<0) level=mLevel;
431  // trivial case
432  if(level==0) {
433  Rewind();
434  return true;
435  }
436  // loop until end
437  Token token;
438  while(Peek(token)) {
439  if((mLevel==level) && token.IsEnd()) break;
440  if(mLevel<level) return false;
441  Get(token);
442  }
443  // do the rewind
444  mpStream->seekg(mLevelState[level].mStartPosition);
445  mFilePos=mLevelState[level].mStartPosition;
446  mLineCount=mLevelState[level].mStartLine;
447  mPeekToken=mLevelState[level].mStartPeek;
448  mFaudesComments=mLevelState[level].mFaudesComments;
449  return true;
450 }
451 
452 // Eos(label)
453 bool TokenReader::Eos(const std::string& rLabel) {
454  // peek token and check for end of section
455  Token token;
456  Peek(token);
457  if(token.IsEnd(rLabel)) return true;
458  return false;
459 }
460 
461 
462 // ReadInteger()
463 long int TokenReader::ReadInteger(void) {
464  Token token;
465  Peek(token);
466  if(!token.IsInteger()) {
467  std::stringstream errstr;
468  errstr << "Integer expected at " << FileLine();
469  throw Exception("TokenReader::TokenReader", errstr.str(), 50);
470  }
471  Get(token);
472  return token.IntegerValue();
473 }
474 
475 // ReadFloat()
477  Token token;
478  Peek(token);
479  if((!token.IsFloat()) && (!token.IsInteger())) {
480  std::stringstream errstr;
481  errstr << "Float expected at " << FileLine();
482  throw Exception("TokenReader::TokenReader", errstr.str(), 50);
483  }
484  Get(token);
485  return token.FloatValue();
486 }
487 
488 // ReadString()
489 std::string TokenReader::ReadString(void) {
490  Token token;
491  Peek(token);
492  if(!token.IsString()) {
493  std::stringstream errstr;
494  errstr << "String expected at " << FileLine();
495  throw Exception("TokenReader::TokenReader", errstr.str(), 50);
496  }
497  Get(token);
498  return token.StringValue();
499 }
500 
501 
502 // ReadOption()
503 std::string TokenReader::ReadOption(void) {
504  Token token;
505  Peek(token);
506  if(!token.IsOption()) {
507  std::stringstream errstr;
508  errstr << "Option expected at " << FileLine();
509  throw Exception("TokenReader::TokenReader", errstr.str(), 50);
510  }
511  Get(token);
512  return token.OptionValue();
513 }
514 
515 // ReadBinary()
516 void TokenReader::ReadBinary(std::string& rData) {
517  Token token;
518  Peek(token);
519  if(!token.IsBinary()) {
520  std::stringstream errstr;
521  errstr << "Binary string expected at " << FileLine();
522  throw Exception("TokenReader::TokenReader", errstr.str(), 50);
523  }
524  Get(token);
525  rData = token.StringValue();
526 }
527 
528 
529 // ReadText()
530 void TokenReader::ReadText(const std::string& rLabel, std::string& rText) {
531  // insist in my begin tag
532  Token token;
533  Peek(token);
534  if(!token.IsBegin(rLabel)) {
535  std::stringstream errstr;
536  errstr << "Text element \""<< rLabel << "\" expected at " << FileLine();
537  throw Exception("TokenReader::TokenReader", errstr.str(), 50);
538  }
539  Get(token);
540  // do my text reading
541  int ll=Token::ReadEscapedString(mpStream,'<',rText);
542  if(ll<0) {
543  std::stringstream errstr;
544  errstr << "Text expected at " << FileLine();
545  throw Exception("TokenReader::TokenReader", errstr.str(), 50);
546  }
547  mLineCount+=ll;
548  // strip leading/trailing linefeeds
549  static const std::string line="\n\r\v";
550  std::size_t pos1=rText.find_first_not_of(line);
551  if(pos1!=std::string::npos)
552  rText=rText.substr(pos1);
553  else
554  rText.clear();
555  std::size_t pos2=rText.find_last_not_of(line);
556  if(pos2!=std::string::npos)
557  rText.erase(pos2+1);
558  // strip leading/trailing white if all in one line
559  static const std::string white=" \t";
560  if(pos1==0) {
561  pos1=rText.find_first_not_of(white);
562  if(pos1!=std::string::npos)
563  rText=rText.substr(pos1);
564  else
565  rText.clear();
566  std::size_t pos2=rText.find_last_not_of(white);
567  if(pos2!=std::string::npos)
568  rText.erase(pos2+1);
569  }
570  // insist in my end tag
571  Peek(token);
572  if(!token.IsEnd(rLabel)) {
573  std::stringstream errstr;
574  errstr << "End of text element \""<< rLabel << "\" expected at " << FileLine();
575  throw Exception("TokenReader::TokenReader", errstr.str(), 50);
576  }
577  Get(token);
578 }
579 
580 // ReadVerbatim()
581 void TokenReader::ReadVerbatim(const std::string& rLabel, std::string& rString) {
582  // insist in my tag
583  Token token;
584  Peek(token);
585  if(!token.IsBegin(rLabel)) {
586  std::stringstream errstr;
587  errstr << "Verbatim element \""<< rLabel << "\" expected at " << FileLine();
588  throw Exception("TokenReader::TokenReader", errstr.str(), 50);
589  }
590  Get(token);
591  rString.clear();
592  // loop cdata
593  int cnt=0;
594  rString.clear();
595  while(Peek(token)) {
596  if(!token.IsString()) break;
597  if(cnt>0 && !token.IsCdata()) break;
598  Get(token);
599  rString.append(token.StringValue());
600  cnt++;
601  }
602  // strip leading/trailing linefeeds
603  static const std::string line="\n\r\v";
604  std::size_t pos1=rString.find_first_not_of(line);
605  if(pos1!=std::string::npos)
606  rString=rString.substr(pos1);
607  else
608  rString.clear();
609  std::size_t pos2=rString.find_last_not_of(line);
610  if(pos2!=std::string::npos)
611  rString.erase(pos2+1);
612  // insist in my end tag
613  Peek(token);
614  if(!token.IsEnd(rLabel)) {
615  std::stringstream errstr;
616  errstr << "End of verbatim element \""<< rLabel << "\" expected at " << FileLine();
617  throw Exception("TokenReader::TokenReader", errstr.str(), 50);
618  }
619  Get(token);
620 }
621 
622 // ReadCharacterData()
623 void TokenReader::ReadCharacterData(std::string& rData) {
624  // if we have a markup token in the buffer there is no character data except white space
625  if(mPeekToken.IsBegin() || mPeekToken.IsEnd()) {
626  FD_DV("TokenReader::ReadCharacterData(): tag in buffer");
627  rData=mPeekToken.PreceedingSpace();
629  return;
630  }
631  // do my own reading
633  if(ll<0) {
634  std::stringstream errstr;
635  errstr << "Missformed character data at " << FileLine() << ": " << rData;
636  throw Exception("TokenReader::TokenReader", errstr.str(), 50);
637  }
638  mLineCount+=ll;
639  // prepend peek buffers string value (better: need rewind!)
640  if(mPeekToken.IsString())
641  rData=mPeekToken.StringValue() + " " + rData;
642  // invalidate buffer
644 }
645 
646 // ReadSection()
647 void TokenReader::ReadSection(std::string& rSectionString) {
648  // record current level
649  int clevel = Level();
650  // setup token writer for destination // need a better interface here: provide string buffer
652  tw.Endl(true);
653  // token copy loop
654  while(true) {
655  // see whether we can grab and copy some character data
656  std::string cdata;
657  ReadCharacterData(cdata);
658  tw.WriteCharacterData(cdata);
659  // break end of my level
660  Token token;
661  if(!Peek(token)) break;
662  if(token.IsEnd() && !token.IsBegin() && Level()==clevel)
663  break;
664  // get and copy markup token
665  Get(token);
666  token.PreceedingSpace("n"); // explicit no formating
667  tw.Write(token);
668  }
669  // done
670  rSectionString=tw.Str();
671 }
672 
673 
674 // Line()
675 int TokenReader::Line(void) const {
676  return mLineCount;
677 }
678 
679 // FileLine()
680 std::string TokenReader::FileLine(void) const {
681  if(mFileName!="")
682  return "("+ mFileName + ":" + ToStringInteger(mLineCount) +")";
683  else
684  return "(#" + ToStringInteger(mLineCount) +")";
685 }
686 
687 } // 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.33h --- 2025.06.18 --- c++ api documentaion by doxygen