upnp/upnpstack/serviceframework/inc/upnpcontenthandler.h
changeset 0 f5a58ecadc66
equal deleted inserted replaced
-1:000000000000 0:f5a58ecadc66
       
     1 /** @file
       
     2 * Copyright (c) 2007 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 the CUpnpContentHandler class
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __UPNPCONTENTHANDLER_H__
       
    20 #define __UPNPCONTENTHANDLER_H__
       
    21 
       
    22 #include <xml/contenthandler.h>
       
    23 #include <babitflags.h>
       
    24     
       
    25 class CUpnpContentHandlersController;
       
    26 
       
    27 /**
       
    28  * Abstract base class for all upnp content handlers used by CUpnpController.
       
    29  * It uses events similar to Xml::MContentHandler, but excludes not used events
       
    30  * and parameters.
       
    31  *
       
    32  */
       
    33     
       
    34 using namespace Xml;
       
    35 
       
    36 NONSHARABLE_CLASS(CUpnpContentHandler) : public CBase
       
    37     {
       
    38 public:
       
    39 
       
    40     //parsing type
       
    41     enum TParseType 
       
    42         {
       
    43         EDevice,
       
    44         EDeviceImpl,
       
    45         ESilentDeviceImpl
       
    46         };
       
    47         
       
    48     /**
       
    49      * This method is a callback to indicate an element has been parsed.
       
    50      * @param				aElement is a handle to the element's details.
       
    51      * @param				aAttributes contains the attributes for the element.
       
    52      */
       
    53     virtual void OnStartElementL( const RTagInfo& aElement,
       
    54             const RAttributeArray& aAttributes ) = 0;
       
    55 
       
    56     /**
       
    57      * This method is a callback to indicate the end of the element has been reached.
       
    58      * @param				aElement is a handle to the element's details.
       
    59      */
       
    60     virtual void OnEndElementL( const RTagInfo& aElement ) = 0;
       
    61 
       
    62     /**
       
    63      * This method is a callback that sends the content of the element.
       
    64      * @param				aBytes is the raw content data for the element. 
       
    65      * The client is responsible for converting the data to the 
       
    66      * required character set if necessary.
       
    67      * In some instances the content may be binary and must not be converted.
       
    68      */
       
    69     virtual void OnContentL( const TDesC8& aBytes ) = 0;
       
    70 
       
    71     /**
       
    72      * Returns value if class is interested in tags all namespaces 
       
    73      * 
       
    74      * @return ETrue when the class is interested in tags in all namespaces 
       
    75      */
       
    76     virtual TBool InterestedInAllNamespaces();
       
    77     
       
    78      /**
       
    79      * Reset internal state
       
    80      */
       
    81     virtual void ResetState();
       
    82 protected:
       
    83 
       
    84     /**
       
    85      * Set controller's current content handler to IgnoreContentHandler object
       
    86      * 
       
    87      **/
       
    88     void SetIgnoreHandlerL();
       
    89 
       
    90     /**
       
    91      * Returns ETrue if tag on aPosition has been already found.
       
    92      * If not set that now it is found and return EFalse.
       
    93      * @param              aPosition position of tag in iFoundTags
       
    94      * @param              aFoundTags flags with found tags set
       
    95      * @return             ETrue is found, EFalse otherwise
       
    96      */
       
    97     template<class T>
       
    98     inline TBool IsTagRepeated( TInt aPosition, TBitFlagsT<T>& aFoundTags );
       
    99 
       
   100     /**
       
   101      * Leaves if tag on aPosition has been already found.
       
   102      * If not just set that now it is found.
       
   103      * @param              aPosition position of tag in iFoundTags
       
   104      * @param              aFoundTags flags with found tags set
       
   105      */
       
   106     template<class T>
       
   107     inline void RepeatedTagCheckL( TInt aPosition, TBitFlagsT<T>& aFoundTags );
       
   108 
       
   109     /**
       
   110      * Constructor 
       
   111      * 
       
   112      * @param aController reference to controller of the object
       
   113      */
       
   114     CUpnpContentHandler( CUpnpContentHandlersController& aController );
       
   115 
       
   116 protected:
       
   117     CUpnpContentHandlersController& iController;
       
   118 
       
   119     };
       
   120 
       
   121 #include "upnpcontenthandler.inl"
       
   122 #endif //__UPNPCONTENTHANDLER_H__