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