1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/xml/dom/xmlengxpathevaluationcontext.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -0,0 +1,154 @@
1.4 +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// XPath evaluation context interface
1.18 +//
1.19 +
1.20 +
1.21 +
1.22 +/**
1.23 + @file
1.24 + @publishedAll
1.25 + @released
1.26 +*/
1.27 +#ifndef XMLENGXPATHEVALCTXT_H
1.28 +#define XMLENGXPATHEVALCTXT_H
1.29 +
1.30 +#include <xml/dom/xmlengxpathresult.h>
1.31 +#include <xml/dom/xmlengelement.h>
1.32 +
1.33 +/**
1.34 +Provides the XPath evaluation context interface. An object of this type
1.35 +provides the argument values to an extension function to be evalutated
1.36 +and stores the result of evalutation.
1.37 +
1.38 +@see MXmlEngXPathExtensionFunction
1.39 +@see MXmlEngXPathExtensionFunction::Evaluate()
1.40 +
1.41 +Objects of this type are not registered with the XPath library and must
1.42 +be destroyed by their owner.
1.43 +
1.44 +Any memory allocated by this object must be freed when the object is
1.45 +destroyed.
1.46 +*/
1.47 +class MXmlEngXPathEvaluationContext
1.48 + {
1.49 +public:
1.50 + /**
1.51 + Gets the number of arguments provided.
1.52 + @return The number of arguments provided
1.53 + */
1.54 + virtual TUint ArgCount() = 0;
1.55 +
1.56 + /**
1.57 + Gets an argument by index. Does not transfer ownership. Index starts at 0.
1.58 + @pre 0 <= aIndex < ArgCount(). Function panics if precondition not met.
1.59 + @return The n-th argument of the function
1.60 + */
1.61 + virtual const RXmlEngXPathResult Argument(TUint aIndex) = 0;
1.62 +
1.63 + /**
1.64 + Gets the result written so far. The result is undefined before SetResult(),
1.65 + InitializeNodeSetResult() or AppendToResult() have been called.
1.66 +
1.67 + @pre SetResult() or InitializeNodeSetResult() and AppendToResult() have
1.68 + been previously called.
1.69 + @return The result evaluated by the function so far.
1.70 + */
1.71 + virtual const RXmlEngXPathResult Result() = 0;
1.72 +
1.73 + /**
1.74 + Sets the type of result to node set and initializes a new node set. Any
1.75 + existing result node set is replaced.
1.76 +
1.77 + @see AppendToResult(const TXmlEngNode)
1.78 + @see AppendToResult(const RXmlEngNodeSet)
1.79 + @see AppendToResult(const TXmlEngNamespace, const TXmlEngElement)
1.80 + */
1.81 + virtual void InitializeNodeSetResult() = 0;
1.82 +
1.83 + /**
1.84 + Appends a node to the node set result. InitializeNodeSetResult() should be
1.85 + called prior to the first call to an AppendToResult() method.
1.86 +
1.87 + This method will return and do nothing if a previous OOM condition in the
1.88 + underlying libxml2 library has not been cleared. See libxml2_modules.h.
1.89 +
1.90 + @pre OOM_FLAG==0, otherwise method returns and does nothing.
1.91 + @param aNode Node to be added
1.92 + */
1.93 + virtual void AppendToResult(const TXmlEngNode aNode) = 0;
1.94 +
1.95 + /**
1.96 + Appends a namespace node to the node set result. InitializeNodeSetResult()
1.97 + should be called prior to the first call to an AppendToResult() method.
1.98 +
1.99 + A namespace node is the representation of an existing namespace declaration
1.100 + within an element node. This function cannot be used to add a new namespace
1.101 + declaration, rather it adds an existing namespace declaration attached to
1.102 + aNsParentNode.
1.103 +
1.104 + @see TXmlEngNamespace
1.105 +
1.106 + This method will return and do nothing if a previous OOM condition in the
1.107 + underlying libxml2 library has not been cleared. See libxml2_modules.h.
1.108 +
1.109 + @pre OOM_FLAG==0, otherwise method returns and does nothing.
1.110 + @param aAppendedNsNode A namspace node to add to the node set result.
1.111 + @param aNsParentNode An element node that holds the namespace declaration
1.112 + represented by aAppendedNsNode.
1.113 + */
1.114 + virtual void AppendToResult(const TXmlEngNamespace aAppendedNsNode,
1.115 + const TXmlEngElement aNsParentNode) = 0;
1.116 +
1.117 + /**
1.118 + Appends a node set to the node set result. Nodes are merged into a
1.119 + resulting node set. InitializeNodeSetResult() should be called prior to
1.120 + the first call to an AppendToResult() method.
1.121 +
1.122 + This method will return and do nothing if a previous OOM condition in the
1.123 + underlying libxml2 library has not been cleared. See libxml2_modules.h.
1.124 +
1.125 + @pre OOM_FLAG==0, otherwise method returns and does nothing.
1.126 + @param aNodeSet The node set to be appended
1.127 + */
1.128 + virtual void AppendToResult(const RXmlEngNodeSet aNodeSet) = 0;
1.129 +
1.130 + /**
1.131 + Sets the type of result to floating point number and stores the number as
1.132 + the result.
1.133 + @param aNumber The number to store as the result
1.134 + */
1.135 + virtual void SetResult(TReal aNumber) = 0;
1.136 +
1.137 + /**
1.138 + Sets the type of result to boolean and stores the value as the result.
1.139 + @param aBoolean The value to store as the result
1.140 + */
1.141 + virtual void SetResult(TBool aBoolean) = 0;
1.142 +
1.143 + /**
1.144 + Sets the type of result to string and stores the string as the result.
1.145 + @param aString The string to store as the result
1.146 + */
1.147 + virtual void SetResultL(const TDesC8& aString) = 0;
1.148 +
1.149 + /**
1.150 + Gets the data specified in RXmlEngXPathExpression::SetExtendedContext()
1.151 + for the expression currently being evaluated.
1.152 + */
1.153 + virtual void* ExtendedContext() = 0;
1.154 + };
1.155 +
1.156 +#endif /* XMLENGXPATHEVALCTXT_H */
1.157 +