williamr@4: // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@4: // All rights reserved. williamr@4: // This component and the accompanying materials are made available williamr@4: // under the terms of "Eclipse Public License v1.0" williamr@4: // which accompanies this distribution, and is available williamr@4: // at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@4: // williamr@4: // Initial Contributors: williamr@4: // Nokia Corporation - initial contribution. williamr@4: // williamr@4: // Contributors: williamr@4: // williamr@4: // Description: williamr@4: // XPath evaluation context interface williamr@4: // williamr@4: williamr@4: williamr@4: williamr@4: /** williamr@4: @file williamr@4: @publishedAll williamr@4: @released williamr@4: */ williamr@4: #ifndef XMLENGXPATHEVALCTXT_H williamr@4: #define XMLENGXPATHEVALCTXT_H williamr@4: williamr@4: #include williamr@4: #include williamr@4: williamr@4: /** williamr@4: Provides the XPath evaluation context interface. An object of this type williamr@4: provides the argument values to an extension function to be evalutated williamr@4: and stores the result of evalutation. williamr@4: williamr@4: @see MXmlEngXPathExtensionFunction williamr@4: @see MXmlEngXPathExtensionFunction::Evaluate() williamr@4: williamr@4: Objects of this type are not registered with the XPath library and must williamr@4: be destroyed by their owner. williamr@4: williamr@4: Any memory allocated by this object must be freed when the object is williamr@4: destroyed. williamr@4: */ williamr@4: class MXmlEngXPathEvaluationContext williamr@4: { williamr@4: public: williamr@4: /** williamr@4: Gets the number of arguments provided. williamr@4: @return The number of arguments provided williamr@4: */ williamr@4: virtual TUint ArgCount() = 0; williamr@4: williamr@4: /** williamr@4: Gets an argument by index. Does not transfer ownership. Index starts at 0. williamr@4: @pre 0 <= aIndex < ArgCount(). Function panics if precondition not met. williamr@4: @return The n-th argument of the function williamr@4: */ williamr@4: virtual const RXmlEngXPathResult Argument(TUint aIndex) = 0; williamr@4: williamr@4: /** williamr@4: Gets the result written so far. The result is undefined before SetResult(), williamr@4: InitializeNodeSetResult() or AppendToResult() have been called. williamr@4: williamr@4: @pre SetResult() or InitializeNodeSetResult() and AppendToResult() have williamr@4: been previously called. williamr@4: @return The result evaluated by the function so far. williamr@4: */ williamr@4: virtual const RXmlEngXPathResult Result() = 0; williamr@4: williamr@4: /** williamr@4: Sets the type of result to node set and initializes a new node set. Any williamr@4: existing result node set is replaced. williamr@4: williamr@4: @see AppendToResult(const TXmlEngNode) williamr@4: @see AppendToResult(const RXmlEngNodeSet) williamr@4: @see AppendToResult(const TXmlEngNamespace, const TXmlEngElement) williamr@4: */ williamr@4: virtual void InitializeNodeSetResult() = 0; williamr@4: williamr@4: /** williamr@4: Appends a node to the node set result. InitializeNodeSetResult() should be williamr@4: called prior to the first call to an AppendToResult() method. williamr@4: williamr@4: This method will return and do nothing if a previous OOM condition in the williamr@4: underlying libxml2 library has not been cleared. See libxml2_modules.h. williamr@4: williamr@4: @pre OOM_FLAG==0, otherwise method returns and does nothing. williamr@4: @param aNode Node to be added williamr@4: */ williamr@4: virtual void AppendToResult(const TXmlEngNode aNode) = 0; williamr@4: williamr@4: /** williamr@4: Appends a namespace node to the node set result. InitializeNodeSetResult() williamr@4: should be called prior to the first call to an AppendToResult() method. williamr@4: williamr@4: A namespace node is the representation of an existing namespace declaration williamr@4: within an element node. This function cannot be used to add a new namespace williamr@4: declaration, rather it adds an existing namespace declaration attached to williamr@4: aNsParentNode. williamr@4: williamr@4: @see TXmlEngNamespace williamr@4: williamr@4: This method will return and do nothing if a previous OOM condition in the williamr@4: underlying libxml2 library has not been cleared. See libxml2_modules.h. williamr@4: williamr@4: @pre OOM_FLAG==0, otherwise method returns and does nothing. williamr@4: @param aAppendedNsNode A namspace node to add to the node set result. williamr@4: @param aNsParentNode An element node that holds the namespace declaration williamr@4: represented by aAppendedNsNode. williamr@4: */ williamr@4: virtual void AppendToResult(const TXmlEngNamespace aAppendedNsNode, williamr@4: const TXmlEngElement aNsParentNode) = 0; williamr@4: williamr@4: /** williamr@4: Appends a node set to the node set result. Nodes are merged into a williamr@4: resulting node set. InitializeNodeSetResult() should be called prior to williamr@4: the first call to an AppendToResult() method. williamr@4: williamr@4: This method will return and do nothing if a previous OOM condition in the williamr@4: underlying libxml2 library has not been cleared. See libxml2_modules.h. williamr@4: williamr@4: @pre OOM_FLAG==0, otherwise method returns and does nothing. williamr@4: @param aNodeSet The node set to be appended williamr@4: */ williamr@4: virtual void AppendToResult(const RXmlEngNodeSet aNodeSet) = 0; williamr@4: williamr@4: /** williamr@4: Sets the type of result to floating point number and stores the number as williamr@4: the result. williamr@4: @param aNumber The number to store as the result williamr@4: */ williamr@4: virtual void SetResult(TReal aNumber) = 0; williamr@4: williamr@4: /** williamr@4: Sets the type of result to boolean and stores the value as the result. williamr@4: @param aBoolean The value to store as the result williamr@4: */ williamr@4: virtual void SetResult(TBool aBoolean) = 0; williamr@4: williamr@4: /** williamr@4: Sets the type of result to string and stores the string as the result. williamr@4: @param aString The string to store as the result williamr@4: */ williamr@4: virtual void SetResultL(const TDesC8& aString) = 0; williamr@4: williamr@4: /** williamr@4: Gets the data specified in RXmlEngXPathExpression::SetExtendedContext() williamr@4: for the expression currently being evaluated. williamr@4: */ williamr@4: virtual void* ExtendedContext() = 0; williamr@4: }; williamr@4: williamr@4: #endif /* XMLENGXPATHEVALCTXT_H */ williamr@4: