faudes::TokenReader Class Reference A TokenReader reads sequential tokens from a file or string. More...
Detailed DescriptionA TokenReader reads sequential tokens from a file or string. It can get or peek the next token and it will track line numbers for informative diagnosis output. The class also implements nested sections. That is, you may search for a (sub-)section within the current section and, hence, implement file formats that do not insist in a particular ordering of the sections (e.g. a Generator consists of states, transitions and events, no matter in which order). Convenience functions are provided to read a token of a particular type and throws faudes::Exception on token mismatch. You may catch the exception as follows: Note that in addition to the documented execeptions all TokenReader functions do pass on faudes ios errors from the Token class. Definition at line 60 of file cfl_tokenreader.h. Member Enumeration DocumentationMode of operation: read from file, stdin or string. Definition at line 66 of file cfl_tokenreader.h. Constructor & Destructor Documentation
TokenReader constructor.
Definition at line 32 of file cfl_tokenreader.cpp.
Creates a TokenReader for reading a file.
Definition at line 68 of file cfl_tokenreader.cpp.
Destruct. Definition at line 89 of file cfl_tokenreader.cpp. Member Function Documentation
Peek a token and check whether it ends the specified section. This function is meant for scanning a section with a while- construct.
Definition at line 389 of file cfl_tokenreader.cpp.
This function searches for the specified section on the current level, it skips any sections on levels below, and it will wrap to the begin of the current section. In the case of success, it returns true, else false. In contrast to other token i/o methodes, this method will not throw any execptions.
Definition at line 295 of file cfl_tokenreader.cpp.
Return "filename:line". Definition at line 559 of file cfl_tokenreader.cpp.
Get the filename. Returns dummy values for console or string mode.
Definition at line 125 of file cfl_tokenreader.cpp.
Get next token. False indicates eof.
Definition at line 151 of file cfl_tokenreader.cpp.
Get state of TokenReader stream.
Return current level of section nesting.
Definition at line 414 of file cfl_tokenreader.h.
Return number of lines read.
Definition at line 554 of file cfl_tokenreader.cpp.
Operator for get. Definition at line 396 of file cfl_tokenreader.h.
Peek next token. False indicates eof.
Definition at line 130 of file cfl_tokenreader.cpp.
Open a section by specified label. This function searches for the section on this level, it skips any sections on levels below this level, and it will wrap to the begin of the current section. In the case of success, the matching begin token is the last token read. After processing the section, a matching ReadEnd(label) must be called.
Definition at line 238 of file cfl_tokenreader.cpp.
Open a section by specified label. This version ReadBegin(const std::string&) will return the actual begin tag in its second argument.
Definition at line 244 of file cfl_tokenreader.cpp.
Read binary token. You can access the binary array via StringValue();
Definition at line 456 of file cfl_tokenreader.cpp.
Read plain text. Read all text until and excluding the next markup. This method does no interpretation whatever. It can be used to implement carbon copy of text sections.
Definition at line 504 of file cfl_tokenreader.cpp.
Close the current section by matching the previous ReadBegin(). Reads all tokens up to and including end of current section.
Definition at line 344 of file cfl_tokenreader.cpp.
Read XML section. Reads the current section, including all character data and markup, until and excluding the matching end tag. This method does no interpretation whatever. the result is a string that represents the respective section in XML format.
Definition at line 528 of file cfl_tokenreader.cpp.
Read plain text. Read all text until and excluding the next markup. This method interprets known enteties and swallows beginning and ending white space. Effetively, ot is used to read ASCII compatible text.
Definition at line 470 of file cfl_tokenreader.cpp.
Recover to specified section nesting. The current implementation will mess up the Seek-stack. Thus, Recover() only works when no Seekbegin() was used.
Definition at line 376 of file cfl_tokenreader.cpp.
Rewind stream (must be a seekable stream)
Definition at line 99 of file cfl_tokenreader.cpp.
Find specified begin label. This function searches for the section on this level and any descending level. It does not read the specified section tag, but stops just one token before. Technical note: Former versions of libFAUDES also read the actual begin token and required a matching call of SeekEnd(). As of version 2.18a, this is not supported anymore. The previous behaviour was rarely needed and can be mimiqued by an ordinary ReadEnd() with a subsequent Recover(level).
Definition at line 197 of file cfl_tokenreader.cpp.
Find specified begin label. This version SeekBegin(const std::string&) will return the actual begin tag in its second argument.
Definition at line 203 of file cfl_tokenreader.cpp.
Access C++ stream. Definition at line 94 of file cfl_tokenreader.cpp. Member Data Documentation
Filename. Definition at line 447 of file cfl_tokenreader.h.
file position Definition at line 453 of file cfl_tokenreader.h.
actual stream object, file input Definition at line 441 of file cfl_tokenreader.h.
recent string buffer Definition at line 471 of file cfl_tokenreader.h.
Level (of nested sections) Definition at line 456 of file cfl_tokenreader.h.
label of sections Definition at line 459 of file cfl_tokenreader.h.
file line of sections Definition at line 465 of file cfl_tokenreader.h.
file positions of sections Definition at line 462 of file cfl_tokenreader.h.
Line counter. Definition at line 450 of file cfl_tokenreader.h.
input mode Definition at line 435 of file cfl_tokenreader.h.
peek buffer Definition at line 474 of file cfl_tokenreader.h.
actual stream object on heap, string input Definition at line 444 of file cfl_tokenreader.h.
istream object pointer Definition at line 438 of file cfl_tokenreader.h.
level of recent seek Definition at line 468 of file cfl_tokenreader.h. The documentation for this class was generated from the following files: libFAUDES 2.24g --- 2014.09.15 --- c++ api documentaion by doxygen |