s/XPathValuePtr/XPathValue/

This commit is contained in:
jez 2009-02-18 08:37:16 +00:00
parent 0b2bb658b9
commit b22708f126
6 changed files with 19 additions and 17 deletions

View file

@ -39,10 +39,10 @@ public:
nodes.push_back(n); nodes.push_back(n);
else else
{ {
Arabica::XPath::XPathValuePtr<std::string> value = select_->evaluate(node, context.xpathContext()); Arabica::XPath::XPathValue<std::string> value = select_->evaluate(node, context.xpathContext());
if(value->type() != Arabica::XPath::NODE_SET) if(value.type() != Arabica::XPath::NODE_SET)
throw std::runtime_error("apply-templates select expression is not a node-set"); throw std::runtime_error("apply-templates select expression is not a node-set");
nodes = value->asNodeSet(); nodes = value.asNodeSet();
} }
sort(node, nodes, context); sort(node, nodes, context);
context.stylesheet().applyTemplates(nodes, context, mode_); context.stylesheet().applyTemplates(nodes, context, mode_);

View file

@ -174,6 +174,8 @@ private:
if(name == "document") if(name == "document")
return new DocumentFunction(parser_.currentBase(), argExprs); return new DocumentFunction(parser_.currentBase(), argExprs);
// key // key
if(name == "key")
return new KeyFunction(argExprs);
// format-number // format-number
if((name == "current") && (current_allowed_)) if((name == "current") && (current_allowed_))
return new CurrentFunction(argExprs); return new CurrentFunction(argExprs);

View file

@ -21,7 +21,7 @@ class CompiledStylesheet : public Stylesheet
typedef Arabica::XPath::BoolValue<std::string, Arabica::default_string_adaptor<std::string> > BoolValue; typedef Arabica::XPath::BoolValue<std::string, Arabica::default_string_adaptor<std::string> > BoolValue;
typedef Arabica::XPath::NumericValue<std::string, Arabica::default_string_adaptor<std::string> > NumericValue; typedef Arabica::XPath::NumericValue<std::string, Arabica::default_string_adaptor<std::string> > NumericValue;
typedef Arabica::XPath::StringValue<std::string, Arabica::default_string_adaptor<std::string> > StringValue; typedef Arabica::XPath::StringValue<std::string, Arabica::default_string_adaptor<std::string> > StringValue;
typedef Arabica::XPath::XPathValuePtr<std::string> ValuePtr; typedef Arabica::XPath::XPathValue<std::string> Value;
public: public:
CompiledStylesheet() : CompiledStylesheet() :
@ -43,19 +43,19 @@ public:
virtual void set_parameter(const std::string& name, bool value) virtual void set_parameter(const std::string& name, bool value)
{ {
set_parameter(name, ValuePtr(new BoolValue(value))); set_parameter(name, Value(new BoolValue(value)));
} // set_parameter } // set_parameter
virtual void set_parameter(const std::string& name, double value) virtual void set_parameter(const std::string& name, double value)
{ {
set_parameter(name, ValuePtr(new NumericValue(value))); set_parameter(name, Value(new NumericValue(value)));
} // set_parameter } // set_parameter
virtual void set_parameter(const std::string& name, const char* value) virtual void set_parameter(const std::string& name, const char* value)
{ {
set_parameter(name, ValuePtr(new StringValue(value))); set_parameter(name, Value(new StringValue(value)));
} // set_parameter } // set_parameter
virtual void set_parameter(const std::string& name, const std::string& value) virtual void set_parameter(const std::string& name, const std::string& value)
{ {
set_parameter(name, ValuePtr(new StringValue(value))); set_parameter(name, Value(new StringValue(value)));
} // set_parameter } // set_parameter
virtual void set_output(Sink& sink) virtual void set_output(Sink& sink)
@ -265,12 +265,12 @@ private:
} // switch } // switch
} // defaultAction } // defaultAction
void set_parameter(const std::string& name, ValuePtr value) void set_parameter(const std::string& name, Value value)
{ {
params_.push_back(new TopLevelParam("", name, value)); params_.push_back(new TopLevelParam("", name, value));
} // set_parameter } // set_parameter
void set_parameter(const std::string& namespace_uri, const std::string& name, ValuePtr 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(namespace_uri, name, value));
} // set_parameter } // set_parameter

View file

@ -101,14 +101,14 @@ public:
virtual void execute(const DOM::Node<std::string>& node, ExecutionContext& context) const virtual void execute(const DOM::Node<std::string>& node, ExecutionContext& context) const
{ {
Arabica::XPath::XPathValuePtr<std::string> value = select_->evaluate(node, context.xpathContext()); Arabica::XPath::XPathValue<std::string> value = select_->evaluate(node, context.xpathContext());
if(value->type() != Arabica::XPath::NODE_SET) if(value.type() != Arabica::XPath::NODE_SET)
{ {
context.sink().characters(value->asString()); context.sink().characters(value.asString());
return; return;
} }
Arabica::XPath::NodeSet<std::string> nodes = value->asNodeSet(); Arabica::XPath::NodeSet<std::string> nodes = value.asNodeSet();
for(Arabica::XPath::NodeSet<std::string>::const_iterator n = nodes.begin(), e = nodes.end(); n != e; ++n) for(Arabica::XPath::NodeSet<std::string>::const_iterator n = nodes.begin(), e = nodes.end(); n != e; ++n)
copy(*n, context); copy(*n, context);
} // execute } // execute

View file

@ -154,7 +154,7 @@ private:
mutable DOMSink sink_; mutable DOMSink sink_;
const DOM::Node<std::string> node_; const DOM::Node<std::string> node_;
mutable ExecutionContext context_; mutable ExecutionContext context_;
mutable Arabica::XPath::XPathValuePtr<std::string> value_; mutable Arabica::XPath::XPathValue<std::string> value_;
VariableClosure(); VariableClosure();
VariableClosure(const VariableClosure&); VariableClosure(const VariableClosure&);

View file

@ -11,7 +11,7 @@ class TopLevelParam : public Variable_declaration
public: public:
TopLevelParam(const std::string& namespace_uri, TopLevelParam(const std::string& namespace_uri,
const std::string& name, const std::string& name,
Arabica::XPath::XPathValuePtr<std::string> value) : Arabica::XPath::XPathValue<std::string> value) :
namespace_uri_(namespace_uri), namespace_uri_(namespace_uri),
name_(name), name_(name),
value_(value) value_(value)
@ -39,7 +39,7 @@ private:
static DOM::Node<std::string> null_node; static DOM::Node<std::string> null_node;
std::string namespace_uri_; std::string namespace_uri_;
std::string name_; std::string name_;
Arabica::XPath::XPathValuePtr<std::string> value_; Arabica::XPath::XPathValue<std::string> value_;
}; // class TopLevelParam }; // class TopLevelParam
DOM::Node<std::string> TopLevelParam::null_node; DOM::Node<std::string> TopLevelParam::null_node;