author | William Roberts <williamr@symbian.org> |
Wed, 31 Mar 2010 12:33:34 +0100 | |
branch | Symbian3 |
changeset 4 | 837f303aceeb |
permissions | -rw-r--r-- |
williamr@4 | 1 |
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
williamr@4 | 2 |
// All rights reserved. |
williamr@4 | 3 |
// This component and the accompanying materials are made available |
williamr@4 | 4 |
// under the terms of "Eclipse Public License v1.0" |
williamr@4 | 5 |
// which accompanies this distribution, and is available |
williamr@4 | 6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
williamr@4 | 7 |
// |
williamr@4 | 8 |
// Initial Contributors: |
williamr@4 | 9 |
// Nokia Corporation - initial contribution. |
williamr@4 | 10 |
// |
williamr@4 | 11 |
// Contributors: |
williamr@4 | 12 |
// |
williamr@4 | 13 |
// Description: |
williamr@4 | 14 |
// XPath evaluation context interface |
williamr@4 | 15 |
// |
williamr@4 | 16 |
|
williamr@4 | 17 |
|
williamr@4 | 18 |
|
williamr@4 | 19 |
/** |
williamr@4 | 20 |
@file |
williamr@4 | 21 |
@publishedAll |
williamr@4 | 22 |
@released |
williamr@4 | 23 |
*/ |
williamr@4 | 24 |
#ifndef XMLENGXPATHEVALCTXT_H |
williamr@4 | 25 |
#define XMLENGXPATHEVALCTXT_H |
williamr@4 | 26 |
|
williamr@4 | 27 |
#include <xml/dom/xmlengxpathresult.h> |
williamr@4 | 28 |
#include <xml/dom/xmlengelement.h> |
williamr@4 | 29 |
|
williamr@4 | 30 |
/** |
williamr@4 | 31 |
Provides the XPath evaluation context interface. An object of this type |
williamr@4 | 32 |
provides the argument values to an extension function to be evalutated |
williamr@4 | 33 |
and stores the result of evalutation. |
williamr@4 | 34 |
|
williamr@4 | 35 |
@see MXmlEngXPathExtensionFunction |
williamr@4 | 36 |
@see MXmlEngXPathExtensionFunction::Evaluate() |
williamr@4 | 37 |
|
williamr@4 | 38 |
Objects of this type are not registered with the XPath library and must |
williamr@4 | 39 |
be destroyed by their owner. |
williamr@4 | 40 |
|
williamr@4 | 41 |
Any memory allocated by this object must be freed when the object is |
williamr@4 | 42 |
destroyed. |
williamr@4 | 43 |
*/ |
williamr@4 | 44 |
class MXmlEngXPathEvaluationContext |
williamr@4 | 45 |
{ |
williamr@4 | 46 |
public: |
williamr@4 | 47 |
/** |
williamr@4 | 48 |
Gets the number of arguments provided. |
williamr@4 | 49 |
@return The number of arguments provided |
williamr@4 | 50 |
*/ |
williamr@4 | 51 |
virtual TUint ArgCount() = 0; |
williamr@4 | 52 |
|
williamr@4 | 53 |
/** |
williamr@4 | 54 |
Gets an argument by index. Does not transfer ownership. Index starts at 0. |
williamr@4 | 55 |
@pre 0 <= aIndex < ArgCount(). Function panics if precondition not met. |
williamr@4 | 56 |
@return The n-th argument of the function |
williamr@4 | 57 |
*/ |
williamr@4 | 58 |
virtual const RXmlEngXPathResult Argument(TUint aIndex) = 0; |
williamr@4 | 59 |
|
williamr@4 | 60 |
/** |
williamr@4 | 61 |
Gets the result written so far. The result is undefined before SetResult(), |
williamr@4 | 62 |
InitializeNodeSetResult() or AppendToResult() have been called. |
williamr@4 | 63 |
|
williamr@4 | 64 |
@pre SetResult() or InitializeNodeSetResult() and AppendToResult() have |
williamr@4 | 65 |
been previously called. |
williamr@4 | 66 |
@return The result evaluated by the function so far. |
williamr@4 | 67 |
*/ |
williamr@4 | 68 |
virtual const RXmlEngXPathResult Result() = 0; |
williamr@4 | 69 |
|
williamr@4 | 70 |
/** |
williamr@4 | 71 |
Sets the type of result to node set and initializes a new node set. Any |
williamr@4 | 72 |
existing result node set is replaced. |
williamr@4 | 73 |
|
williamr@4 | 74 |
@see AppendToResult(const TXmlEngNode) |
williamr@4 | 75 |
@see AppendToResult(const RXmlEngNodeSet) |
williamr@4 | 76 |
@see AppendToResult(const TXmlEngNamespace, const TXmlEngElement) |
williamr@4 | 77 |
*/ |
williamr@4 | 78 |
virtual void InitializeNodeSetResult() = 0; |
williamr@4 | 79 |
|
williamr@4 | 80 |
/** |
williamr@4 | 81 |
Appends a node to the node set result. InitializeNodeSetResult() should be |
williamr@4 | 82 |
called prior to the first call to an AppendToResult() method. |
williamr@4 | 83 |
|
williamr@4 | 84 |
This method will return and do nothing if a previous OOM condition in the |
williamr@4 | 85 |
underlying libxml2 library has not been cleared. See libxml2_modules.h. |
williamr@4 | 86 |
|
williamr@4 | 87 |
@pre OOM_FLAG==0, otherwise method returns and does nothing. |
williamr@4 | 88 |
@param aNode Node to be added |
williamr@4 | 89 |
*/ |
williamr@4 | 90 |
virtual void AppendToResult(const TXmlEngNode aNode) = 0; |
williamr@4 | 91 |
|
williamr@4 | 92 |
/** |
williamr@4 | 93 |
Appends a namespace node to the node set result. InitializeNodeSetResult() |
williamr@4 | 94 |
should be called prior to the first call to an AppendToResult() method. |
williamr@4 | 95 |
|
williamr@4 | 96 |
A namespace node is the representation of an existing namespace declaration |
williamr@4 | 97 |
within an element node. This function cannot be used to add a new namespace |
williamr@4 | 98 |
declaration, rather it adds an existing namespace declaration attached to |
williamr@4 | 99 |
aNsParentNode. |
williamr@4 | 100 |
|
williamr@4 | 101 |
@see TXmlEngNamespace |
williamr@4 | 102 |
|
williamr@4 | 103 |
This method will return and do nothing if a previous OOM condition in the |
williamr@4 | 104 |
underlying libxml2 library has not been cleared. See libxml2_modules.h. |
williamr@4 | 105 |
|
williamr@4 | 106 |
@pre OOM_FLAG==0, otherwise method returns and does nothing. |
williamr@4 | 107 |
@param aAppendedNsNode A namspace node to add to the node set result. |
williamr@4 | 108 |
@param aNsParentNode An element node that holds the namespace declaration |
williamr@4 | 109 |
represented by aAppendedNsNode. |
williamr@4 | 110 |
*/ |
williamr@4 | 111 |
virtual void AppendToResult(const TXmlEngNamespace aAppendedNsNode, |
williamr@4 | 112 |
const TXmlEngElement aNsParentNode) = 0; |
williamr@4 | 113 |
|
williamr@4 | 114 |
/** |
williamr@4 | 115 |
Appends a node set to the node set result. Nodes are merged into a |
williamr@4 | 116 |
resulting node set. InitializeNodeSetResult() should be called prior to |
williamr@4 | 117 |
the first call to an AppendToResult() method. |
williamr@4 | 118 |
|
williamr@4 | 119 |
This method will return and do nothing if a previous OOM condition in the |
williamr@4 | 120 |
underlying libxml2 library has not been cleared. See libxml2_modules.h. |
williamr@4 | 121 |
|
williamr@4 | 122 |
@pre OOM_FLAG==0, otherwise method returns and does nothing. |
williamr@4 | 123 |
@param aNodeSet The node set to be appended |
williamr@4 | 124 |
*/ |
williamr@4 | 125 |
virtual void AppendToResult(const RXmlEngNodeSet aNodeSet) = 0; |
williamr@4 | 126 |
|
williamr@4 | 127 |
/** |
williamr@4 | 128 |
Sets the type of result to floating point number and stores the number as |
williamr@4 | 129 |
the result. |
williamr@4 | 130 |
@param aNumber The number to store as the result |
williamr@4 | 131 |
*/ |
williamr@4 | 132 |
virtual void SetResult(TReal aNumber) = 0; |
williamr@4 | 133 |
|
williamr@4 | 134 |
/** |
williamr@4 | 135 |
Sets the type of result to boolean and stores the value as the result. |
williamr@4 | 136 |
@param aBoolean The value to store as the result |
williamr@4 | 137 |
*/ |
williamr@4 | 138 |
virtual void SetResult(TBool aBoolean) = 0; |
williamr@4 | 139 |
|
williamr@4 | 140 |
/** |
williamr@4 | 141 |
Sets the type of result to string and stores the string as the result. |
williamr@4 | 142 |
@param aString The string to store as the result |
williamr@4 | 143 |
*/ |
williamr@4 | 144 |
virtual void SetResultL(const TDesC8& aString) = 0; |
williamr@4 | 145 |
|
williamr@4 | 146 |
/** |
williamr@4 | 147 |
Gets the data specified in RXmlEngXPathExpression::SetExtendedContext() |
williamr@4 | 148 |
for the expression currently being evaluated. |
williamr@4 | 149 |
*/ |
williamr@4 | 150 |
virtual void* ExtendedContext() = 0; |
williamr@4 | 151 |
}; |
williamr@4 | 152 |
|
williamr@4 | 153 |
#endif /* XMLENGXPATHEVALCTXT_H */ |
williamr@4 | 154 |