Quantum GIS API Documentation
1.7.5-Wroclaw
|
A representation of a node in a search tree. More...
#include <qgssearchtreenode.h>
Public Types | |
enum | Type { tOperator = 1, tNumber, tColumnRef, tString, tNodeList } |
defines possible types of node More... | |
enum | Operator { opAND = 1, opOR, opNOT, opPLUS, opMINUS, opMUL, opMOD, opDIV, opPOW, opSQRT, opSIN, opCOS, opTAN, opASIN, opACOS, opATAN, opATAN2, opTOINT, opTOREAL, opTOSTRING, opX, opY, opLENGTH, opAREA, opPERIMETER, opID, opISNULL, opISNOTNULL, opEQ, opNE, opGT, opLT, opGE, opLE, opRegexp, opLike, opILike, opIN, opNOTIN, opCONCAT, opLOWER, opUPPER, opREPLACE, opSTRLEN, opSUBSTR, opROWNUM } |
possible operators More... | |
Public Member Functions | |
QgsSearchTreeNode (Type type) | |
constructors More... | |
QgsSearchTreeNode (double number) | |
QgsSearchTreeNode (Operator op, QgsSearchTreeNode *left, QgsSearchTreeNode *right) | |
QgsSearchTreeNode (QString text, bool isColumnRef) | |
QgsSearchTreeNode (const QgsSearchTreeNode &node) | |
copy contructor - copies whole tree! More... | |
~QgsSearchTreeNode () | |
destructor - deletes children nodes (if any) More... | |
Type | type () const |
returns type of current node More... | |
Operator | op () const |
node value getters More... | |
double | number () const |
QString | columnRef () const |
QString | string () const |
void | setOp (Operator op) |
node value setters (type is set also) More... | |
void | setNumber (double number) |
void | setColumnRef (const QString &str) |
void | setString (const QString &str) |
QgsSearchTreeNode * | Left () |
children More... | |
QgsSearchTreeNode * | Right () |
void | setLeft (QgsSearchTreeNode *left) |
void | setRight (QgsSearchTreeNode *right) |
QString | makeSearchString () |
returns search string that should be equal to original parsed string More... | |
bool | checkAgainst (const QgsFieldMap &fields, QgsFeature &f) |
checks whether the node tree is valid against supplied attributes More... | |
Q_DECL_DEPRECATED bool | checkAgainst (const QgsFieldMap &fields, const QgsAttributeMap &attributes, QgsGeometry *geom=0) |
bool | hasError () |
checks if there were errors during evaluation More... | |
const QString & | errorMsg () |
returns error message More... | |
bool | getValue (QgsSearchTreeValue &value, QgsSearchTreeNode *node, const QgsFieldMap &fields, QgsFeature &f) |
wrapper around valueAgainst() More... | |
Q_DECL_DEPRECATED bool | getValue (QgsSearchTreeValue &value, QgsSearchTreeNode *node, const QgsFieldMap &fields, const QgsAttributeMap &attributes, QgsGeometry *geom=0) |
QStringList | referencedColumns () |
return a list of referenced columns in the tree More... | |
QList< QgsSearchTreeNode * > | columnRefNodes () |
return a list of all attribute nodes More... | |
bool | needsGeometry () |
check whether there are any operators that need geometry (for area, length) More... | |
void | setCurrentRowNumber (int rownum) |
Set current row number within this tree. More... | |
void | append (QgsSearchTreeNode *) |
append a node to the list More... | |
void | append (QList< QgsSearchTreeNode * >) |
append nodelist to the list More... | |
Static Public Member Functions | |
static QString | quotedColumnRef (QString name) |
return quoted column reference (in double quotes) More... | |
Protected Member Functions | |
QgsSearchTreeValue | valueAgainst (const QgsFieldMap &fields, QgsFeature &f) |
returns scalar value of node More... | |
Q_DECL_DEPRECATED QgsSearchTreeValue | valueAgainst (const QgsFieldMap &fields, const QgsAttributeMap &attributes, QgsGeometry *geom=0) |
void | stripText () |
strips mText when node is of string type More... | |
void | stripColRef () |
strip mText when column reference is quoted More... | |
void | init () |
initialize node's internals More... | |
Private Attributes | |
Type | mType |
node type More... | |
Operator | mOp |
data More... | |
double | mNumber |
QString | mText |
QList< QgsSearchTreeNode * > | mNodeList |
QString | mError |
QgsSearchTreeNode * | mLeft |
children More... | |
QgsSearchTreeNode * | mRight |
QgsDistanceArea * | mCalc |
For length() and area() functions. More... | |
A representation of a node in a search tree.
node in tree of parsed search string node is terminal (has no children) if it's a number, column ref or string non-terminal is only node with operator - with 1 or 2 children
Definition at line 43 of file qgssearchtreenode.h.
possible operators
Definition at line 58 of file qgssearchtreenode.h.
defines possible types of node
Enumerator | |
---|---|
tOperator | |
tNumber | |
tColumnRef | |
tString | |
tNodeList |
Definition at line 48 of file qgssearchtreenode.h.
QgsSearchTreeNode::QgsSearchTreeNode | ( | QgsSearchTreeNode::Type | t) |
constructors
Definition at line 35 of file qgssearchtreenode.cpp.
References init(), mLeft, mRight, mType, and tNodeList.
Referenced by QgsSearchTreeNode().
QgsSearchTreeNode::QgsSearchTreeNode | ( | double | number) |
QgsSearchTreeNode::QgsSearchTreeNode | ( | Operator | op, |
QgsSearchTreeNode * | left, | ||
QgsSearchTreeNode * | right | ||
) |
QgsSearchTreeNode::QgsSearchTreeNode | ( | QString | text, |
bool | isColumnRef | ||
) |
Definition at line 69 of file qgssearchtreenode.cpp.
References init(), mLeft, mRight, mText, mType, stripColRef(), stripText(), tColumnRef, and tString.
QgsSearchTreeNode::QgsSearchTreeNode | ( | const QgsSearchTreeNode & | node) |
QgsSearchTreeNode::~QgsSearchTreeNode | ( | ) |
void QgsSearchTreeNode::append | ( | QgsSearchTreeNode * | node) |
void QgsSearchTreeNode::append | ( | QList< QgsSearchTreeNode * > | nodes) |
append nodelist to the list
Definition at line 852 of file qgssearchtreenode.cpp.
References mNodeList.
bool QgsSearchTreeNode::checkAgainst | ( | const QgsFieldMap & | fields, |
QgsFeature & | f | ||
) |
checks whether the node tree is valid against supplied attributes
Definition at line 392 of file qgssearchtreenode.cpp.
References checkAgainst(), QgsSearchTreeValue::compare(), getValue(), QgsSearchTreeValue::isNull(), QgsSearchTreeValue::isNumeric(), makeSearchString(), mError, mLeft, mNodeList, mOp, mRight, mType, opAND, opEQ, opGE, opGT, opILike, opIN, opISNOTNULL, opISNULL, opLE, opLike, opLT, opNE, opNOT, opNOTIN, opOR, opRegexp, QgsDebugMsgLevel, QgsSearchTreeValue::string(), tNodeList, tOperator, and type().
Referenced by checkAgainst(), and QgsSearchQueryBuilder::countRecords().
bool QgsSearchTreeNode::checkAgainst | ( | const QgsFieldMap & | fields, |
const QgsAttributeMap & | attributes, | ||
QgsGeometry * | geom = 0 |
||
) |
Definition at line 383 of file qgssearchtreenode.cpp.
References checkAgainst(), QgsFeature::setAttributeMap(), and QgsFeature::setGeometry().
|
inline |
Definition at line 142 of file qgssearchtreenode.h.
QList< QgsSearchTreeNode * > QgsSearchTreeNode::columnRefNodes | ( | ) |
return a list of all attribute nodes
Definition at line 343 of file qgssearchtreenode.cpp.
References columnRefNodes(), mLeft, mRight, mType, tColumnRef, and tOperator.
Referenced by columnRefNodes(), QgsSearchQueryBuilder::loadQuery(), and referencedColumns().
|
inline |
returns error message
Definition at line 171 of file qgssearchtreenode.h.
Referenced by QgsSearchQueryBuilder::countRecords().
bool QgsSearchTreeNode::getValue | ( | QgsSearchTreeValue & | value, |
QgsSearchTreeNode * | node, | ||
const QgsFieldMap & | fields, | ||
QgsFeature & | f | ||
) |
wrapper around valueAgainst()
Definition at line 544 of file qgssearchtreenode.cpp.
References QgsSearchTreeValue::isError(), mError, QgsSearchTreeValue::number(), QgsSearchTreeValue::string(), and valueAgainst().
Referenced by checkAgainst(), getValue(), and valueAgainst().
bool QgsSearchTreeNode::getValue | ( | QgsSearchTreeValue & | value, |
QgsSearchTreeNode * | node, | ||
const QgsFieldMap & | fields, | ||
const QgsAttributeMap & | attributes, | ||
QgsGeometry * | geom = 0 |
||
) |
Definition at line 531 of file qgssearchtreenode.cpp.
References getValue(), QgsFeature::setAttributeMap(), and QgsFeature::setGeometry().
|
inline |
checks if there were errors during evaluation
Definition at line 168 of file qgssearchtreenode.h.
Referenced by QgsSearchQueryBuilder::countRecords().
|
protected |
initialize node's internals
Definition at line 138 of file qgssearchtreenode.cpp.
References mCalc, mNumber, mOp, mType, opAREA, opLENGTH, opPERIMETER, opROWNUM, QgsDistanceArea::setEllipsoid(), QgsDistanceArea::setProjectionsEnabled(), and tOperator.
Referenced by QgsSearchTreeNode().
|
inline |
children
Definition at line 152 of file qgssearchtreenode.h.
QString QgsSearchTreeNode::makeSearchString | ( | ) |
returns search string that should be equal to original parsed string
Definition at line 200 of file qgssearchtreenode.cpp.
References makeSearchString(), mLeft, mNodeList, mNumber, mOp, mRight, mText, mType, opACOS, opAND, opAREA, opASIN, opATAN, opATAN2, opCONCAT, opCOS, opDIV, opEQ, opGE, opGT, opID, opILike, opIN, opISNOTNULL, opISNULL, opLE, opLENGTH, opLike, opLOWER, opLT, opMINUS, opMOD, opMUL, opNE, opNOT, opNOTIN, opOR, opPERIMETER, opPLUS, opPOW, opRegexp, opREPLACE, opROWNUM, opSIN, opSQRT, opSTRLEN, opSUBSTR, opTAN, opTOINT, opTOREAL, opTOSTRING, opUPPER, opX, opY, tColumnRef, tNodeList, tNumber, tOperator, and tString.
Referenced by checkAgainst(), QgsSearchQueryBuilder::loadQuery(), makeSearchString(), QgsSearchString::setTree(), and valueAgainst().
bool QgsSearchTreeNode::needsGeometry | ( | ) |
check whether there are any operators that need geometry (for area, length)
Definition at line 364 of file qgssearchtreenode.cpp.
References mLeft, mOp, mRight, mType, needsGeometry(), opAREA, opLENGTH, opPERIMETER, opX, opY, and tOperator.
Referenced by QgsSearchQueryBuilder::countRecords(), and needsGeometry().
|
inline |
Definition at line 141 of file qgssearchtreenode.h.
Referenced by QgsSearchTreeNode().
|
inline |
node value getters
Definition at line 140 of file qgssearchtreenode.h.
Referenced by QgsSearchTreeNode().
|
static |
return quoted column reference (in double quotes)
Definition at line 194 of file qgssearchtreenode.cpp.
Referenced by QgsSearchQueryBuilder::populateFields().
QStringList QgsSearchTreeNode::referencedColumns | ( | ) |
return a list of referenced columns in the tree
Definition at line 330 of file qgssearchtreenode.cpp.
References columnRefNodes().
Referenced by QgsSearchQueryBuilder::loadQuery().
|
inline |
Definition at line 153 of file qgssearchtreenode.h.
|
inline |
Definition at line 148 of file qgssearchtreenode.h.
void QgsSearchTreeNode::setCurrentRowNumber | ( | int | rownum) |
Set current row number within this tree.
This value is stored only in the nodes being $rownum operator - in mNumber
Definition at line 829 of file qgssearchtreenode.cpp.
References mLeft, mNumber, mOp, mRight, mType, opROWNUM, setCurrentRowNumber(), and tOperator.
Referenced by setCurrentRowNumber().
|
inline |
Definition at line 154 of file qgssearchtreenode.h.
|
inline |
Definition at line 147 of file qgssearchtreenode.h.
|
inline |
node value setters (type is set also)
Definition at line 146 of file qgssearchtreenode.h.
|
inline |
Definition at line 155 of file qgssearchtreenode.h.
|
inline |
Definition at line 149 of file qgssearchtreenode.h.
|
inline |
Definition at line 143 of file qgssearchtreenode.h.
|
protected |
strip mText when column reference is quoted
Definition at line 185 of file qgssearchtreenode.cpp.
References mText.
Referenced by QgsSearchTreeNode().
|
protected |
strips mText when node is of string type
Definition at line 158 of file qgssearchtreenode.cpp.
References mText.
Referenced by QgsSearchTreeNode().
|
inline |
returns type of current node
Definition at line 137 of file qgssearchtreenode.h.
Referenced by checkAgainst(), and valueAgainst().
|
protected |
returns scalar value of node
Definition at line 588 of file qgssearchtreenode.cpp.
References QgsGeometry::asPoint(), QgsFeature::attributeMap(), EVAL_STR, QgsFeature::geometry(), getValue(), QgsFeature::id(), QgsSearchTreeValue::isNumeric(), QGis::Line, makeSearchString(), mCalc, QgsDistanceArea::measure(), QgsDistanceArea::measurePerimeter(), mLeft, mNodeList, mNumber, mOp, mRight, mText, mType, QgsSearchTreeValue::number(), opACOS, opAREA, opASIN, opATAN, opATAN2, opCONCAT, opCOS, opDIV, opID, opLENGTH, opLOWER, opMINUS, opMOD, opMUL, opPERIMETER, opPLUS, opPOW, opREPLACE, opROWNUM, opSIN, opSQRT, opSTRLEN, opSUBSTR, opTAN, opTOINT, opTOREAL, opTOSTRING, opUPPER, opX, opY, QGis::Point, QGis::Polygon, QgsDebugMsgLevel, QgsSearchTreeValue::string(), tColumnRef, tNodeList, tNumber, tOperator, tString, QgsGeometry::type(), type(), QgsPoint::x(), and QgsPoint::y().
Referenced by getValue(), and valueAgainst().
|
protected |
Definition at line 577 of file qgssearchtreenode.cpp.
References QgsFeature::setAttributeMap(), QgsFeature::setGeometry(), and valueAgainst().
|
private |
For length() and area() functions.
Definition at line 250 of file qgssearchtreenode.h.
Referenced by init(), valueAgainst(), and ~QgsSearchTreeNode().
|
private |
Definition at line 243 of file qgssearchtreenode.h.
Referenced by checkAgainst(), and getValue().
|
private |
children
Definition at line 246 of file qgssearchtreenode.h.
Referenced by checkAgainst(), columnRefNodes(), makeSearchString(), needsGeometry(), QgsSearchTreeNode(), setCurrentRowNumber(), valueAgainst(), and ~QgsSearchTreeNode().
|
private |
Definition at line 241 of file qgssearchtreenode.h.
Referenced by append(), checkAgainst(), makeSearchString(), QgsSearchTreeNode(), valueAgainst(), and ~QgsSearchTreeNode().
|
private |
Definition at line 239 of file qgssearchtreenode.h.
Referenced by init(), makeSearchString(), QgsSearchTreeNode(), setCurrentRowNumber(), and valueAgainst().
|
private |
data
Definition at line 238 of file qgssearchtreenode.h.
Referenced by checkAgainst(), init(), makeSearchString(), needsGeometry(), QgsSearchTreeNode(), setCurrentRowNumber(), and valueAgainst().
|
private |
Definition at line 247 of file qgssearchtreenode.h.
Referenced by checkAgainst(), columnRefNodes(), makeSearchString(), needsGeometry(), QgsSearchTreeNode(), setCurrentRowNumber(), valueAgainst(), and ~QgsSearchTreeNode().
|
private |
Definition at line 240 of file qgssearchtreenode.h.
Referenced by makeSearchString(), QgsSearchTreeNode(), stripColRef(), stripText(), and valueAgainst().
|
private |
node type
Definition at line 235 of file qgssearchtreenode.h.
Referenced by append(), checkAgainst(), columnRefNodes(), init(), makeSearchString(), needsGeometry(), QgsSearchTreeNode(), setCurrentRowNumber(), and valueAgainst().