upnp/upnpstack/serviceframework/inc/upnpargumentcontenthandler.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 CUpnpArgumentContentHandler class
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __UPNPARGUMENTCONTENTHANDLER_H__
       
    20 #define __UPNPARGUMENTCONTENTHANDLER_H__
       
    21 
       
    22 #include <babitflags.h>
       
    23 #include "upnpcontenthandler.h"
       
    24 
       
    25 class CUpnpArgument;
       
    26 
       
    27 using namespace Xml;
       
    28 
       
    29 /**
       
    30  *  This class handles argument subtree of service descriptions
       
    31  *  It extends CUpnpContentHandler class, thus it is subsequent implementation of MContentHandler interface
       
    32  *  It is designed to be used by upnp controler that delegates to it events from xml sax parser   
       
    33  *
       
    34  *  @since Series60 2.6
       
    35  */
       
    36 NONSHARABLE_CLASS( CUpnpArgumentContentHandler ) : public CUpnpContentHandler
       
    37     {
       
    38 protected:
       
    39     enum TState
       
    40         {
       
    41         EInitial,
       
    42         EName,
       
    43         EDirection,
       
    44         ERelatedStateVariable
       
    45         };
       
    46 
       
    47 public:
       
    48 
       
    49     /**
       
    50      * Two-phased constructor
       
    51      * @since Series60 3.2 
       
    52      * @return instance of CUpnpArgumentContentHandler class
       
    53      */
       
    54     static CUpnpArgumentContentHandler* NewL(
       
    55             CUpnpContentHandlersController& aController, 
       
    56             CUpnpArgument& aResultAction );
       
    57 
       
    58     /**
       
    59      * Two-phased constructor. Leaves the object on CleanupStack
       
    60      * @since Series60 3.2 
       
    61      * @return instance of CUpnpArgumentContentHandler class
       
    62      */
       
    63     static CUpnpArgumentContentHandler* NewLC(
       
    64             CUpnpContentHandlersController& aController, 
       
    65             CUpnpArgument& aResultAction );
       
    66 
       
    67     /**
       
    68      * Destructor of CUpnpArgumentContentHandler class
       
    69      * @since Series60 3.2     
       
    70      */
       
    71     virtual ~CUpnpArgumentContentHandler();
       
    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      * @param              aBytes is the raw content data for the element in one chunk
       
    92      */
       
    93     virtual void OnContentL( const TDesC8& aBytes );
       
    94 
       
    95 protected:
       
    96 
       
    97     /**
       
    98      * Default C++ constructor 
       
    99      * @since Series60 3.2     
       
   100      */
       
   101     CUpnpArgumentContentHandler( CUpnpContentHandlersController& aController,
       
   102             CUpnpArgument& aResultAction );
       
   103 
       
   104 private:
       
   105     CUpnpArgument& iResultArgument;
       
   106     TState iCurrentState;
       
   107     TBitFlags8 iFoundTags;
       
   108 
       
   109     };
       
   110 
       
   111 #endif //__UPNPARGUMENTCONTENTHANDLER_H__