#ifndef ARABICA_XPATH_VARIABLE_RESOLVER_HPP #define ARABICA_XPATH_VARIABLE_RESOLVER_HPP #include #include "xpath_object.hpp" namespace Arabica { namespace XPath { class UnboundVariableException : public std::runtime_error { public: UnboundVariableException(const std::string& thing) : std::runtime_error("The variable '" + thing + "' is undefined.") { } }; // class UnboundVariableException template class VariableResolver { public: virtual ~VariableResolver() { } virtual XPathValuePtr resolveVariable(const string_type& name) const = 0; }; // class VariableResolver template class VariableResolverPtr : public boost::shared_ptr > { public: explicit VariableResolverPtr(VariableResolver* vr) : boost::shared_ptr >(vr) { } }; // class VariableResolverPtr template class NullVariableResolver : public VariableResolver { public: virtual XPathValuePtr resolveVariable(const string_type& name) const { throw UnboundVariableException(name); } // resolveVariable }; // NullVariableResolver } // namespace XPath } // namespace Arabica #endif