|
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Extension function interface |
|
15 // |
|
16 |
|
17 |
|
18 |
|
19 /** |
|
20 @file |
|
21 @publishedAll |
|
22 @released |
|
23 */ |
|
24 #ifndef XMLENGXPATHFUNCTION_H |
|
25 #define XMLENGXPATHFUNCTION_H |
|
26 |
|
27 #include <xml/dom/xmlengxpathresult.h> |
|
28 |
|
29 class MXmlEngXPathEvaluationContext; |
|
30 |
|
31 /** |
|
32 Provides an interface for an object to participate in the evaluation of XPath |
|
33 expression via a XPath function call. |
|
34 |
|
35 Objects that implement the MXmlEngXPathExtensionFunction interface can be |
|
36 registered in a XmlEngXPathConfiguration object for global action (across |
|
37 all evaluations globally). |
|
38 |
|
39 @see XmlEngXPathConfiguration::AddExtensionFunctionL() |
|
40 |
|
41 When the extension function is no longer required, it must be deregistered |
|
42 by calling XmlEngXPathConfiguration::RemoveExtensionFunction(). |
|
43 */ |
|
44 class MXmlEngXPathExtensionFunction |
|
45 { |
|
46 public: |
|
47 /** Evaluation status */ |
|
48 enum TXmlEngEvaluationStatus |
|
49 { |
|
50 /** Evaluation was accomplished successfully */ |
|
51 ESucceeded, |
|
52 /** An exceptional condition occurs */ |
|
53 EError, |
|
54 /** Type of argument does not match function specification */ |
|
55 EInvalidArgumentType, |
|
56 /** Number of arguments do not match function specification */ |
|
57 EInvalidArgumentNumber |
|
58 }; |
|
59 |
|
60 public: |
|
61 /** |
|
62 Gets the minimum number of arguments the function can take. |
|
63 @return Minimum number of arguments |
|
64 */ |
|
65 virtual TInt MinArity() {return 0;} |
|
66 |
|
67 /** |
|
68 Gets the maximum number of arguments the function can take. |
|
69 |
|
70 @return The maximum number of arguments or -1 if unbounded |
|
71 */ |
|
72 virtual TInt MaxArity() {return MinArity();} |
|
73 |
|
74 /** |
|
75 Called to evaluate the extension function. |
|
76 |
|
77 This function is called only if simple arity constraints (min/max number of |
|
78 arguments) are satisfied. The implementation of this function may need to |
|
79 check further that the types of arguments and their positions in the |
|
80 function call match function-specific requirements. |
|
81 |
|
82 @param aEvalCtxt Evaluation context, which contains data about arguments |
|
83 and provides a number of methods for setting the result of the extension |
|
84 function. |
|
85 |
|
86 @return ESucceeded if evaluation success, otherwise one of the errors |
|
87 defined in TXmlEngEvaluationStatus. |
|
88 */ |
|
89 virtual TXmlEngEvaluationStatus Evaluate(MXmlEngXPathEvaluationContext* aEvalCtxt) = 0; |
|
90 }; |
|
91 |
|
92 #endif /* XMLENGXPATHFUNCTION_H */ |
|
93 |