#include <EasyScanner.h>
|
enum | TokenType {
T_NONE = 0,
T_SPACE,
T_ALPHABET,
T_INTEGER,
T_DOUBLE,
T_WORD,
T_STRING,
T_SIGLUM,
T_LF,
T_EOF
} |
|
typedef std::unordered_map< std::string, int > | SymbolMap |
|
typedef std::pair< std::string, int > | SymbolPair |
|
◆ SymbolMap
◆ SymbolPair
◆ TokenType
Enumerator |
---|
T_NONE | |
T_SPACE | |
T_ALPHABET | |
T_INTEGER | |
T_DOUBLE | |
T_WORD | |
T_STRING | |
T_SIGLUM | |
T_LF | |
T_EOF | |
◆ EasyScanner() [1/3]
EasyScanner::EasyScanner |
( |
| ) |
|
◆ EasyScanner() [2/3]
EasyScanner::EasyScanner |
( |
std::string |
filename | ) |
|
◆ EasyScanner() [3/3]
EasyScanner::EasyScanner |
( |
const EasyScanner & |
org, |
|
|
bool |
copyText = false |
|
) |
| |
Copy Constructor. New object inherits another's propety and symbols.
- Parameters
-
org | original object |
copyText | If true, new object has same text as original |
◆ ~EasyScanner()
EasyScanner::~EasyScanner |
( |
| ) |
|
|
virtual |
◆ checkLF()
bool EasyScanner::checkLF |
( |
| ) |
|
◆ checkStringEx()
void cnoid::EasyScanner::checkStringEx |
( |
const char * |
str, |
|
|
const char * |
message = 0 |
|
) |
| |
|
inline |
◆ getSymbolID()
int cnoid::EasyScanner::getSymbolID |
( |
const std::string & |
symbol | ) |
|
|
inline |
◆ isEOF()
bool cnoid::EasyScanner::isEOF |
( |
| ) |
|
|
inline |
◆ loadFile()
void EasyScanner::loadFile |
( |
const std::string & |
filename | ) |
|
This function loads a text from a given file. The function thorws EasyScanner::Exception when the file cannot be loaded.
◆ moveToHead()
void EasyScanner::moveToHead |
( |
| ) |
|
◆ peekChar()
int EasyScanner::peekChar |
( |
| ) |
|
◆ putSymbols()
void EasyScanner::putSymbols |
( |
| ) |
|
◆ readChar() [1/2]
bool EasyScanner::readChar |
( |
| ) |
|
◆ readChar() [2/2]
bool EasyScanner::readChar |
( |
int |
chara | ) |
|
◆ readCharEx() [1/2]
int cnoid::EasyScanner::readCharEx |
( |
const char * |
message = 0 | ) |
|
|
inline |
The exception version of readChar().
- Returns
- Scanned char value.
◆ readCharEx() [2/2]
void cnoid::EasyScanner::readCharEx |
( |
int |
chara, |
|
|
const char * |
message = 0 |
|
) |
| |
|
inline |
◆ readDouble()
bool EasyScanner::readDouble |
( |
| ) |
|
◆ readDoubleEx()
double cnoid::EasyScanner::readDoubleEx |
( |
const char * |
message = 0 | ) |
|
|
inline |
The exception version of readDouble().
- Returns
- Scanned double value.
◆ readFloat()
bool EasyScanner::readFloat |
( |
| ) |
|
◆ readFloatEx()
float cnoid::EasyScanner::readFloatEx |
( |
const char * |
message = 0 | ) |
|
|
inline |
The exception version of readDouble().
- Returns
- Scanned double value.
◆ readInt()
bool EasyScanner::readInt |
( |
| ) |
|
◆ readIntEx()
int cnoid::EasyScanner::readIntEx |
( |
const char * |
message = 0 | ) |
|
|
inline |
The exception version of readInt().
- Returns
- Scanned int value.
◆ readLF()
bool cnoid::EasyScanner::readLF |
( |
| ) |
|
|
inline |
◆ readLFEOF()
bool cnoid::EasyScanner::readLFEOF |
( |
| ) |
|
|
inline |
◆ readLFEOFex()
void cnoid::EasyScanner::readLFEOFex |
( |
const char * |
message = 0 | ) |
|
|
inline |
◆ readLFex()
void cnoid::EasyScanner::readLFex |
( |
const char * |
message = 0 | ) |
|
|
inline |
◆ readLine()
bool EasyScanner::readLine |
( |
| ) |
|
◆ readQuotedString()
bool EasyScanner::readQuotedString |
( |
bool |
allowNoQuotedWord = false | ) |
|
read a quoted string. If 'allowNoQuotedWord' is true, the function read a word without quotations.
◆ readQuotedStringEx()
const std::string& cnoid::EasyScanner::readQuotedStringEx |
( |
const char * |
message = 0 | ) |
|
|
inline |
◆ readString() [1/3]
bool EasyScanner::readString |
( |
const char * |
str | ) |
|
◆ readString() [2/3]
bool cnoid::EasyScanner::readString |
( |
const int |
delimiterChar = ',' | ) |
|
|
inline |
In contrast to readWord(), this function allows a string to include siglums such as !,",#,$,%,&,...
◆ readString() [3/3]
bool cnoid::EasyScanner::readString |
( |
const std::string & |
str | ) |
|
|
inline |
◆ readStringEx()
const std::string& cnoid::EasyScanner::readStringEx |
( |
const char * |
message = 0 | ) |
|
|
inline |
The exception version of readString().
- Returns
- Scanned word string.
◆ readSymbol() [1/2]
bool EasyScanner::readSymbol |
( |
| ) |
|
◆ readSymbol() [2/2]
bool EasyScanner::readSymbol |
( |
int |
id | ) |
|
◆ readSymbolEx()
int cnoid::EasyScanner::readSymbolEx |
( |
const char * |
message = 0 | ) |
|
|
inline |
The exception version of readSymbol().
- Returns
- ID of the scanned symbol.
◆ readToken()
int EasyScanner::readToken |
( |
| ) |
|
◆ readUnquotedTextBlock()
bool EasyScanner::readUnquotedTextBlock |
( |
| ) |
|
◆ readWord()
bool cnoid::EasyScanner::readWord |
( |
| ) |
|
|
inline |
In contrast to readString(), this function does not recognize siglums except '_' as a part of a word.
◆ readWordEx()
const std::string& cnoid::EasyScanner::readWordEx |
( |
const char * |
message = 0 | ) |
|
|
inline |
The exception version of readWord().
- Returns
- Scanned word string.
◆ registerSymbol()
void cnoid::EasyScanner::registerSymbol |
( |
int |
id, |
|
|
const std::string & |
symbol |
|
) |
| |
|
inline |
◆ setCommentChar()
void EasyScanner::setCommentChar |
( |
char |
cc | ) |
|
if 0, comment is disabled
This function sets the identifier character of comment beginning.
- Parameters
-
cc | Identifier character. Default is '#'. If you want no comment, set 0. |
◆ setDefaultErrorMessage()
void cnoid::EasyScanner::setDefaultErrorMessage |
( |
const std::string & |
message | ) |
|
|
inline |
◆ setLineNumberOffset()
void EasyScanner::setLineNumberOffset |
( |
int |
offset | ) |
|
◆ setLineOriented()
void EasyScanner::setLineOriented |
( |
bool |
on | ) |
|
◆ setQuoteChar()
void EasyScanner::setQuoteChar |
( |
char |
qs | ) |
|
If you want to read quoted string, set quote character by this function. In default, this is unset.
◆ setSymbols()
void cnoid::EasyScanner::setSymbols |
( |
std::shared_ptr< SymbolMap > |
symbols | ) |
|
|
inline |
◆ setText()
void EasyScanner::setText |
( |
const char * |
text, |
|
|
size_t |
len |
|
) |
| |
This function directly sets a text in the main memory
◆ setWhiteSpaceChar()
void EasyScanner::setWhiteSpaceChar |
( |
char |
ws | ) |
|
If there is a character to ignore, you can set it by this function
◆ skipBlankLines()
bool EasyScanner::skipBlankLines |
( |
| ) |
|
◆ skipLine()
bool EasyScanner::skipLine |
( |
| ) |
|
◆ skipSpace()
void EasyScanner::skipSpace |
( |
| ) |
|
◆ skipToLineEnd()
void EasyScanner::skipToLineEnd |
( |
| ) |
|
move the current position to just before the end (LF or EOF) of a line
◆ throwException() [1/2]
void EasyScanner::throwException |
( |
const char * |
message | ) |
|
◆ throwException() [2/2]
void EasyScanner::throwException |
( |
const std::string & |
message | ) |
|
◆ toLower()
void EasyScanner::toLower |
( |
| ) |
|
This function makes all the characters in stringValue lower case
◆ operator>> [1/6]
◆ operator>> [2/6]
◆ operator>> [3/6]
◆ operator>> [4/6]
◆ operator>> [5/6]
◆ operator>> [6/6]
◆ charValue
char cnoid::EasyScanner::charValue |
◆ defaultErrorMessage
std::string cnoid::EasyScanner::defaultErrorMessage |
◆ doubleValue
double cnoid::EasyScanner::doubleValue |
◆ endl
Endl cnoid::EasyScanner::endl |
◆ filename
std::string cnoid::EasyScanner::filename |
◆ floatValue
float cnoid::EasyScanner::floatValue |
◆ intValue
int cnoid::EasyScanner::intValue |
◆ lineNumber
int cnoid::EasyScanner::lineNumber |
◆ stringValue
std::string cnoid::EasyScanner::stringValue |
◆ symbolValue
int cnoid::EasyScanner::symbolValue |
◆ text
char* cnoid::EasyScanner::text |
The documentation for this class was generated from the following files: