2005-08-04 22:42:30 +02:00
|
|
|
#ifndef ARABICA_XPATH_VARIABLE_HPP
|
|
|
|
#define ARABICA_XPATH_VARIABLE_HPP
|
|
|
|
|
|
|
|
#include "xpath_value.hpp"
|
|
|
|
#include "xpath_execution_context.hpp"
|
|
|
|
#include "xpath_variable_resolver.hpp"
|
|
|
|
|
|
|
|
namespace Arabica
|
|
|
|
{
|
|
|
|
namespace XPath
|
|
|
|
{
|
|
|
|
|
2005-08-17 12:13:05 +02:00
|
|
|
template<class string_type, class string_adaptor>
|
2007-10-23 23:37:24 +02:00
|
|
|
class Variable : public XPathExpression_impl<string_type, string_adaptor>
|
2005-08-04 22:42:30 +02:00
|
|
|
{
|
|
|
|
public:
|
2007-07-19 19:01:31 +02:00
|
|
|
Variable(const string_type& namespace_uri,
|
|
|
|
const string_type& name) :
|
|
|
|
namespace_uri_(namespace_uri),
|
|
|
|
name_(name)
|
|
|
|
{
|
|
|
|
} // Variable
|
2005-08-04 22:42:30 +02:00
|
|
|
|
2007-12-19 00:03:16 +01:00
|
|
|
virtual ValueType type() const { return ANY; }
|
|
|
|
|
2007-10-22 19:42:50 +02:00
|
|
|
virtual XPathValue<string_type, string_adaptor> evaluate(const DOM::Node<string_type, string_adaptor>& context,
|
2005-08-17 12:13:05 +02:00
|
|
|
const ExecutionContext<string_type, string_adaptor>& executionContext) const
|
2005-08-04 22:42:30 +02:00
|
|
|
{
|
2007-07-19 19:01:31 +02:00
|
|
|
return executionContext.variableResolver().resolveVariable(namespace_uri_, name_);
|
2005-08-04 22:42:30 +02:00
|
|
|
} // evaluate
|
|
|
|
|
|
|
|
private:
|
2007-07-19 19:01:31 +02:00
|
|
|
const string_type namespace_uri_;
|
2005-08-16 23:04:44 +02:00
|
|
|
const string_type name_;
|
2005-08-04 22:42:30 +02:00
|
|
|
}; // class Variable
|
|
|
|
|
|
|
|
} // namespace XPath
|
|
|
|
} // namespace Arabica
|
|
|
|
|
|
|
|
#endif
|