1
2
3
4
5
6 #ifndef SNGXML_XPATH_XPATH_FUNCTION
7 #define SNGXML_XPATH_XPATH_FUNCTION
8 #include <sngxml/xpath/XPathObject.hpp>
9
10 namespace sngxml { namespace xpath {
11
12 class XPathContext;
13
14 std::u32string StringValue(sngxml::dom::Node* node);
15
16 class XPathFunction
17 {
18 public:
19 XPathFunction(const std::u32string& name_, int minArity_, int maxArity_);
20 virtual ~XPathFunction();
21 virtual std::unique_ptr<XPathObject> Evaluate(XPathContext& context, std::std::vector<XPathObject*>&arguments) = 0;
22 const std::u32string& Name() const { return name; }
23 int MinArity() const { return minArity; }
24 int MaxArity() const { return maxArity; }
25 private:
26 std::u32string name;
27 int minArity;
28 int maxArity;
29 };
30
31 XPathFunction* GetXPathLibraryFunction(const std::u32string& functionName);
32
33 void InitFunction();
34 void DoneFunction();
35
36 } }
37
38 #endif // SNGXML_XPATH_XPATH_FUNCTION