kspread
KSpread::Token Class Reference
#include <formula.h>
Detailed Description
Token.
Definition at line 37 of file formula.h.
Public Types | |
enum | Type { Unknown = 0, Boolean, Integer, Float, String, Operator, Cell, Range, Identifier } |
enum | Op { InvalidOp = 0, Plus, Minus, Asterisk, Slash, Caret, LeftPar, RightPar, Comma, Semicolon, Ampersand, Equal, NotEqual, Less, Greater, LessEqual, GreaterEqual, Percent } |
Public Member Functions | |
Token (Type type=Unknown, const QString &text=QString::null, int pos=-1) | |
Token (const Token &) | |
Token & | operator= (const Token &) |
Type | type () const |
QString | text () const |
int | pos () const |
bool | isBoolean () const |
bool | isInteger () const |
bool | isFloat () const |
bool | isNumber () const |
bool | isString () const |
bool | isOperator () const |
bool | isCell () const |
bool | isRange () const |
bool | isIdentifier () const |
bool | asBoolean () const |
int | asInteger () const |
double | asFloat () const |
QString | asString () const |
Op | asOperator () const |
QString | sheetName () const |
QString | description () const |
Static Public Attributes | |
static const Token | null |
Protected Attributes | |
Type | m_type |
QString | m_text |
int | m_pos |
Member Enumeration Documentation
|
|
token types
|
Constructor & Destructor Documentation
|
Creates a token.
Definition at line 212 of file formula.cc. |
Member Function Documentation
|
Returns boolean value for an boolean token. For any other type of token, return value is undefined. Definition at line 236 of file formula.cc. |
|
Returns floating-point value for a floating-point token. For any other type of token, returns 0.0. Definition at line 249 of file formula.cc. |
|
Returns integer value for an integer token. For any other type of token, returns 0. Definition at line 243 of file formula.cc. |
|
Returns operator value for an operator token. For any other type of token, returns Token::InvalidOp. Definition at line 261 of file formula.cc. |
|
Returns string value for a string token. For any other type of token, it returns QString::null. Note that token text for a string token still has leading and trailing double-quotes, i.e for "KOffice", text() return "KOffice" (with the quotes, 9 characters) while asString() only return KOffice (without quotes, 7 characters). Definition at line 255 of file formula.cc. |
|
Returns a short description of the token. Should be used only to assist debugging. Definition at line 278 of file formula.cc. |
|
Returns true if token is a boolean token.
|
|
Returns true if token is a cell reference token.
|
|
Returns true if token is a floating-point token.
|
|
Returns true if token is an identifier.
|
|
Returns true if token is a integer token.
|
|
Returns true if token is either integer or floating-point token.
|
|
Returns true if token is an operator token.
|
|
Returns true if token is a range reference token.
|
|
Returns true if token is a string token.
|
|
Returns sheet name in a cell reference token. For any other type of token, it returns QString::null. If the cell reference doesn't specify sheet name, an empty string is returned. As example, for "Sheet1!B3" , sheetName() returns "Sheet1" while for "A2" sheetName() returns "". When sheet name contains quotes (as if the name has spaces) like in "'Sales Forecast'!F4", sheetName() returns the name without the quotes, i.e "Sales Forecast" in this case. Definition at line 267 of file formula.cc. |
|
Returns text associated with the token. If you want to obtain meaningful value of this token, instead of text(), you might use asInteger(), asFloat(), asString(), sheetName(), etc. |
|
Returns type of the token.
|
The documentation for this class was generated from the following files: