upnp/upnpstack/serviceframework/src/upnpactionnamecontenthandler.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 CUpnpActionNameContentHandler class
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #include "upnpactionnamecontenthandler.h"
       
    20 #include "upnpcontenthandlerscontroller.h"
       
    21 #include "upnpignorecontenthandler.h"
       
    22 #include "upnpaction.h"
       
    23 #include "upnpserviceliterals.h"
       
    24 
       
    25 // -----------------------------------------------------------------------------
       
    26 // CUpnpActionNameContentHandler::NewL
       
    27 // Two-phased constructor
       
    28 // -----------------------------------------------------------------------------
       
    29 //
       
    30 CUpnpActionNameContentHandler* CUpnpActionNameContentHandler::NewL(
       
    31     CUpnpContentHandlersController& aController, CUpnpAction& aResultAction )
       
    32     {
       
    33     CUpnpActionNameContentHandler* actionContentHandler = 
       
    34         CUpnpActionNameContentHandler::NewLC( aController, aResultAction );
       
    35     CleanupStack::Pop( actionContentHandler );
       
    36     return actionContentHandler;
       
    37     }
       
    38 
       
    39 // -----------------------------------------------------------------------------
       
    40 // CUpnpActionNameContentHandler::NewLC
       
    41 // Two-phased constructor. Leaves teh object on the CleanupStack
       
    42 // -----------------------------------------------------------------------------
       
    43 //
       
    44 CUpnpActionNameContentHandler* CUpnpActionNameContentHandler::NewLC(
       
    45     CUpnpContentHandlersController& aController, CUpnpAction& aResultAction )
       
    46     {
       
    47     CUpnpActionNameContentHandler* actionContentHandler = 
       
    48         new (ELeave) CUpnpActionNameContentHandler( aController, aResultAction );
       
    49     CleanupStack::PushL( actionContentHandler );
       
    50     return actionContentHandler;
       
    51     }
       
    52 
       
    53 // -----------------------------------------------------------------------------
       
    54 // CUpnpActionNameContentHandler::~CUpnpActionNameContentHandler
       
    55 // Destructor of CUpnpActionNameContentHandler class 
       
    56 // -----------------------------------------------------------------------------
       
    57 //
       
    58 CUpnpActionNameContentHandler::~CUpnpActionNameContentHandler()
       
    59     {
       
    60     }
       
    61 
       
    62 // -----------------------------------------------------------------------------
       
    63 // CUpnpActionNameContentHandler::CUpnpActionNameContentHandler
       
    64 // Constructor
       
    65 // -----------------------------------------------------------------------------
       
    66 //
       
    67 CUpnpActionNameContentHandler::CUpnpActionNameContentHandler(
       
    68     CUpnpContentHandlersController& aController, CUpnpAction& aResultAction ) :
       
    69     CUpnpContentHandler( aController ), iResultAction( aResultAction )
       
    70     {
       
    71     }
       
    72 
       
    73 // -----------------------------------------------------------------------------
       
    74 // CUpnpActionNameContentHandler::OnStartElementL
       
    75 // This method is a callback to indicate an element has been parsed.
       
    76 // -----------------------------------------------------------------------------
       
    77 //
       
    78 void CUpnpActionNameContentHandler::OnStartElementL(
       
    79     const RTagInfo& /*aElement*/, const RAttributeArray& /*aAttributes*/ )
       
    80     {
       
    81     //User::Leave( KErrArgument )  not checked now
       
    82     iController.SetCurrentContentHandlerL( 
       
    83         CUpnpIgnoreContentHandler::NewL( iController ) );
       
    84     //<ElementType name="name" dt:type="string" content="textOnly" />
       
    85     }
       
    86 
       
    87 // -----------------------------------------------------------------------------
       
    88 // CUpnpActionNameContentHandler::OnEndElementL
       
    89 // This method is a callback to indicate the end of the element has been reached.
       
    90 // -----------------------------------------------------------------------------
       
    91 //
       
    92 void CUpnpActionNameContentHandler::OnEndElementL( const RTagInfo& aElement )
       
    93     {
       
    94     ASSERT( aElement.LocalName().DesC().Compare( KUpnpName ) == 0 );
       
    95     iController.SetPreviousContentHandler();
       
    96     }
       
    97 
       
    98 // -----------------------------------------------------------------------------
       
    99 // CUpnpActionNameContentHandler::OnContentL
       
   100 // This method is a callback that sends the content of the element.
       
   101 // Not all the content may be returned in one go. The data may be sent in chunks.
       
   102 // When an OnEndElementL is received this means there is no more content to be sent. 
       
   103 // -----------------------------------------------------------------------------
       
   104 //
       
   105 void CUpnpActionNameContentHandler::OnContentL( const TDesC8& aBytes )
       
   106     {
       
   107     iResultAction.SetNameL( aBytes );
       
   108     }
       
   109 
       
   110 //  End of File