1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/xml/dom/xmlengxpathresult.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -0,0 +1,136 @@
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 +// Result of XPath expression
1.18 +//
1.19 +
1.20 +
1.21 +
1.22 +/**
1.23 + @file
1.24 + @publishedAll
1.25 + @released
1.26 +*/
1.27 +#ifndef XMLENGXPATHRESULT_H
1.28 +#define XMLENGXPATHRESULT_H
1.29 +
1.30 +#include <xml/dom/xmlengnodeset.h>
1.31 +
1.32 +/**
1.33 +Represents the result of a XPath expression.
1.34 +
1.35 +The result may be one of the standard types: string, boolean, number (float),
1.36 +node set or be undefined in the case of error.
1.37 +
1.38 +The returned result should be freed after use.
1.39 +*/
1.40 +class RXmlEngXPathResult
1.41 +{
1.42 + friend class RXmlEngXPathExpression;
1.43 + friend class TXmlEngXPathEvaluationContextImpl;
1.44 +
1.45 +public:
1.46 + /**
1.47 + Result types of a XPath expression.
1.48 + See http://w3.org/TR/xpath#section-Introduction
1.49 + */
1.50 + enum TXmlEngXPathResultType
1.51 + {
1.52 + EUndefined = 0,
1.53 + ENodeset = 1,
1.54 + EBoolean = 2,
1.55 + ENumber = 3,
1.56 + EString = 4
1.57 + //Other node types defined in XPath are not supported.
1.58 + } ;
1.59 +
1.60 +public:
1.61 + /** Default constructor */
1.62 + IMPORT_C RXmlEngXPathResult();
1.63 +
1.64 + /** Frees any allocated memory */
1.65 + IMPORT_C void Free();
1.66 +
1.67 + /** Frees any allocated memory */
1.68 + inline void Close();
1.69 +
1.70 + /**
1.71 + Retrieves the type of the result (e.g. boolean, number, string, etc.).
1.72 + The type of a result should always be checked before using the result.
1.73 +
1.74 + If there was an error and no value was set, undefined is returned.
1.75 + Otherwise nodeset is returned.
1.76 +
1.77 + @return Type of result.
1.78 +
1.79 + @see TXmlEngXPathResultType
1.80 + */
1.81 + IMPORT_C TXmlEngXPathResultType Type() const;
1.82 +
1.83 + /**
1.84 + Retrieves a node-set result. A Non-RXmlEngNodeSet result will return NULL.
1.85 + No conversion is done from other types.
1.86 +
1.87 + For more information no NULL nodes:
1.88 + @see TXmlEngNode
1.89 +
1.90 + @return Node-set result
1.91 + */
1.92 + IMPORT_C RXmlEngNodeSet AsNodeSet() const;
1.93 +
1.94 + /**
1.95 + Retrieves a string copy of result.
1.96 + @param A buffer allocated by the caller that holds the result string
1.97 + @leave KErrNoMemory if out of memory situation occurs.
1.98 + @leave - Otherwise any of the system wide errors.
1.99 + */
1.100 + IMPORT_C void AsStringL(RBuf8& aOutput) const;
1.101 +
1.102 + /**
1.103 + Retrieves a numeric value result. Conversion can occur from other types.
1.104 +
1.105 + Node sets, strings, and booleans will be cast to numbers. Anything else
1.106 + will return NAN (i.e. not a number).
1.107 +
1.108 + @return Numeric value of the result.
1.109 +
1.110 + @see Math
1.111 + */
1.112 + IMPORT_C TReal AsNumber() const;
1.113 +
1.114 + /**
1.115 + Retrieves a boolean result. Conversion can occur from other types.
1.116 +
1.117 + Numbers will be returned as true unless it is not a number or 0.0.
1.118 + A string of 0 length will return false, otherwise true.
1.119 + If the node exists it will be returned as true, otherwise false.
1.120 +
1.121 + @return Boolean value of the result
1.122 + */
1.123 + IMPORT_C TBool AsBoolean() const;
1.124 +
1.125 +private:
1.126 + /**
1.127 + Constructor
1.128 + @param aData Internal representation of XPath result
1.129 + */
1.130 + RXmlEngXPathResult(void* aData);
1.131 +
1.132 +private:
1.133 + void* iInternal;
1.134 + };
1.135 +
1.136 +#include <xml/dom/xmlengxpathresult.inl>
1.137 +
1.138 +#endif /* XMLENGXPATHRESULT_H */
1.139 +