00001
00002
00003
00004 #ifndef XPATH_EXPRESSION_H
00005 #define XPATH_EXPRESSION_H
00006
00007 #include <qvaluelist.h>
00008 #include <dom/dom_node.h>
00009
00010 #include <xpath/xpath_value.h>
00011
00012 namespace XPath {
00013
00014 class QueryState;
00015
00019 class LocationPath : public XPathNode
00020 {
00021 public:
00022 enum LocationPathType {
00023 Relative, Absolute, AbbrevRelative, AbbrevAbsolute
00024 };
00025
00026 private:
00027 LocationPathType ptype;
00028 };
00029
00033 class VariableRef : public XPathNode
00034 {
00035 public:
00036 };
00037
00041 class BinaryOp : public XPathNode
00042 {
00043 public:
00044 enum BinaryOpType {
00045 NullBinaryOp,
00046 Or, And, Equality,
00047 LessThan, GreaterThan, LessThanEqual, GreaterThanEqual,
00048 Plus, Minus, Mul, Div, Mod,
00049 Union
00050 };
00051
00052 BinaryOp();
00053 BinaryOp( const BinaryOp &node );
00054 BinaryOp( ushort bop );
00055 virtual ~BinaryOp();
00056
00057 virtual Value *evaluate( QueryState *state );
00058
00059 virtual QString name() const;
00060 virtual QString qstring() const;
00061
00062 private:
00063 ushort op;
00064 XPathNode lexpr;
00065 XPathNode rexpr;
00066 };
00067
00071 class UnaryOp : public XPathNode
00072 {
00073 public:
00074 enum UnaryOpType {
00075 UnaryMinus
00076 };
00077
00078 private:
00079 UnaryOpType optype;
00080 XPathNode expr;
00081 };
00082
00086 class NodeTest : public XPathNode
00087 {
00088 public:
00089 enum NodeTestId {
00090 AnyName, NCName, QName,
00091 CommentNode, TextNode, ProcessInstructNode, NodeNode
00092 };
00093
00094 private:
00095 ushort id;
00096 };
00097
00101 class FunctionCall : public XPathNode
00102 {
00103 public:
00104 enum Functions {
00105 FunctionNull,
00106
00107
00108 FunctionLast, FunctionPosition, FunctionCount,
00109 FunctionId, FunctionLocalName, FunctionNamespaceURI, FunctionName,
00110
00111
00112 FunctionString, FunctionConcat, FunctionStartsWith, FunctionContains,
00113 FunctionSubStringBefore, FunctionSubStringAfter, FunctionSubString,
00114 FunctionStringLength, FunctionNormalizeSpace, FunctionTranslate,
00115
00116
00117 FunctionBoolean, FunctionNot, FunctionTrue, FunctionFalse, FunctionLang,
00118
00119
00120 FunctionNumber, FunctionSum, FunctionFloor, FunctionCeiling, FunctionRound,
00121
00122
00123 FunctionLastReserved = 256
00124 };
00125
00126 FunctionCall();
00127 FunctionCall( const FunctionCall &node );
00128 FunctionCall( ushort fid );
00129 virtual ~FunctionCall();
00130
00131 virtual Value *evaluate( QueryState *state );
00132
00133 virtual QString name() const;
00134 virtual QString qstring() const;
00135
00136 private:
00137 ushort id;
00138 QValueList<XPathNode> args;
00139 };
00140
00144 class Axis : public XPathNode
00145 {
00146 public:
00147 enum Id {
00148 NullAxis,
00149 Child, Descendent, Parent, Ancestor,
00150 FollowingSibling, PrecedingSibling,
00151 Following, Preceding,
00152 Attribute, Namespace,
00153 Self, DescendentOrSelf, AncestorOrSelf
00154 };
00155
00156 Axis();
00157 Axis( const Axis &node );
00158 Axis( ushort fid );
00159 virtual ~Axis();
00160
00161 virtual Value *evaluate( QueryState *state );
00162
00163 virtual QString name() const;
00164 virtual QString qstring() const;
00165
00166 private:
00167 ushort id;
00168 };
00169
00170 };
00171
00172 #endif // XPATH_EXPRESSION_H
00173
00174
00175
00176