//  -*- c++ -*-

#ifndef XPATH_QUERY_H
#define XPATH_QUERY_H

#include <xpath/xpath_value.h>
#include <xpath/xpath_context.h>

namespace DOM {
    class Node;
};

namespace XPath {

/**
 * A class for performing XPath queries.
 *
 * @version $Id: xmldemo.h,v 1.3 2002/02/18 00:45:47 rich Exp $
 * @author Richard Moore, rich@kde.org 
 */
class Query
{
public:
    Value *select( const QString &expr, const DOM::Node &context );

    /** Executes the query expr in the specified context, and returns the result. */
    virtual Value *select( const QString &expr, const Context &context );
};

/**
 * Represents the state of a running Query.
 */
class QueryState
{
public:
    QueryState( const Query &query, const Context &context ) : q(query), ctx(context) {}
    ~QueryState() {}

    Query query() const { return q; }
    Context context() const { return ctx; }
    Value result() const { return res; }

private:
    Query q;
    Context ctx;
    Value res;
};

}; // namespace XPath

#endif // XPATH_QUERY_H

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

