mirror of
https://github.com/jezhiggins/arabica
synced 2025-01-30 08:38:15 +01:00
Skinned up skeleton implementation of key() function. Doesn't do anything yet though :)
This commit is contained in:
parent
4d9c2a485a
commit
0b2bb658b9
1 changed files with 28 additions and 3 deletions
|
@ -28,9 +28,9 @@ public:
|
|||
{
|
||||
Arabica::XPath::NodeSet<std::string> nodes;
|
||||
|
||||
Arabica::XPath::XPathValuePtr<std::string> a1 = arg(0, context, executionContext);
|
||||
if(a1->type() != Arabica::XPath::NODE_SET)
|
||||
load_document(a1->asString(), nodes);
|
||||
Arabica::XPath::XPathValue<std::string> a0 = arg(0, context, executionContext);
|
||||
if(a0.type() != Arabica::XPath::NODE_SET)
|
||||
load_document(a0.asString(), nodes);
|
||||
else
|
||||
throw Arabica::XPath::UnsupportedException("node-set arg version of document()");
|
||||
return new Arabica::XPath::NodeSetValue<std::string>(nodes);
|
||||
|
@ -60,6 +60,31 @@ private:
|
|||
}; // DocumentFunction
|
||||
|
||||
// node-set key(string, object)
|
||||
class KeyFunction : public Arabica::XPath::XPathFunction<std::string>
|
||||
{
|
||||
typedef Arabica::XPath::XPathFunction<std::string> baseT;
|
||||
|
||||
public:
|
||||
KeyFunction(/* the keys, */
|
||||
const std::vector<Arabica::XPath::XPathExpression<std::string> >& args) :
|
||||
Arabica::XPath::XPathFunction<std::string>(2, 2, args) { }
|
||||
|
||||
virtual Arabica::XPath::ValueType type() const { return Arabica::XPath::NODE_SET; }
|
||||
|
||||
virtual Arabica::XPath::XPathValue_impl<std::string>* evaluate(const DOM::Node<std::string>& context,
|
||||
const Arabica::XPath::ExecutionContext<std::string>& executionContext) const
|
||||
{
|
||||
Arabica::XPath::XPathValue<std::string> a1 = baseT::arg(1, context, executionContext);
|
||||
if(a1.type() == Arabica::XPath::NODE_SET)
|
||||
throw Arabica::XPath::UnsupportedException("node-set arg version of document()");
|
||||
|
||||
std::string keyname = argAsString(0, context, executionContext);
|
||||
std::string id = a1.asString();
|
||||
throw Arabica::XPath::UnsupportedException("key(" + keyname + ", " + id + ")");
|
||||
} // evaluate
|
||||
|
||||
}; // class KeyFunction
|
||||
|
||||
// string format-number(number, string, string?)
|
||||
|
||||
// node-set current()
|
||||
|
|
Loading…
Add table
Reference in a new issue