
//  -*- c++ -*-

#ifndef XPATH_NODE_H
#define XPATH_NODE_H

#include <qvaluelist.h>
#include <dom/dom_node.h>

namespace XPath {

class QueryState;
class Value;

/**
 * The baseclass of nodes in an XPath AST.
 */
class XPathNode
{
public:
    enum NodeType {
	NullNode, AxisNode, BinaryOpNode, FunctionCallNode, LiteralNode,
	LocationPathNode, NodeTestNode, UnaryOpNode, VariableRefNode
    };

    XPathNode();
    XPathNode( const XPathNode &node );
    XPathNode( XPathNode::NodeType nodeType );
    virtual ~XPathNode();

    /** Returns the type of this node. */
    XPathNode::NodeType nodeType() const { return type; }

    /**
     * Evaluates the current node, in the context of the specified QueryState.
     * Note that if the evaluation is unsuccessful the value returned will be
     * of the type Exception.
     */
    virtual Value *evaluate( QueryState *state );

    /** Returns a dump of the node. */
    virtual QString qstring() const;

private:
    NodeType type;
};

}; // namespace XPath

#endif // XPATH_NODE_H

// Local Variables:
// c-basic-offset: 4
// End:
