upnp/upnpstack/serviceframework/inc/upnprootcontenthandler.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 CUpnpRootContentHandler class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __UPNPROOTCONTENTHANDLER_H__
       
    21 #define __UPNPROOTCONTENTHANDLER_H__
       
    22 
       
    23 #include <babitflags.h>
       
    24 
       
    25 #include "upnpcontenthandler.h"
       
    26 
       
    27 /**
       
    28 *  This class handles root tag of xml device descriptions
       
    29 *  It extends CUpnpContentHandler class, thus it is subsequent implementation of MContentHandler interface
       
    30 *  It is designed to be used by upnp controler that delegates to it events from xml sax parser
       
    31 *
       
    32 *  @since Series60 2.6
       
    33 */
       
    34 class CUpnpDevice;
       
    35 
       
    36 using namespace Xml;
       
    37 
       
    38 NONSHARABLE_CLASS( CUpnpRootContentHandler ) : public CUpnpContentHandler
       
    39 {
       
    40 protected: 
       
    41     enum TState
       
    42         { 
       
    43         EInitial,
       
    44         EURLBase
       
    45         //ESpecVersion not used now
       
    46         };
       
    47 public:
       
    48 
       
    49     /**
       
    50     * Two-phased constructor
       
    51     * @since Series60 3.2 
       
    52     * @return instance of CUpnpRootContentHandler class
       
    53     */  
       
    54     static CUpnpRootContentHandler* NewL(
       
    55             CUpnpContentHandlersController& aController, CUpnpDevice& aResultDevice,
       
    56             TParseType aParseType );
       
    57     
       
    58     /**
       
    59     * Two-phased constructor. Leaves the object on CleanupStack
       
    60     * @since Series60 3.2 
       
    61     * @return instance of CUpnpRootContentHandler class
       
    62     */  
       
    63     static CUpnpRootContentHandler* NewLC( 
       
    64             CUpnpContentHandlersController& aController, CUpnpDevice& aResultDevice,
       
    65             TParseType aParseType );
       
    66     
       
    67     /**
       
    68     * Destructor of CUpnpRootContentHandler class
       
    69     * @since Series60 3.2     
       
    70     */	
       
    71     virtual ~CUpnpRootContentHandler();
       
    72     
       
    73 public:	// from MContentHandler
       
    74     
       
    75     /**
       
    76     * This method is a callback to indicate an element has been parsed.
       
    77     * @param				aElement is a handle to the element's details.
       
    78     * @param				aAttributes contains the attributes for the element.
       
    79     */
       
    80     virtual void OnStartElementL( const RTagInfo& aElement, 
       
    81     							  const RAttributeArray& aAttributes );
       
    82 
       
    83     /**
       
    84     * This method is a callback to indicate the end of the element has been reached.
       
    85     * @param              aElement is a handle to the element's details.
       
    86     */
       
    87     virtual void OnEndElementL( const RTagInfo& aElement );
       
    88     
       
    89     /**
       
    90     * This method is a callback that sends the content of the element.
       
    91     * aErrorCode should be KErrNone, and that aBytes should contains complete
       
    92     * content (one chunk).
       
    93     * @param              aBytes is the raw content data for the element in one chunk
       
    94     */
       
    95      virtual void OnContentL( const TDesC8& aBytes ); 
       
    96     
       
    97 protected:
       
    98 
       
    99     /**
       
   100     * Default C++ constructor 
       
   101     * @since Series60 3.2     
       
   102     */  
       
   103     CUpnpRootContentHandler( CUpnpContentHandlersController& aController, 
       
   104         CUpnpDevice& aResultDevice, TParseType aParseType );
       
   105 
       
   106 private:
       
   107     CUpnpDevice& iResultDevice;
       
   108     TState iCurrentState;
       
   109     TBitFlags8 iFoundTags;
       
   110     TParseType iParseType;
       
   111     
       
   112 };
       
   113 
       
   114 #endif //__UPNPROOTCONTENTHANDLER_H__