KDbToken

Search for usage in LXR

#include <KDbToken.h>

Public Member Functions

 KDbToken ()
 
 KDbToken (char charToken)
 
 KDbToken (const KDbToken &other)
 
bool isValid () const
 
QString name () const
 
bool operator!= (char charToken) const
 
bool operator!= (KDbToken other) const
 
void operator= (char charToken)
 
bool operator== (char charToken) const
 
bool operator== (KDbToken other) const
 
char toChar () const
 
QString toString (const KDbDriver *driver=nullptr) const
 
int value () const
 

Static Public Member Functions

static QList< KDbTokenallTokens ()
 
static QString toString (KDbToken token, const KDbDriver *driver=nullptr)
 

Static Public Attributes

static const KDbToken AND
 
static const KDbToken AS
 
static const KDbToken AS_EMPTY
 
static const KDbToken ASC
 
static const KDbToken AUTO_INCREMENT
 
static const KDbToken BETWEEN
 
static const KDbToken BETWEEN_AND
 
static const KDbToken BIT
 
static const KDbToken BITWISE_SHIFT_LEFT
 
static const KDbToken BITWISE_SHIFT_RIGHT
 
static const KDbToken BY
 
static const KDbToken CHARACTER_STRING_LITERAL
 
static const KDbToken CONCATENATION
 
static const KDbToken CREATE
 
static const KDbToken DATE_CONST
 
static const KDbToken DATE_TIME_INTEGER
 
static const KDbToken DATETIME_CONST
 
static const KDbToken DESC
 
static const KDbToken DISTINCT
 
static const KDbToken DOUBLE_QUOTED_STRING
 
static const KDbToken EXCEPT
 
static const KDbToken FROM
 
static const KDbToken GREATER_OR_EQUAL
 
static const KDbToken IDENTIFIER
 
static const KDbToken IDENTIFIER_DOT_ASTERISK
 
static const KDbToken ILIKE
 
static const KDbToken INTEGER_CONST
 
static const KDbToken INTERSECT
 
static const KDbToken JOIN
 
static const KDbToken KEY
 
static const KDbToken LEFT
 
static const KDbToken LESS_OR_EQUAL
 
static const KDbToken LIKE
 
static const int maxCharTokenValue = 253
 
static const int maxTokenValue = YYMAXUTOK
 
static const KDbToken NOT
 
static const KDbToken NOT_BETWEEN
 
static const KDbToken NOT_BETWEEN_AND
 
static const KDbToken NOT_EQUAL
 
static const KDbToken NOT_EQUAL2
 
static const KDbToken NOT_LIKE
 
static const KDbToken NOT_SIMILAR_TO
 
static const KDbToken OR
 
static const KDbToken ORDER
 
static const KDbToken PRIMARY
 
static const KDbToken QUERY_PARAMETER
 
static const KDbToken REAL_CONST
 
static const KDbToken RIGHT
 
static const KDbToken SCAN_ERROR
 
static const KDbToken SELECT
 
static const KDbToken SIMILAR_TO
 
static const KDbToken SQL
 
static const KDbToken SQL_FALSE
 
static const KDbToken SQL_IN
 
static const KDbToken SQL_IS
 
static const KDbToken SQL_IS_NOT_NULL
 
static const KDbToken SQL_IS_NULL
 
static const KDbToken SQL_NULL
 
static const KDbToken SQL_ON
 
static const KDbToken SQL_TRUE
 
static const KDbToken SQL_TYPE
 
static const KDbToken TABLE
 
static const KDbToken TABS_OR_SPACES
 
static const KDbToken TIME_AM
 
static const KDbToken TIME_CONST
 
static const KDbToken TIME_PM
 
static const KDbToken UMINUS
 
static const KDbToken UNION
 
static const KDbToken VARCHAR
 
static const KDbToken WHERE
 
static const KDbToken XOR
 

Detailed Description

A type-safe KDbSQL token It can be used in KDb expressions.

See also
KDbExpression

Definition at line 36 of file KDbToken.h.

Constructor & Destructor Documentation

◆ KDbToken() [1/2]

KDbToken::KDbToken ( )
inline

Creates an invalid token.

Todo:
add KDbToken(const QByteArray &name)

Definition at line 42 of file KDbToken.h.

◆ KDbToken() [2/2]

KDbToken::KDbToken ( char  charToken)

Creates a single-character token Only characters that belong to the grammar are accepted: ';' ',' '.

' '>' '<' '=' '+' '-' '&' '|' '/' '*' '' '~' '#' ':' '(' ')' Invalid KDbToken is created for character that is not accepted.

Definition at line 33 of file KDbToken.cpp.

Member Function Documentation

◆ isValid()

bool KDbToken::isValid ( ) const
inline
Returns
true if this token is valid

Definition at line 53 of file KDbToken.h.

◆ name()

QString KDbToken::name ( ) const
Returns
name of this token Useful for debugging. For example "NOT_EQUAL" string is returned for the NOT_EQUAL token. A single character is returned for printable single-character tokens. A number is returned for non-printable single-character. "<INVALID_TOKEN>" is returned for an invalid string.

Definition at line 38 of file KDbToken.cpp.

◆ operator!=() [1/2]

bool KDbToken::operator!= ( char  charToken) const
inline
Returns
true if this token is not equal to other token

Definition at line 97 of file KDbToken.h.

◆ operator!=() [2/2]

bool KDbToken::operator!= ( KDbToken  other) const
inline
Returns
true if this token is not equal to other token

Definition at line 91 of file KDbToken.h.

◆ operator=()

void KDbToken::operator= ( char  charToken)
inline

Assigns a token.

Definition at line 100 of file KDbToken.h.

◆ operator==() [1/2]

bool KDbToken::operator== ( char  charToken) const
inline
Returns
true if this token is equal to other token

Definition at line 94 of file KDbToken.h.

◆ operator==() [2/2]

bool KDbToken::operator== ( KDbToken  other) const
inline
Returns
true if this token is equal to other token

Definition at line 88 of file KDbToken.h.

◆ toChar()

char KDbToken::toChar ( ) const
inline
Returns
character equivalent of this token Only character-based tokens are supported this way (toInt() <= maxCharTokenValue). For unsupported tokens nullptr is returned.

Definition at line 82 of file KDbToken.h.

◆ toString() [1/2]

QString KDbToken::toString ( const KDbDriver driver = nullptr) const
Returns
string interpretation of this token (as visibe to the user) For example "<>" is returned for the NOT_EQUAL token. Empty string is returned for an invalid string The result may depend on the optional driver parameter. If driver is nullptr, representation for portable KDbSQL dialect is returned.

Definition at line 54 of file KDbToken.cpp.

◆ toString() [2/2]

QString KDbToken::toString ( KDbToken  token,
const KDbDriver driver = nullptr 
)
static

Like toString(const KDbDriver *driver)

Definition at line 92 of file KDbToken.cpp.

◆ value()

int KDbToken::value ( ) const
inline
Returns
numeric value of this token

Definition at line 85 of file KDbToken.h.

Member Data Documentation

◆ BETWEEN_AND

const KDbToken KDbToken::BETWEEN_AND
static

Custom tokens are not used in parser but used as an extension in expression classes.

Definition at line 173 of file KDbToken.h.

◆ maxCharTokenValue

const int KDbToken::maxCharTokenValue = 253
static

Maximum character token value (253)

Definition at line 74 of file KDbToken.h.

◆ maxTokenValue

const int KDbToken::maxTokenValue = YYMAXUTOK
static

Maximum character token value.

Definition at line 77 of file KDbToken.h.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Dec 3 2023 04:12:19 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.