epoc32/include/xml/dom/xmlengxpathconfiguration.h
branchSymbian3
changeset 4 837f303aceeb
equal deleted inserted replaced
3:e1b950c65cb4 4:837f303aceeb
       
     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 configuraion functions
       
    15 //
       
    16 
       
    17 
       
    18 
       
    19 /**
       
    20  @file
       
    21  @publishedAll
       
    22  @released
       
    23 */
       
    24 #ifndef XMLENGXPATHCONFIGURATION_H
       
    25 #define XMLENGXPATHCONFIGURATION_H
       
    26 
       
    27 #include <xml/dom/xmlengxpathextensionfunction.h>
       
    28 
       
    29 /**
       
    30 This class holds a name, a namespace URI and a pointer to a XPath extension
       
    31 function (either native or defined via MXmlEngXPathExtensionFunction interface).
       
    32 
       
    33 @see XmlEngXPathConfiguration
       
    34 @see MXmlEngXPathExtensionFunction
       
    35 */
       
    36 class TXmlEngExtensionFunctionDescriptor
       
    37     {
       
    38 public:
       
    39 	/** Default constructor */
       
    40 	IMPORT_C TXmlEngExtensionFunctionDescriptor();
       
    41 
       
    42 public:
       
    43 	/** Extension function (Pointer to MXmlEngXPathExtensionFunction) */
       
    44     void* iFunc;
       
    45 	/** Function name */
       
    46     const char* iName;
       
    47 	/** Second name */
       
    48     const char* iNamespaceUri;     
       
    49 	/** Reserved */
       
    50 	TInt iReserved;
       
    51     };
       
    52 
       
    53 /**
       
    54 This object is used to support extension functions used within the XPath library.
       
    55 Extension functions may be added or removed.  This object can also determine whether
       
    56 an extension function is supported.
       
    57 
       
    58 Extension functions are stored in a TXmlEngExtensionFunctionDescriptor object which
       
    59 holds the extension function (a MXmlEngXPathExtensionFunction instance), the
       
    60 function name and the function namespace.  An extension function can be added
       
    61 to the library using XmlEngXPathConfiguration::AddExtensionFunctionL().
       
    62 
       
    63 When an extension function is to be evaluated,
       
    64 MXmlEngXPathExtensionFunction::Evaluate() is called with a
       
    65 MXmlEngXPathEvaluationContext instance which holds the function arguments and
       
    66 evaluation result.
       
    67 
       
    68 @see MXmlEngXPathExtensionFunction
       
    69 @see MXmlEngXPathEvaluationContext
       
    70 @see TXmlEngExtensionFunctionDescriptor
       
    71 */
       
    72 class XmlEngXPathConfiguration
       
    73     {
       
    74 public:
       
    75     /** 
       
    76 	Unused 
       
    77 	@internalComponent
       
    78 	*/
       
    79     IMPORT_C static void Unused_Func1(TBool aEnable);
       
    80 
       
    81     /**
       
    82     Disables support of any previously registered extension functions
       
    83     and switches to support only the XPath Function Library.
       
    84 	@leave KErrNoMemory Memory allocation failure
       
    85     */
       
    86     IMPORT_C static void ResetExtensionFunctionsL();
       
    87 
       
    88     /**
       
    89     Check if XPath extension function is supported.
       
    90     
       
    91     @param aFunc Function name
       
    92     @param aNsUri Function namespace URI
       
    93     @return ETrue if supported, EFalse otherwise
       
    94 	@leave - One of the system-wide error codes
       
    95     */
       
    96     IMPORT_C static TBool IsFunctionSupportedL(const TDesC8& aFunc, const TDesC8& aNsUri);
       
    97 
       
    98     /**
       
    99     Registers an extension function at the global scope.
       
   100 
       
   101     @param aFuncDes Function descriptor.
       
   102 	@leave KXmlEngErrWrongUseOfAPI Error initializing XPath context
       
   103 	@leave KXmlEngErrXPathResult Error adding function 
       
   104 	@leave - One of the system-wide error codes
       
   105     */
       
   106     IMPORT_C static void AddExtensionFunctionL(const TXmlEngExtensionFunctionDescriptor& aFuncDes);    
       
   107 
       
   108     /**
       
   109     Registers a set of extension functions at the global scope.
       
   110     
       
   111     @param aFuncVector Vector with function descriptors.  Ownership is not transferred.
       
   112 	@param aSize The size of the vector
       
   113 	@leave KXmlEngErrWrongUseOfAPI Error initializing XPath context
       
   114 	@leave KXmlEngErrXPathResult Error adding function 
       
   115 	@leave - One of the system-wide error codes
       
   116     */
       
   117     IMPORT_C static void AddExtensionFunctionVectorL (const RArray<TXmlEngExtensionFunctionDescriptor>& aFuncVector, TUint aSize);    
       
   118 
       
   119     /**
       
   120     Registers a native extension function at the global scope.
       
   121 
       
   122     @param aNativeFuncDes Function descriptor.
       
   123 	@leave KXmlEngErrWrongUseOfAPI Error initializing XPath context
       
   124 	@leave KXmlEngErrXPathResult Error adding function 
       
   125 	@leave - One of the system-wide error codes
       
   126     */
       
   127     IMPORT_C static void AddNativeExtensionFunctionL(const TXmlEngExtensionFunctionDescriptor& aNativeFuncDes);    
       
   128 
       
   129     /**
       
   130     Registers a set of native extension functions at the global scope.
       
   131 
       
   132     @param aNativeFuncVector Function descriptor.
       
   133 	@param aSize The size of the vector
       
   134 	@leave KXmlEngErrWrongUseOfAPI Error initializing XPath context
       
   135 	@leave KXmlEngErrXPathResult Error adding function 
       
   136 	@leave - One of the system-wide error codes
       
   137     */
       
   138     IMPORT_C static void AddNativeExtensionFunctionVectorL(const RArray<TXmlEngExtensionFunctionDescriptor>& aNativeFuncVector, TUint aSize);    
       
   139 
       
   140     /**
       
   141 	Deregisters an extension function.  No error is generated if the extension
       
   142 	function is not found.
       
   143 
       
   144     @param aFuncDes Function descriptor.
       
   145     */
       
   146     IMPORT_C static void RemoveExtensionFunction(const TXmlEngExtensionFunctionDescriptor& aFuncDes);    
       
   147 
       
   148     /**
       
   149 	Deregisters a set of extension functions.  No error is generated if an
       
   150 	extension function in the vector is not found.
       
   151 
       
   152     @param aFuncVector Vector with function descriptors.
       
   153 	@param aSize The size of the vector
       
   154     */
       
   155     IMPORT_C static void RemoveExtensionFunctionVector(const RArray<TXmlEngExtensionFunctionDescriptor>& aFuncVector, TUint aSize);    
       
   156     };
       
   157 
       
   158 #endif /* XMLENGXPATHCONFIGURATION_H */
       
   159