toplevel param

This commit is contained in:
Jez Higgins 2012-11-06 08:20:10 +00:00
parent 25e0671eb2
commit bbafbf4b63
2 changed files with 16 additions and 14 deletions

View file

@ -273,12 +273,12 @@ private:
void set_parameter(const std::string& name, Value value) void set_parameter(const std::string& name, Value value)
{ {
params_.push_back(new TopLevelParam("", name, value)); params_.push_back(new TopLevelParam<std::string, Arabica::default_string_adaptor<std::string> >("", name, value));
} // set_parameter } // set_parameter
void set_parameter(const std::string& namespace_uri, const std::string& name, Value value) void set_parameter(const std::string& namespace_uri, const std::string& name, Value value)
{ {
params_.push_back(new TopLevelParam(namespace_uri, name, value)); params_.push_back(new TopLevelParam<std::string, Arabica::default_string_adaptor<std::string> >(namespace_uri, name, value));
} // set_parameter } // set_parameter
private: private:
@ -316,7 +316,7 @@ private:
typedef std::map<std::string, Template<std::string, Arabica::default_string_adaptor<std::string> >*> NamedTemplates; typedef std::map<std::string, Template<std::string, Arabica::default_string_adaptor<std::string> >*> NamedTemplates;
typedef std::vector<Item*> VariableDeclList; typedef std::vector<Item*> VariableDeclList;
typedef std::vector<TopLevelParam*> ParamList; typedef std::vector<TopLevelParam<std::string, Arabica::default_string_adaptor<std::string> >*> ParamList;
TemplateList all_templates_; TemplateList all_templates_;
NamedTemplates named_templates_; NamedTemplates named_templates_;

View file

@ -6,12 +6,13 @@ namespace Arabica
namespace XSLT namespace XSLT
{ {
template<class string_type, class string_adaptor>
class TopLevelParam : public Variable_declaration class TopLevelParam : public Variable_declaration
{ {
public: public:
TopLevelParam(const std::string& namespace_uri, TopLevelParam(const string_type& namespace_uri,
const std::string& name, const string_type& name,
Arabica::XPath::XPathValue<std::string> value) : Arabica::XPath::XPathValue<string_type, string_adaptor> value) :
namespace_uri_(namespace_uri), namespace_uri_(namespace_uri),
name_(name), name_(name),
value_(value) value_(value)
@ -25,9 +26,9 @@ public:
context.topLevelParam(null_node, *this); context.topLevelParam(null_node, *this);
} // declare } // declare
virtual const std::string& namespace_uri() const { return namespace_uri_; } virtual const string_type& namespace_uri() const { return namespace_uri_; }
virtual const std::string& name() const { return name_; } virtual const string_type& name() const { return name_; }
virtual Arabica::XPath::XPathValue<std::string> value(const DOM::Node<std::string>& /* node */, virtual Arabica::XPath::XPathValue<string_type, string_adaptor> value(const DOM::Node<string_type, string_adaptor>& /* node */,
ExecutionContext& /* context */, ExecutionContext& /* context */,
DOMSink& /* sink */) const DOMSink& /* sink */) const
{ {
@ -36,13 +37,14 @@ public:
virtual const Precedence& precedence() const { return Precedence::InitialPrecedence(); } virtual const Precedence& precedence() const { return Precedence::InitialPrecedence(); }
private: private:
static DOM::Node<std::string> null_node; static DOM::Node<string_type, string_adaptor> null_node;
std::string namespace_uri_; string_type namespace_uri_;
std::string name_; string_type name_;
Arabica::XPath::XPathValue<std::string> value_; Arabica::XPath::XPathValue<string_type, string_adaptor> value_;
}; // class TopLevelParam }; // class TopLevelParam
DOM::Node<std::string> TopLevelParam::null_node; template<class string_type, class string_adaptor>
DOM::Node<string_type, string_adaptor> TopLevelParam<string_type, string_adaptor>::null_node;
} // namespace XSLT } // namespace XSLT
} // namespace Arabica } // namespace Arabica