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