upnp/upnpstack/serviceframework/inc/upnpservicecontenthandler.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 CUpnpServiceContentHandler class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __UPNPSERVICECONTENTHANDLER_H__
       
    20 #define __UPNPSERVICECONTENTHANDLER_H__
       
    21 
       
    22 #include "upnpcontenthandler.h"
       
    23 
       
    24 /**
       
    25  *  This class handles xml service descriptions
       
    26  *  It extends CUpnpContentHandler class, thus it is subsequent implementation of MContentHandler interface
       
    27  *  It is designed to be used by upnp controler that delegates to it events from xml sax parser
       
    28  *
       
    29  *  @since Series60 2.6
       
    30  */
       
    31 class CUpnpDevice;
       
    32 class CUpnpService;
       
    33 
       
    34 using namespace Xml;
       
    35 
       
    36 NONSHARABLE_CLASS(CUpnpServiceContentHandler) : public CUpnpContentHandler
       
    37     {
       
    38 public:
       
    39 
       
    40     /**
       
    41      * Two-phased constructor
       
    42      * @since Series60 3.2 
       
    43      * @return instance of CUpnpServiceContentHandler class
       
    44      */
       
    45     static CUpnpServiceContentHandler* NewL(
       
    46             CUpnpContentHandlersController& aController, 
       
    47             CUpnpDevice* aParentDevice );
       
    48 
       
    49     /**
       
    50      * Two-phased constructor. Leaves the object on CleanupStack
       
    51      * @since Series60 3.2 
       
    52      * @return instance of CUpnpServiceContentHandler class
       
    53      */
       
    54     static CUpnpServiceContentHandler* NewLC(
       
    55             CUpnpContentHandlersController& aController, 
       
    56             CUpnpDevice* aParentDevice );
       
    57 
       
    58     /**
       
    59      * Two-phased constructor
       
    60      * @since Series60 3.2 
       
    61      * @return instance of CUpnpServiceContentHandler class
       
    62      */
       
    63     static CUpnpServiceContentHandler* NewL(
       
    64             CUpnpContentHandlersController& aController, 
       
    65             CUpnpService& aNotOwnedResultService );
       
    66 
       
    67     /**
       
    68      * Two-phased constructor. Leaves the object on CleanupStack
       
    69      * @since Series60 3.2 
       
    70      * @return instance of CUpnpServiceContentHandler class
       
    71      */
       
    72     static CUpnpServiceContentHandler* NewLC(
       
    73             CUpnpContentHandlersController& aController, 
       
    74             CUpnpService& aNotOwnedResultService );
       
    75 
       
    76     /**
       
    77      * Destructor of CUpnpServiceContentHandler class
       
    78      * @since Series60 3.2     
       
    79      */
       
    80     virtual ~CUpnpServiceContentHandler();
       
    81 
       
    82     /**
       
    83      * Returns parsed CUpnpService object, and pass ownership of it to the caller.
       
    84      * One shouldn't call this method if CUpnpServiceContentHandler dosn't have
       
    85      * ownership CUpnpService object.
       
    86      */
       
    87     CUpnpService* ResultService();
       
    88 
       
    89 public: // from MContentHandler
       
    90 
       
    91     /**
       
    92      * This method is a callback to indicate an element has been parsed.
       
    93      * @param				aElement is a handle to the element's details.
       
    94      * @param				aAttributes contains the attributes for the element.
       
    95      */
       
    96     virtual void OnStartElementL( const RTagInfo& aElement, 
       
    97         const RAttributeArray& aAttributes );
       
    98 
       
    99     /**
       
   100      This method is a callback to indicate the end of the element has been reached.
       
   101      @param              aElement is a handle to the element's details.
       
   102      */
       
   103     virtual void OnEndElementL( const RTagInfo& aElement );
       
   104 
       
   105     /**
       
   106      This method is a callback that sends the content of the element.
       
   107      @param              aBytes is the raw content data for the element in one chunk
       
   108      */
       
   109     virtual void OnContentL( const TDesC8& aBytes );
       
   110     
       
   111 protected:
       
   112 
       
   113     /**
       
   114      * Default C++ constructor 
       
   115      * @since Series60 3.2     
       
   116      */
       
   117     CUpnpServiceContentHandler( CUpnpContentHandlersController& aController, 
       
   118         CUpnpDevice* aParentDevice );
       
   119 
       
   120     /**
       
   121      * Default C++ constructor 
       
   122      * @since Series60 3.2     
       
   123      */
       
   124     CUpnpServiceContentHandler( CUpnpContentHandlersController& aController, 
       
   125         CUpnpService& aNotOwnedResultService );
       
   126 
       
   127 private:
       
   128     CUpnpDevice* iParentDevice; //not owned
       
   129     CUpnpService* iResultService;
       
   130     TBool iIsServiceOwned;
       
   131 
       
   132     };
       
   133 
       
   134 #endif //__UPNPSERVICECONTENTHANDLER_H__