Search Query Node. More...
#include <gsearchquerynode.h>
Public Types | |
enum | tNode { nOperator, nToken } |
Query Node Type. More... | |
enum | tOperator { oNOP, oNOT, oOR, oAND, oINC, oSIB, oNAND, oNINC, oNSIB } |
Query Operator Type. More... | |
Public Member Functions | |
GSearchQueryNode (tOperator op) | |
GSearchQueryNode (GConcept *concept, GSearchToken::tType type) | |
GSearchQueryNode (GSession *session, const R::RString &token, GSearchToken::tType type) | |
int | Compare (const GSearchQueryNode &node) const |
GSearchQueryNode * | GetFirst (void) const |
GSearchQueryNode * | GetLast (void) const |
GSearchQueryNode * | GetParent (void) const |
size_t | GetDepth (void) const |
size_t | GetNbNodes (void) const |
tNode | GetType (void) const |
bool | IsOperator (void) const |
bool | IsToken (void) const |
tOperator | GetOperator (void) const |
R::RString | GetOperatorName (void) const |
GSearchToken * | GetToken (void) const |
~GSearchQueryNode (void) | |
Static Public Member Functions | |
static tOperator | GetOperator (const R::RChar c) |
static tOperator | GetNotOperator (const R::RChar c) |
Private Attributes | |
tNode | Type |
union { | |
tOperator Operator | |
GSearchToken * Token | |
} | Value |
Detailed Description
Search Query Node.
The GSearchQueryNode class provides a representation of a query node. In practice, a node is either an operator or a token.
Member Enumeration Documentation
enum tNode |
enum tOperator |
Query Operator Type.
Several operators can be used in a structured query. Besides the classical Boolean operators, some operators allow hierarchical relations.
Constructor & Destructor Documentation
GSearchQueryNode | ( | tOperator | op | ) |
Construct an operator node.
- Parameters
-
op Operator.
GSearchQueryNode | ( | GConcept * | concept, |
GSearchToken::tType | type | ||
) |
Construct a token.
- Parameters
-
session Session. concept Concept.
GSearchQueryNode | ( | GSession * | session, |
const R::RString & | token, | ||
GSearchToken::tType | type | ||
) |
Construct a token.
- Parameters
-
session Session. token String containing the token. type Type of the token.
~GSearchQueryNode | ( | void | ) |
Destructor.
Member Function Documentation
int Compare | ( | const GSearchQueryNode & | node | ) | const |
Compare two node. In practice, the method does nothing.
- Parameters
-
node Node to compare with.
- Returns
- always -1
GSearchQueryNode* GetFirst | ( | void | ) | const |
- Returns
- the first child node. If null, the node has no children.
GSearchQueryNode* GetLast | ( | void | ) | const |
- Returns
- the last child node. If null, the node has no children.
GSearchQueryNode* GetParent | ( | void | ) | const |
- Returns
- the parent node. If null, the node is a top node.
size_t GetDepth | ( | void | ) | const |
Get the depth of the node.
- Returns
- the depth.
size_t GetNbNodes | ( | void | ) | const |
Get the number of child nodes.
- Returns
- the number of child nodes.
tNode GetType | ( | void | ) | const |
Get the type of the bode.
- Returns
- the type of the node.
bool IsOperator | ( | void | ) | const |
Look if the node is an operator.
- Returns
- true if the node is an operator.
bool IsToken | ( | void | ) | const |
Look if the node is a token.
- Returns
- true if the node is a token.
tOperator GetOperator | ( | void | ) | const |
Get the operator.
- Returns
- the operator of the node.
- Exceptions
-
an exception is generated if the node doesn't contain an operator.
R::RString GetOperatorName | ( | void | ) | const |
Get the name of the operator.
- Returns
- a R::RString.
- Exceptions
-
an exception is generated if the node doesn't contain an operator.
GSearchToken* GetToken | ( | void | ) | const |
Get the token corresponding to the node.
- Returns
- a string.
- Exceptions
-
an exception is generated if the node doesn't contain a token.
Look if a character correspond to a given operator.
- Parameters
-
c Character to look for.
- Returns
- the operator or toNOP if the character is an invalid one.
Look if a given character correspond to a operator that can be inverted.
- Parameters
-
c Character to look for.
- Returns
- the operator or toNOP if the character is an invalid one or has no inverted version.
Member Data Documentation
|
private |
Type of the node.
tOperator Operator |
The node corresponds to an operator.
GSearchToken* Token |
The node corresponds to a token.
union { ... } Value |
Value of the node.