upnp/upnpstack/serviceframework/src/upnpactionlistcontenthandler.cpp
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:  Implements the CUpnpActionListContentHandler class
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #include "upnpactionlistcontenthandler.h"
       
    20 #include "upnpcontenthandlerscontroller.h"
       
    21 #include "upnpignorecontenthandler.h"
       
    22 #include "upnpactioncontenthandler.h"
       
    23 #include "upnpaction.h"
       
    24 #include "upnpservice.h"
       
    25 #include "upnpserviceliterals.h"
       
    26 
       
    27 // -----------------------------------------------------------------------------
       
    28 // CUpnpActionListContentHandler::NewL
       
    29 // Two-phased constructor
       
    30 // -----------------------------------------------------------------------------
       
    31 //
       
    32 CUpnpActionListContentHandler* CUpnpActionListContentHandler::NewL(
       
    33     CUpnpContentHandlersController& aController, CUpnpService& aResultService )
       
    34     {
       
    35     CUpnpActionListContentHandler* actionListContentHandler = 
       
    36         CUpnpActionListContentHandler::NewLC( aController, aResultService );
       
    37     CleanupStack::Pop( actionListContentHandler );
       
    38     return actionListContentHandler;
       
    39     }
       
    40 
       
    41 // -----------------------------------------------------------------------------
       
    42 // CUpnpActionListContentHandler::NewLC
       
    43 // Two-phased constructor. Leaves teh object on the CleanupStack
       
    44 // -----------------------------------------------------------------------------
       
    45 //
       
    46 CUpnpActionListContentHandler* CUpnpActionListContentHandler::NewLC(
       
    47     CUpnpContentHandlersController& aController, CUpnpService& aResultService )
       
    48     {
       
    49     CUpnpActionListContentHandler* actionListContentHandler = 
       
    50         new (ELeave) CUpnpActionListContentHandler( aController, aResultService );
       
    51     CleanupStack::PushL( actionListContentHandler );
       
    52     return actionListContentHandler;
       
    53     }
       
    54 
       
    55 // -----------------------------------------------------------------------------
       
    56 // CUpnpActionListContentHandler::~CUpnpActionListContentHandler
       
    57 // Destructor of CUpnpActionListContentHandler class 
       
    58 // -----------------------------------------------------------------------------
       
    59 //
       
    60 CUpnpActionListContentHandler::~CUpnpActionListContentHandler()
       
    61     {
       
    62     }
       
    63 
       
    64 // -----------------------------------------------------------------------------
       
    65 // CUpnpActionListContentHandler::CUpnpActionListContentHandler
       
    66 // Constructor
       
    67 // -----------------------------------------------------------------------------
       
    68 //
       
    69 CUpnpActionListContentHandler::CUpnpActionListContentHandler(
       
    70     CUpnpContentHandlersController& aController, CUpnpService& aResultService ) :
       
    71     CUpnpContentHandler( aController ), iResultService( aResultService )
       
    72     {
       
    73     }
       
    74 
       
    75 // -----------------------------------------------------------------------------
       
    76 // CUpnpActionListContentHandler::OnStartElementL
       
    77 // This method is a callback to indicate an element has been parsed.
       
    78 // -----------------------------------------------------------------------------
       
    79 //
       
    80 void CUpnpActionListContentHandler::OnStartElementL(
       
    81     const RTagInfo& aElement, const RAttributeArray& /*aAttributes*/ )
       
    82     {
       
    83     const TDesC8& elementName( aElement.LocalName().DesC() );
       
    84     if ( elementName.Compare( KUpnpAction ) == 0 )
       
    85         {
       
    86         CUpnpAction* action = CUpnpAction::NewL( iResultService );
       
    87         CleanupStack::PushL( action );
       
    88         iResultService.AddActionL( *action );
       
    89         CleanupStack::Pop( action );
       
    90         iController.SetCurrentContentHandlerL( 
       
    91             CUpnpActionContentHandler::NewL( iController, *action ) );
       
    92         }
       
    93     else
       
    94         {
       
    95         iController.SetCurrentContentHandlerL( 
       
    96             CUpnpIgnoreContentHandler::NewL( iController ) );
       
    97         }
       
    98     }
       
    99 
       
   100 // -----------------------------------------------------------------------------
       
   101 // CUpnpActionListContentHandler::OnEndElementL
       
   102 // This method is a callback to indicate the end of the element has been reached.
       
   103 // -----------------------------------------------------------------------------
       
   104 //
       
   105 void CUpnpActionListContentHandler::OnEndElementL( const RTagInfo& aElement )
       
   106     {
       
   107     ASSERT( aElement.LocalName().DesC().Compare( KUpnpActionList ) == 0 );
       
   108     iController.SetPreviousContentHandler();
       
   109     }
       
   110 
       
   111 // -----------------------------------------------------------------------------
       
   112 // CUpnpActionListContentHandler::OnContentL
       
   113 // This method is a callback that sends the content of the element.
       
   114 // aErrorCode must be KErrNone, and that aBytes should contains complete
       
   115 // content (one chunk).
       
   116 // -----------------------------------------------------------------------------
       
   117 //
       
   118 void CUpnpActionListContentHandler::OnContentL( const TDesC8& /*aBytes*/ )
       
   119     {
       
   120     //User::Leave( KErrArgument ) 
       
   121     }
       
   122 
       
   123 //  End of File