upnp/upnpstack_plat/upnp_utils_api/inc/upnpdominterface.h
changeset 0 f5a58ecadc66
child 9 5c72fd91570d
equal deleted inserted replaced
-1:000000000000 0:f5a58ecadc66
       
     1 /** @file
       
     2 * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies  this distribution, and is available 
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Declares UpnpDomInterface functions
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_UPNPDOMINTERFACE_H
       
    20 #define C_UPNPDOMINTERFACE_H
       
    21 
       
    22 // INCLUDES
       
    23 
       
    24 #include <e32def.h>
       
    25 #include <e32math.h>
       
    26 #include <f32file.h>
       
    27 #include <s32file.h>
       
    28 #include <utf.h>
       
    29 #include <xmlengdom.h>
       
    30 
       
    31 namespace UpnpDomInterface
       
    32     {
       
    33     
       
    34 	//CONSTANTS
       
    35     _LIT8(KContainer, "container");
       
    36     _LIT8(KSearchable, "searchable");
       
    37     _LIT8(KTrueVal, "1");
       
    38     
       
    39 	/*
       
    40 	* GetAttrValueL
       
    41 	* Gets value of the indicated attribut for the given tag.
       
    42 	* @Param aElement reference to the Element which attribute's value 
       
    43 	*	should be returned.
       
    44 	* @Param aAttribute name of the attribute which value should be returned.
       
    45 	* @Return attribute's value or empty descriptor if Element has no such attribute.
       
    46 	*/
       
    47 	IMPORT_C TPtrC8 GetAttrValueL( const TXmlEngElement& aElement,
       
    48                     	      	   const TDesC8& aAttribute );	
       
    49     
       
    50     /*
       
    51 	* GetElementValueL
       
    52 	* Gets value of the indicated element.
       
    53 	* @Param aElement reference to the Element which value should be returned.
       
    54 	* @Return value or empty descriptor if Element has no content.
       
    55 	*/
       
    56 	IMPORT_C TPtrC8 GetElementValueL( const TXmlEngElement& aElement );	
       
    57     
       
    58     /*
       
    59 	* AllocElementValueL
       
    60 	* Gets value of the indicated element and allocs it on heap.
       
    61 	* @Param aElement reference to the Element which value should be returned.
       
    62 	* @Return pointer to allocated descriptor eith content or NULL if Element has no content.
       
    63 	*/
       
    64 	IMPORT_C HBufC* AllocElementValueL( const TXmlEngElement& aElement );	
       
    65     
       
    66                     	      	    
       
    67 	/*
       
    68 	* CheckTagL
       
    69 	* Checks if given XML element has given tag.	
       
    70 	* @Param aElement reference to the Element that is being checked
       
    71 	* @Param aTag LocalName of the Element which is being checked
       
    72     * @Return ETrue if element's name is equal to the passed one 
       
    73 	*/
       
    74 	IMPORT_C TBool CheckTagL( const TXmlEngElement& aElement,
       
    75                     	      const TDesC8& aTag );
       
    76 	
       
    77 	/*
       
    78 	* CheckTagL
       
    79 	* Checks if given XML element has given tag and contains given value.
       
    80 	* @Param aElement reference to the Element that is being checked
       
    81 	* @Param aTag LocalName of the Element which is being checked
       
    82     * @Param aTagValue The value that is checked againts 
       
    83     * the contents of the aTag element
       
    84     * @Return ETrue if element meets searching criteria
       
    85 	*/
       
    86 	IMPORT_C TBool CheckTagL( const TXmlEngElement& aElement,
       
    87                        		  const TDesC8& aTag,
       
    88                        		  const TDesC8& aTagValue );
       
    89     
       
    90     /*
       
    91     * CheckSubTagL
       
    92     * Checks if the given elements has an element whose 
       
    93     * local name is specified by the Tag
       
    94     * @Param aElement reference to the Element that is being checked
       
    95     * @Param aTag LocalName that is being searched for 
       
    96     * @Return ETrue if subtag meets search criteria
       
    97     */
       
    98     IMPORT_C TBool CheckSubTagL( const TXmlEngElement& aElement,
       
    99                                  const TDesC8& aTag );
       
   100                                                     		 
       
   101     /*
       
   102     * CheckSubTagL
       
   103     * Checks the value of the specified SubTag (Element) against 
       
   104     * the given value returns ETrue if match found else EFalse 
       
   105     * @Param aElement reference to the Element that is being checked
       
   106     * @Param aTag LocalName of the Element which is being checked
       
   107     * @Param aTagValue The value that is checked againts 
       
   108     * the contents of the Tag element
       
   109     * @Return ETrue if subtag meets search criteria
       
   110     */
       
   111     IMPORT_C TBool CheckSubTagL( const TXmlEngElement& aElement,
       
   112                                  const TDesC8& aTag,
       
   113                                  const TDesC8& aTagValue );
       
   114     
       
   115     /*
       
   116     * CheckSubTagPrefixL
       
   117     * Checks the value of the specified SubTag (Element) against 
       
   118     * the given value returns ETrue if match found else EFalse 
       
   119     * @Param aElement reference to the Element that is being checked
       
   120     * @Param aNameSpacePrefix Specifies the wanted prefix
       
   121     * @Param aTag LocalName of the Element which is being checked
       
   122     * @Param aTagValue The value that is checked againts 
       
   123     * the contents of the Tag element
       
   124     * @Return ETrue if subtag meets search criteria
       
   125     */
       
   126     IMPORT_C TBool CheckSubTagPrefixL( const TXmlEngElement& aElement,
       
   127                                        const TDesC8& aNameSpacePrefix,
       
   128                                        const TDesC8& aTag,
       
   129                                        const TDesC8& aTagValue );
       
   130     
       
   131     /*
       
   132     * CheckAttributeValueL
       
   133     * Checks the attribute value of the given element against the given value. 
       
   134     * @Param aElement reference to the Element being checked
       
   135     * @Param aAttribute The Name of the attribute which is being checked
       
   136     * @Param aValue The value that is checked against the value of the aAttribute
       
   137     * @Return ETrue if attribute meets given criteria
       
   138     */
       
   139     IMPORT_C TBool CheckAttributeValueL( const TXmlEngElement& aElement,
       
   140                                          const TDesC8& aAttribute,
       
   141                                          const TDesC8& aValue);
       
   142                                          
       
   143     /*
       
   144     * DeleteElement
       
   145     * Deletes the specified element from the DomTree
       
   146     * @param aElement reference to the Element to be deleted
       
   147     * @return the parent element
       
   148     */
       
   149     IMPORT_C TXmlEngElement DeleteElement(TXmlEngElement& aElement);      
       
   150                                    
       
   151     /*
       
   152     * GetElementL
       
   153     * Searches the DomTree for the element specified by the given specifiers.
       
   154     * @param aElement reference to a "Root" element from which the search will start
       
   155     * @param aWanted Specifies the location of the reference 
       
   156     * which will be set to point to the wanted Element
       
   157     * @param aMainTag LocalName of the Element that is being searched for 
       
   158     * @param aDepth specifies how deep into the tree the search will proceed 
       
   159     * (if set to -1 the whole tree will be searched)
       
   160     * @param aCurrentDepth How deep into the tree the search has proceeded 
       
   161     * (should be set to 0 when the search is started)
       
   162     * @Return ETrue if element is found
       
   163     */
       
   164     IMPORT_C TBool GetElementL( const TXmlEngElement& aElement, 
       
   165                                 TXmlEngElement& aWanted, 
       
   166                                 const TDesC8& aMainTag,
       
   167                                 TInt aDepth=-1, 
       
   168                                 TInt aCurrentDepth=0);
       
   169     
       
   170   	/*
       
   171     * GetElementL
       
   172     * Searches the DomTree for the element specified by the given specifiers.
       
   173     * @param aElement reference to a "Root" element from which the search will start
       
   174     * @param aWanted Specifies the location of the reference 
       
   175     * which will be set to point to the wanted Element
       
   176     * @param aMainTag LocalName of the Element that is being searched for 
       
   177     * @param aSubTag LocalName of an Element within 
       
   178     * the MainElement that is being searched for
       
   179     * @param aDepth specifies how deep into the tree the search will proceed 
       
   180     * (if set to -1 the whole tree will be searched)
       
   181     * @param aCurrentDepth How deep into the tree the search has proceeded 
       
   182     * (should be set to 0 when the search is started)
       
   183     * @Return ETrue if element is found
       
   184     */
       
   185     IMPORT_C TBool GetElementL( const TXmlEngElement& aElement, 
       
   186     						    TXmlEngElement& aWanted,
       
   187                                 const TDesC8& aMainTag,
       
   188                                 const TDesC8& aSubTag,
       
   189                                 TInt aDepth=-1,
       
   190                                 TInt aCurrentDepth=0);
       
   191     
       
   192     /**
       
   193     * GetElementL
       
   194     * Searches the DomTree for the element specified by the given specifiers.
       
   195     * @param aElement reference to a "Root" element from which the search will start
       
   196     * @param aWanted Specifies the location of the reference 
       
   197     * which will be set to point to the wanted Element
       
   198     * @param aMainTag LocalName of the Element that is being searched for 
       
   199     * @param aSubTag LocalName of an Element within 
       
   200     * the MainElement that is being searched for
       
   201     * @param aSubTagValue Contents of the Element specified by the aSubTag
       
   202     * @param aDepth specifies how deep into the tree the search will proceed 
       
   203     * (if set to -1 the whole tree will be searched)
       
   204     * @param aCurrentDepth How deep into the tree the search has proceeded 
       
   205     * (should be set to 0 when the search is started)
       
   206     * @Return ETrue if element is found 
       
   207     */
       
   208     IMPORT_C TBool GetElementL( const TXmlEngElement& aElement, 
       
   209     						    TXmlEngElement& aWanted, 
       
   210                                 const TDesC8& aMainTag,
       
   211                                 const TDesC8& aSubTag,
       
   212                                 const TDesC8& aSubTagValue,
       
   213                                 TInt aDepth=-1,
       
   214                                 TInt aCurrentDepth=0);
       
   215                                    
       
   216     /*
       
   217     * GetContentElementL
       
   218     * Searches the DomTree for the element specified by the given specifiers.
       
   219     * @param aElement reference to a "Root" element from which the search will start
       
   220     * @param aWanted Specifies the location of the reference 
       
   221     * which will be set to point to the wanted Element
       
   222     * @param aSubTag LocalName of an Element within 
       
   223     * the MainElement that is being searched for
       
   224     * @param aSubTagValue Contents of the Element specified by the aSubTag
       
   225     * @param aDepth specifies how deep into the tree the search will proceed 
       
   226     * (if set to -1 the whole tree will be searched)
       
   227     * @param aCurrentDepth How deep into the tree the search has proceeded 
       
   228     * (should be set to 0 when the search is started)
       
   229     * @Return ETrue if element is found
       
   230     */
       
   231     IMPORT_C TBool GetContentElementL( const TXmlEngElement& aElement, 
       
   232     								   TXmlEngElement& aWanted,
       
   233                                        const TDesC8& aSubTag,
       
   234                                        const TDesC8& aSubTagValue,
       
   235                                        TInt aDepth=-1,
       
   236                                        TInt aCurrentDepth=0);
       
   237     
       
   238     /*
       
   239     * GetDirectoryElementL
       
   240     * Searches the DomTree for the element specified by the given parameters 
       
   241     * @param aElement reference to a "Root" element from which the search will start
       
   242     * @param aWanted Specifies the location of the reference 
       
   243     * which will be set to point to the wanted Element
       
   244     * @param aMainTag LocalName of the Element that is being searched for 
       
   245     * @param aAttribute The name of the Attribute of the MainElement 
       
   246     * that is searched for
       
   247     * @param aAttributeValue The wanted value of the Attribute 
       
   248     * that is searched for 
       
   249     * @param aDepth specifies how deep into the tree the search will proceed 
       
   250     * (if set to -1 the whole tree will be searched)
       
   251     * @param aCurrentDepth How deep into the tree the search has proceeded 
       
   252     * (should be set to 0 when the search is started)
       
   253     * @Return ETrue if element is found
       
   254     */
       
   255     IMPORT_C TBool GetDirectoryElementL( const TXmlEngElement& aElement, 
       
   256     								     TXmlEngElement& aWanted,
       
   257                                          const TDesC8& aMainTag,
       
   258                                          const TDesC8& aAttribute,
       
   259                                          const TDesC8& aAttributeValue, 
       
   260                                          TInt aDepth=-1, 
       
   261                                          TInt aCurrentDepth=0);
       
   262 
       
   263     /*
       
   264     * GetDirectoryElementL
       
   265     * Searches the DomTree for the element specified by the given parameters 
       
   266     * @param aElement reference to a "Root" element from which the search will start
       
   267     * @param aWanted Specifies the location of the reference 
       
   268     * which will be set to point to the wanted Element
       
   269     * @param aAttribute The name of the Attribute of the MainElement 
       
   270     * that is searched for
       
   271     * @param aAttributeValue The wanted value of the Attribute 
       
   272     * that is searched for 
       
   273     * @param aDepth specifies how deep into the tree the search will proceed 
       
   274     * (if set to -1 the whole tree will be searched)
       
   275     * @param aCurrentDepth How deep into the tree the search has proceeded 
       
   276     * (should be set to 0 when the search is started)
       
   277     * @Return ETrue if element is found
       
   278     */
       
   279     IMPORT_C TBool GetDirectoryElementL( const TXmlEngElement& aElement, 
       
   280     								     TXmlEngElement& aWanted,
       
   281                                          const TDesC8& aAttribute,
       
   282                                          const TDesC8& aAttributeValue, 
       
   283                                          TInt aDepth=-1, 
       
   284                                          TInt aCurrentDepth=0);
       
   285     
       
   286     /*
       
   287     * GetElementListL
       
   288     * Creates a RArray of Elements that fit the given specifiers 
       
   289     * @param aElement reference to a "Root" element from which the search will start
       
   290     * @param aElementList list of elements matching searching criteria
       
   291     * @param aMainTag LocalName of the Element that is being searched for 
       
   292     * @param aSearchable Specifies whether or not 
       
   293     * the searchability of container-elements is checked
       
   294     * @Return ETrue if any element has been found.
       
   295     */
       
   296     IMPORT_C TBool GetElementListL( const TXmlEngElement& aElement,
       
   297                                     RArray<TXmlEngElement>& aElementList,
       
   298                                     const TDesC8& aMainTag,
       
   299                                     TBool aSearchable=EFalse );
       
   300     
       
   301     
       
   302     
       
   303     /*
       
   304     * GetElementList
       
   305     * Creates a RArray of Elements that fit the given specifiers 
       
   306     * @param aElement reference to a "Root" element from which the search will start
       
   307     * @param aElementList list of elements matching searching criteria
       
   308     * @param aMainTag LocalName of the Element that is being searched for 
       
   309     * @param aSubTag LocalName of an Element within 
       
   310     * the MainElement that is being searched for
       
   311     * @param aSubTagValue Contents of the Element specified by the aSubTag
       
   312     * @param aSearchable Specifies whether or not 
       
   313     * the searchability of container-elements is checked 	
       
   314  	* @Return ETrue if any element has been found.
       
   315     */
       
   316     IMPORT_C TBool GetElementListL( const TXmlEngElement& aElement, 
       
   317                                     RArray<TXmlEngElement>& aElementList,
       
   318                                     const TDesC8& aMainTag, 
       
   319                                     const TDesC8& aSubTag, 
       
   320                                     const TDesC8& aSubValue,
       
   321                                     TBool aSearchable=EFalse);
       
   322 
       
   323     
       
   324         
       
   325     /*
       
   326     * GetElementList
       
   327     * Creates a RArray of Elements that fit the given specifiers 
       
   328     * @param aElement reference to a "Root" element from which the search will start
       
   329     * @param aElementList list of elements matching searching criteria
       
   330     * @param aMainTag LocalName of the Element that is being searched for 
       
   331     * @param aSubTag LocalName of an Element within 
       
   332     * the MainElement that is being searched for
       
   333     * @param aSubTagValue Contents of the Element specified by the aSubTag
       
   334     * @Param aSearchable Specifies whether or not 
       
   335     * the searchability of container-elements is checked
       
   336     * @Param aNSPrefix the Prefix of the wanted element
       
   337     * @Return ETrue if any element has been found. 
       
   338     */
       
   339     IMPORT_C TBool GetElementListL( const TXmlEngElement& aElement, 
       
   340                                     RArray<TXmlEngElement>& aElementList,
       
   341                                     const TDesC8& aMainTag,
       
   342                                     const TDesC8& aSubTag,
       
   343                                     const TDesC8& aSubValue,
       
   344                                     const TDesC8& aNSPrefix,
       
   345                                     TBool aSearchable=EFalse );
       
   346     
       
   347     /*
       
   348     * GetDirectoryElementList
       
   349     * Creates a RArray of Elements that fit the given specifiers 
       
   350     * @param aElement reference to a "Root" element from which the search will start
       
   351     * @param aElementList list of elements matching searching criteria
       
   352     * @param aAttrName The name of the Attribute of the Element 
       
   353     * that is searched for
       
   354     * @param aAttributeValue The wanted value of the Attribute 
       
   355     * that is searched for 
       
   356     * @param aSearchable Specifies whether or not the searchability 
       
   357     * of container-elements is checked 
       
   358     * @Return ETrue if any element has been found. 
       
   359     */
       
   360     IMPORT_C TBool GetDirectoryElementListL( const TXmlEngElement& aElement, 
       
   361                                              RArray<TXmlEngElement>& aElementList,
       
   362                                              const TDesC8& aAttrName,
       
   363                                              const TDesC8& aAttrValue,
       
   364                                              TBool aSearchable=EFalse);
       
   365     
       
   366     /*
       
   367     * GetContentElementList
       
   368     * Creates a RArray of Elements that fit the given specifiers
       
   369     * @Param aElement reference to a "Root" element from which the search will start
       
   370     * @param aElementList list of elements matching searching criteria
       
   371     * @Param aMainTag LocalName of the Element that is being searched for 
       
   372     * @Param aSubTag LocalName of an Element within the MainElement 
       
   373     * that is being searched for
       
   374     * @Param aSubTagValue Contents of the Element specified by the aSubTag
       
   375     * @Param aSearchable Specifies whether or not 
       
   376     * the searchability of container-elements is checked 
       
   377     * @Return ETrue if any element has been found.
       
   378     */
       
   379     IMPORT_C TBool GetContentElementListL( const TXmlEngElement& aElement, 
       
   380                                            RArray<TXmlEngElement>& aElementList,
       
   381                                            const TDesC8& aSubTag,
       
   382                                            const TDesC8& aSubValue,
       
   383                                            TBool aSearchable=EFalse );               
       
   384                                           
       
   385     /*
       
   386     * SaveToFile
       
   387     * Saves the contents of the aRoot element into the given file.
       
   388     * All saving should be done with ROOT element.
       
   389     * @param aFileName name of the file
       
   390     * @param aRoot reference to the first element of the DomTree
       
   391     * @return ETrue if writing succeeded 
       
   392     */
       
   393     IMPORT_C TBool SaveToFileL(const TDesC16& aFileName, const TXmlEngElement& aRoot);
       
   394     
       
   395     /*
       
   396     * SaveToFile
       
   397     * Saves the contents of the aRoot element into the given file.
       
   398     * Writes given TDesC8 string to file
       
   399     * @param aFileName name of the file
       
   400     * @param aData string that is saved to the file
       
   401     * @return ETrue if writing succeeded 
       
   402     */
       
   403     IMPORT_C TBool SaveToFileL(const TDesC16& aFileName, const TDesC8& aData);
       
   404                                          
       
   405     
       
   406     
       
   407 }
       
   408 
       
   409 #endif      // C_UPNPDOMINTERFACE_H   
       
   410             
       
   411 // End of File
       
   412 
       
   413