xml/xmldomandxpath/inc/xpath/xmlengxpathexpression.h
changeset 0 e35f40988205
equal deleted inserted replaced
-1:000000000000 0:e35f40988205
       
     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 // XPath expression declaration
       
    15 //
       
    16 
       
    17 
       
    18 
       
    19 /**
       
    20  @file
       
    21  @publishedAll
       
    22  @released
       
    23 */
       
    24 #ifndef XMLENGXPATHEXPRESSION_H
       
    25 #define XMLENGXPATHEXPRESSION_H
       
    26 
       
    27 #include <xml/dom/xmlengxpathresult.h>
       
    28 #include <xml/dom/xmlengnamespaceresolver.h>
       
    29 
       
    30 class TXmlEngNode;
       
    31 
       
    32 /**
       
    33 A compiled XPath expression is a textual expression transformed after
       
    34 syntactical analysis into some internal representation of the expression.  The
       
    35 only missing element for evaluation of the expression is evaluation context:
       
    36 the context node (where to start) and an optional set of prefix-to-namespace bindings.
       
    37 
       
    38 XPath Expressions are created and instantiated by the Evaluator:
       
    39 @see TXmlEngXPathEvaluator
       
    40  
       
    41 See the XPath spec here:
       
    42 http://www.w3.org/TR/2004/NOTE-DOM-Level-3-XPath-20040226/xpath.html
       
    43 */
       
    44 class RXmlEngXPathExpression
       
    45 {
       
    46     friend class TXmlEngXPathEvaluator;
       
    47 
       
    48 public:
       
    49 	/** XPath expression parts */
       
    50     enum TXmlEngXPathExpressionPartType
       
    51         {
       
    52 	    EFunction,
       
    53         EPrefix
       
    54         };
       
    55 
       
    56 public:
       
    57     /** Default constructor */
       
    58     IMPORT_C RXmlEngXPathExpression();
       
    59 	
       
    60 	/** Resets the compiled expression and frees the allocated memory */
       
    61     IMPORT_C void Destroy();
       
    62     
       
    63     /** Resets the compiled expression and frees the allocated memory */
       
    64     inline void Close();
       
    65 
       
    66 	// XPath 1.0 methods
       
    67 
       
    68     /**
       
    69     Evaluates this expression.
       
    70     
       
    71     @param aContextNode The node relative to which the expression is evaluated.
       
    72     @param aResolver Not supported in current API.  Reserved for future use.
       
    73     @return Result of evaluation
       
    74     @leave KXmlEngErrXPathResult Error evaluating expression
       
    75 	@leave KXmlEngErrXPathSyntax Error compiling expression
       
    76 	@leave KErrNoMemory Memory allocation error
       
    77 	@leave - Otherwise, any of the system wide errors.
       
    78     */
       
    79     IMPORT_C RXmlEngXPathResult EvaluateL(TXmlEngNode aContextNode, 
       
    80                                     const MXmlEngNamespaceResolver* aResolver = NULL) const;
       
    81 
       
    82 
       
    83 	// Extensions to XPath 1.0
       
    84 
       
    85 	/**
       
    86 	Does the same thing as EvaluateL(), but also calculates the dependency list
       
    87 	of the expression.
       
    88     
       
    89     @param aContextNode The node relative to which the expression is evaluated.
       
    90     @param aDependents After the method has returned, contains set of nodes that
       
    91     the expression is dependent on.
       
    92     @param aResolver Not supported in current API.  Reserved for future use.
       
    93     @return Result of evaluation 
       
    94     @leave KXmlEngErrXPathResult Error evaluating expression
       
    95 	@leave KXmlEngErrXPathSyntax Error compiling expression
       
    96 	@leave KErrNoMemory Memory allocation error
       
    97 	@leave - Otherwise, any of the system wide errors.
       
    98     */
       
    99     IMPORT_C RXmlEngXPathResult EvaluateWithDependenciesL(TXmlEngNode aContextNode, 
       
   100                                                     RXmlEngNodeSet& aDependents, 
       
   101                                                     const MXmlEngNamespaceResolver* aResolver = NULL) const;
       
   102 
       
   103 	/**
       
   104 	Set context data for the expression currently being evaluated.
       
   105 	 
       
   106 	Extended Context is data set by API users and available for XPath extension
       
   107 	functions.  For more information:
       
   108 	@see RXmlEngXPathExpression
       
   109 	 
       
   110 	@param aContext Extended context pointer
       
   111     */ 
       
   112     IMPORT_C void SetExtendedContext(void* aContext);
       
   113 
       
   114 	/**
       
   115 	Gets extended context data for the expression currently being evaluated.	 
       
   116 	 
       
   117 	@return Extended context pointer or NULL if not sete
       
   118 	 
       
   119 	@see SetExtendedContext
       
   120     */ 
       
   121     IMPORT_C void* ExtendedContext() const;
       
   122     
       
   123 private:
       
   124     RXmlEngXPathExpression(void* aData, void* aData2);
       
   125 
       
   126 private:
       
   127     void* iInternal;
       
   128     void* iInternal2;
       
   129     TInt32 reserved1; 
       
   130     TAny* reserved2; 
       
   131 };  
       
   132 
       
   133 #include <xml/dom/xmlengxpathexpression.inl>
       
   134 
       
   135 #endif /* XMLENGXPATHEXPRESSION_H */
       
   136