#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::map< std::string, int > | SymbolMap |
|
typedef std::pair< std::string, int > | SymbolPair |
|
typedef boost::shared_ptr< SymbolMap > | SymbolMapPtr |
|
- Todo:
- introduce a pimpl to hide the use of map, vector
Enumerator |
---|
T_NONE |
|
T_SPACE |
|
T_ALPHABET |
|
T_INTEGER |
|
T_DOUBLE |
|
T_WORD |
|
T_STRING |
|
T_SIGLUM |
|
T_LF |
|
T_EOF |
|
EasyScanner::EasyScanner |
( |
| ) |
|
EasyScanner::EasyScanner |
( |
std::string |
filename | ) |
|
EasyScanner::EasyScanner |
( |
const EasyScanner & |
org, |
|
|
bool |
copyText = false |
|
) |
| |
Copy Constructor. New object inherits another's propety and symbols.
- Parameters
-
scanner | original object |
copy_text | If true, new object has same text as original |
EasyScanner::~EasyScanner |
( |
| ) |
|
|
virtual |
bool EasyScanner::checkLF |
( |
| ) |
|
void cnoid::EasyScanner::checkStringEx |
( |
const char * |
str, |
|
|
const char * |
message = 0 |
|
) |
| |
|
inline |
int cnoid::EasyScanner::getSymbolID |
( |
const std::string & |
symbol | ) |
|
|
inline |
bool cnoid::EasyScanner::isEOF |
( |
| ) |
|
|
inline |
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.
void EasyScanner::moveToHead |
( |
| ) |
|
int EasyScanner::peekChar |
( |
| ) |
|
void EasyScanner::putSymbols |
( |
| ) |
|
bool EasyScanner::readChar |
( |
| ) |
|
bool EasyScanner::readChar |
( |
int |
chara | ) |
|
int cnoid::EasyScanner::readCharEx |
( |
const char * |
message = 0 | ) |
|
|
inline |
The exception version of readChar().
- Returns
- Scanned char value.
void cnoid::EasyScanner::readCharEx |
( |
int |
chara, |
|
|
const char * |
message = 0 |
|
) |
| |
|
inline |
bool EasyScanner::readDouble |
( |
| ) |
|
double cnoid::EasyScanner::readDoubleEx |
( |
const char * |
message = 0 | ) |
|
|
inline |
The exception version of readDouble().
- Returns
- Scanned double value.
bool EasyScanner::readFloat |
( |
| ) |
|
float cnoid::EasyScanner::readFloatEx |
( |
const char * |
message = 0 | ) |
|
|
inline |
The exception version of readDouble().
- Returns
- Scanned double value.
bool EasyScanner::readInt |
( |
| ) |
|
int cnoid::EasyScanner::readIntEx |
( |
const char * |
message = 0 | ) |
|
|
inline |
The exception version of readInt().
- Returns
- Scanned int value.
bool cnoid::EasyScanner::readLF |
( |
| ) |
|
|
inline |
bool cnoid::EasyScanner::readLFEOF |
( |
| ) |
|
|
inline |
void cnoid::EasyScanner::readLFEOFex |
( |
const char * |
message = 0 | ) |
|
|
inline |
void cnoid::EasyScanner::readLFex |
( |
const char * |
message = 0 | ) |
|
|
inline |
bool EasyScanner::readLine |
( |
| ) |
|
bool EasyScanner::readQuotedString |
( |
bool |
allowNoQuotedWord = false | ) |
|
read a quoted string. If 'allowNoQuotedWord' is true, the function read a word without quotations.
const std::string& cnoid::EasyScanner::readQuotedStringEx |
( |
const char * |
message = 0 | ) |
|
|
inline |
bool cnoid::EasyScanner::readString |
( |
const int |
delimiterChar = ',' | ) |
|
|
inline |
In contrast to readWord(), this function allows a string to include siglums such as !,",#,$,%,&,...
bool EasyScanner::readString |
( |
const char * |
str | ) |
|
bool cnoid::EasyScanner::readString |
( |
const std::string & |
str | ) |
|
|
inline |
const std::string& cnoid::EasyScanner::readStringEx |
( |
const char * |
message = 0 | ) |
|
|
inline |
The exception version of readString().
- Returns
- Scanned word string.
bool EasyScanner::readSymbol |
( |
| ) |
|
bool EasyScanner::readSymbol |
( |
int |
id | ) |
|
int cnoid::EasyScanner::readSymbolEx |
( |
const char * |
message = 0 | ) |
|
|
inline |
The exception version of readSymbol().
- Returns
- ID of the scanned symbol.
int EasyScanner::readToken |
( |
| ) |
|
bool EasyScanner::readUnquotedTextBlock |
( |
| ) |
|
bool cnoid::EasyScanner::readWord |
( |
| ) |
|
|
inline |
In contrast to readString(), this function does not recognize siglums except '_' as a part of a word.
const std::string& cnoid::EasyScanner::readWordEx |
( |
const char * |
message = 0 | ) |
|
|
inline |
The exception version of readWord().
- Returns
- Scanned word string.
void cnoid::EasyScanner::registerSymbol |
( |
int |
id, |
|
|
const std::string & |
symbol |
|
) |
| |
|
inline |
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. |
void cnoid::EasyScanner::setDefaultErrorMessage |
( |
const std::string & |
message | ) |
|
|
inline |
void EasyScanner::setLineNumberOffset |
( |
int |
offset | ) |
|
void EasyScanner::setLineOriented |
( |
bool |
on | ) |
|
void EasyScanner::setQuoteChar |
( |
char |
qs | ) |
|
If you want to read quoted string, set quote character by this function. In default, this is unset.
void EasyScanner::setText |
( |
const char * |
text, |
|
|
int |
len |
|
) |
| |
This function directly sets a text in the main memory
void EasyScanner::setWhiteSpaceChar |
( |
char |
ws | ) |
|
If there is a character to ignore, you can set it by this function
bool EasyScanner::skipBlankLines |
( |
| ) |
|
bool EasyScanner::skipLine |
( |
| ) |
|
void EasyScanner::skipSpace |
( |
| ) |
|
void EasyScanner::skipToLineEnd |
( |
| ) |
|
move the current position to just before the end (LF or EOF) of a line
void EasyScanner::throwException |
( |
const char * |
message | ) |
|
void EasyScanner::throwException |
( |
const std::string & |
message | ) |
|
void EasyScanner::toLower |
( |
| ) |
|
This function makes all the characters in stringValue lower case
char cnoid::EasyScanner::charValue |
std::string cnoid::EasyScanner::defaultErrorMessage |
double cnoid::EasyScanner::doubleValue |
Endl cnoid::EasyScanner::endl |
std::string cnoid::EasyScanner::filename |
float cnoid::EasyScanner::floatValue |
int cnoid::EasyScanner::intValue |
int cnoid::EasyScanner::lineNumber |
std::string cnoid::EasyScanner::stringValue |
int cnoid::EasyScanner::symbolValue |
char* cnoid::EasyScanner::text |
The documentation for this class was generated from the following files: