arabica/XPath/impl/xpath_variable.hpp

33 lines
744 B
C++
Raw Normal View History

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-16 23:04:44 +02:00
template<class string_type>
class Variable : public XPathExpression<string_type>
2005-08-04 22:42:30 +02:00
{
public:
2005-08-16 23:04:44 +02:00
Variable(const string_type& name) : name_(name) { }
2005-08-04 22:42:30 +02:00
2005-08-16 23:04:44 +02:00
virtual XPathValuePtr<string_type> evaluate(const DOM::Node<string_type>& context,
const ExecutionContext& executionContext) const
2005-08-04 22:42:30 +02:00
{
return executionContext.variableResolver().resolveVariable(name_);
} // evaluate
private:
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