#include <EasyScanner.h>
Classes | |
class | Endl |
class | Exception |
Public Types | |
typedef std::map< std::string, int > | SymbolMap |
typedef boost::shared_ptr< SymbolMap > | SymbolMapPtr |
typedef std::pair< std::string, int > | SymbolPair |
enum | TokenType { T_NONE = 0, T_SPACE, T_ALPHABET, T_INTEGER, T_DOUBLE, T_WORD, T_STRING, T_SIGLUM, T_LF, T_EOF } |
Public Attributes | |
char | charValue |
std::string | defaultErrorMessage |
double | doubleValue |
Endl | endl |
std::string | filename |
int | intValue |
int | lineNumber |
std::string | stringValue |
int | symbolValue |
char * | text |
Private Member Functions | |
int | extractQuotedString () |
void | init () |
bool | readLF0 () |
bool | readString0 (const int delimiterChar) |
bool | readWord0 () |
void | skipToLineEnd () |
Private Attributes | |
int | commentChar |
bool | isLineOriented |
int | lineNumberOffset |
int | quoteChar |
int | size |
SymbolMapPtr | symbols |
char * | textBuf |
char * | textBufEnd |
std::vector< int > | whiteSpaceChars |
Friends | |
HRP_UTIL_EXPORT EasyScanner & | operator>> (EasyScanner &scanner, double &value) |
HRP_UTIL_EXPORT EasyScanner & | operator>> (EasyScanner &scanner, int &value) |
HRP_UTIL_EXPORT EasyScanner & | operator>> (EasyScanner &scanner, const char *matchString) |
HRP_UTIL_EXPORT EasyScanner & | operator>> (EasyScanner &scanner, char matchChar) |
HRP_UTIL_EXPORT EasyScanner & | operator>> (EasyScanner &scanner, std::string &str) |
HRP_UTIL_EXPORT EasyScanner & | operator>> (EasyScanner &scanner, EasyScanner::Endl endl) |
Definition at line 27 of file EasyScanner.h.
typedef std::map<std::string, int> hrp::EasyScanner::SymbolMap |
Definition at line 48 of file EasyScanner.h.
typedef boost::shared_ptr<SymbolMap> hrp::EasyScanner::SymbolMapPtr |
Definition at line 50 of file EasyScanner.h.
typedef std::pair<std::string, int> hrp::EasyScanner::SymbolPair |
Definition at line 49 of file EasyScanner.h.
Enumerator | |
---|---|
T_NONE | |
T_SPACE | |
T_ALPHABET | |
T_INTEGER | |
T_DOUBLE | |
T_WORD | |
T_STRING | |
T_SIGLUM | |
T_LF | |
T_EOF |
Definition at line 43 of file EasyScanner.h.
EasyScanner::EasyScanner | ( | ) |
Definition at line 109 of file EasyScanner.cpp.
hrp::EasyScanner::EasyScanner | ( | std::string | filename | ) |
EasyScanner::EasyScanner | ( | const EasyScanner & | org, |
bool | copyText = false |
||
) |
Copy Constructor. New object inherits another's propety and symbols.
org | original object |
copyText | If true, new object has same text as original |
Definition at line 149 of file EasyScanner.cpp.
|
virtual |
Definition at line 192 of file EasyScanner.cpp.
bool EasyScanner::checkLF | ( | ) |
Definition at line 377 of file EasyScanner.cpp.
|
private |
Definition at line 453 of file EasyScanner.cpp.
Definition at line 65 of file EasyScanner.h.
|
private |
Definition at line 125 of file EasyScanner.cpp.
|
inline |
Definition at line 130 of file EasyScanner.h.
This function loads a text from a given file. The function thorws EasyScanner::Exception when the file cannot be loaded.
Definition at line 274 of file EasyScanner.cpp.
void EasyScanner::moveToHead | ( | ) |
Definition at line 204 of file EasyScanner.cpp.
int EasyScanner::peekChar | ( | ) |
Definition at line 543 of file EasyScanner.cpp.
void EasyScanner::putSymbols | ( | ) |
Definition at line 211 of file EasyScanner.cpp.
bool EasyScanner::readChar | ( | ) |
Definition at line 517 of file EasyScanner.cpp.
bool EasyScanner::readChar | ( | int | chara | ) |
Definition at line 531 of file EasyScanner.cpp.
The exception version of readChar().
Definition at line 177 of file EasyScanner.h.
The exception version of readChar().
Definition at line 185 of file EasyScanner.h.
bool EasyScanner::readDouble | ( | ) |
Definition at line 485 of file EasyScanner.cpp.
|
inline |
The exception version of readDouble().
Definition at line 169 of file EasyScanner.h.
bool EasyScanner::readInt | ( | ) |
Definition at line 501 of file EasyScanner.cpp.
The exception version of readInt().
Definition at line 161 of file EasyScanner.h.
|
inline |
reading a line feed
Definition at line 136 of file EasyScanner.h.
|
private |
This function does not call 'skipSpace()'. On the other hand, 'readLF()' calls 'skipSpace()' before calling 'readLF0()'
Definition at line 359 of file EasyScanner.cpp.
|
inline |
Definition at line 141 of file EasyScanner.h.
Definition at line 225 of file EasyScanner.h.
The exception version of readLF().
Definition at line 221 of file EasyScanner.h.
bool EasyScanner::readLine | ( | ) |
Definition at line 696 of file EasyScanner.cpp.
bool EasyScanner::readQuotedString | ( | bool | allowNoQuotedWord = false | ) |
read a quoted string. If 'allowNoQuotedWord' is true, the function read a word without quotations.
Definition at line 613 of file EasyScanner.cpp.
|
inline |
Definition at line 206 of file EasyScanner.h.
In contrast to readWord(), this function allows a string to include siglums such as !,",#,$,%,&,...
Definition at line 112 of file EasyScanner.h.
bool EasyScanner::readString | ( | const char * | str | ) |
Definition at line 593 of file EasyScanner.cpp.
|
inline |
Definition at line 119 of file EasyScanner.h.
Definition at line 572 of file EasyScanner.cpp.
|
inline |
The exception version of readString().
Definition at line 201 of file EasyScanner.h.
bool EasyScanner::readSymbol | ( | ) |
Definition at line 649 of file EasyScanner.cpp.
bool EasyScanner::readSymbol | ( | int | id | ) |
Definition at line 662 of file EasyScanner.cpp.
The exception version of readSymbol().
Definition at line 214 of file EasyScanner.h.
int EasyScanner::readToken | ( | ) |
Definition at line 388 of file EasyScanner.cpp.
bool EasyScanner::readUnquotedTextBlock | ( | ) |
Definition at line 628 of file EasyScanner.cpp.
|
inline |
In contrast to readString(), this function does not recognize siglums except '_' as a part of a word.
Definition at line 103 of file EasyScanner.h.
|
private |
Definition at line 551 of file EasyScanner.cpp.
|
inline |
The exception version of readWord().
Definition at line 192 of file EasyScanner.h.
Definition at line 61 of file EasyScanner.h.
void EasyScanner::setCommentChar | ( | char | cc | ) |
if 0, comment is disabled
This function sets the identifier character of comment beginning.
cc | Identifier character. Default is '#'. If you want no comment, set 0. |
Definition at line 241 of file EasyScanner.cpp.
Definition at line 83 of file EasyScanner.h.
Definition at line 198 of file EasyScanner.cpp.
void EasyScanner::setLineOriented | ( | bool | on | ) |
Definition at line 247 of file EasyScanner.cpp.
void EasyScanner::setQuoteChar | ( | char | qs | ) |
If you want to read quoted string, set quote character by this function. In default, this is unset.
Definition at line 264 of file EasyScanner.cpp.
This function directly sets a text in the main memory
Definition at line 177 of file EasyScanner.cpp.
void EasyScanner::setWhiteSpaceChar | ( | char | ws | ) |
If there is a character to ignore, you can set it by this function
Definition at line 254 of file EasyScanner.cpp.
bool EasyScanner::skipBlankLines | ( | ) |
Definition at line 719 of file EasyScanner.cpp.
bool EasyScanner::skipLine | ( | ) |
Definition at line 682 of file EasyScanner.cpp.
void EasyScanner::skipSpace | ( | ) |
Definition at line 319 of file EasyScanner.cpp.
|
inlineprivate |
move the current position to just before the end (LF or EOF) of a line
Definition at line 313 of file EasyScanner.cpp.
Definition at line 221 of file EasyScanner.cpp.
Definition at line 231 of file EasyScanner.cpp.
void EasyScanner::toLower | ( | ) |
This function makes all the characters in stringValue lower case
Definition at line 445 of file EasyScanner.cpp.
|
friend |
Definition at line 733 of file EasyScanner.cpp.
|
friend |
Definition at line 743 of file EasyScanner.cpp.
|
friend |
Definition at line 754 of file EasyScanner.cpp.
|
friend |
Definition at line 766 of file EasyScanner.cpp.
|
friend |
|
friend |
Definition at line 787 of file EasyScanner.cpp.
char hrp::EasyScanner::charValue |
Definition at line 232 of file EasyScanner.h.
|
private |
Definition at line 255 of file EasyScanner.h.
std::string hrp::EasyScanner::defaultErrorMessage |
Definition at line 235 of file EasyScanner.h.
double hrp::EasyScanner::doubleValue |
Definition at line 230 of file EasyScanner.h.
Endl hrp::EasyScanner::endl |
Definition at line 52 of file EasyScanner.h.
std::string hrp::EasyScanner::filename |
Definition at line 240 of file EasyScanner.h.
int hrp::EasyScanner::intValue |
Definition at line 229 of file EasyScanner.h.
|
private |
Definition at line 257 of file EasyScanner.h.
int hrp::EasyScanner::lineNumber |
Definition at line 236 of file EasyScanner.h.
|
private |
Definition at line 254 of file EasyScanner.h.
|
private |
Definition at line 256 of file EasyScanner.h.
|
private |
Definition at line 252 of file EasyScanner.h.
std::string hrp::EasyScanner::stringValue |
Definition at line 231 of file EasyScanner.h.
|
private |
Definition at line 261 of file EasyScanner.h.
int hrp::EasyScanner::symbolValue |
Definition at line 233 of file EasyScanner.h.
char* hrp::EasyScanner::text |
Definition at line 238 of file EasyScanner.h.
|
private |
Definition at line 251 of file EasyScanner.h.
|
private |
Definition at line 253 of file EasyScanner.h.
|
private |
Definition at line 259 of file EasyScanner.h.