omadrm/drmengine/roap/src/LeaveDomainRespParser.cpp
changeset 0 95b198f216e5
equal deleted inserted replaced
-1:000000000000 0:95b198f216e5
       
     1 /*
       
     2 * Copyright (c) 2002-2004 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:  ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <e32base.h>
       
    22 #include "Base64.h"
       
    23 #include "RoapParser.h"
       
    24 #include "LeaveDomainResp.h"
       
    25 #include "LeaveDomainRespParser.h"
       
    26 
       
    27 using namespace Roap;
       
    28 
       
    29 // LOCAL CONSTANTS AND MACROS
       
    30 _LIT8(KStatus, "status");
       
    31 _LIT8(KErrorUrl, "errorRedirectURL");
       
    32 
       
    33 // ============================ MEMBER FUNCTIONS ===============================
       
    34 
       
    35 // -----------------------------------------------------------------------------
       
    36 // TLeaveDomainRespParser::TLeaveDomainRespParser
       
    37 // 
       
    38 // -----------------------------------------------------------------------------
       
    39 //
       
    40 TLeaveDomainRespParser::TLeaveDomainRespParser(
       
    41     CLeaveDomainResp* aResponse)
       
    42     {
       
    43     iResponse = aResponse;
       
    44     }
       
    45 
       
    46 // -----------------------------------------------------------------------------
       
    47 // TLeaveDomainRespParser::?member_function
       
    48 // ?implementation_description
       
    49 // (other items were commented in a header).
       
    50 // -----------------------------------------------------------------------------
       
    51 //
       
    52 void TLeaveDomainRespParser::OnStartElementL(
       
    53     CRoapParser& aParser,
       
    54     TInt aState,
       
    55     const RTagInfo& /*aElement*/,
       
    56     const RAttributeArray& aAttributes)
       
    57     {
       
    58     HBufC8* buffer = NULL;
       
    59 
       
    60     switch (aState)
       
    61         {
       
    62         case ELeaveDomainResponseState:
       
    63             buffer = aParser.GetAttributeValueL(aAttributes, KStatus);
       
    64             if (buffer != NULL)
       
    65                 {
       
    66                 iResponse->iStatus = aParser.ConvertRoapStatus(*buffer);
       
    67                 delete buffer;
       
    68                 }
       
    69             else
       
    70                 {
       
    71                 iResponse->iStatus = EUnknownStatus;
       
    72                 }
       
    73                                           
       
    74             iResponse->iErrorUrl = aParser.GetAttributeValueL(aAttributes, KErrorUrl);
       
    75             break;
       
    76         }
       
    77     }
       
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 // TLeaveDomainRespParser::?member_function
       
    81 // ?implementation_description
       
    82 // (other items were commented in a header).
       
    83 // -----------------------------------------------------------------------------
       
    84 //
       
    85 void TLeaveDomainRespParser::OnEndElementL(
       
    86     CRoapParser& aParser,
       
    87     TInt aState,
       
    88     const RTagInfo& /*aElement*/)
       
    89     {
       
    90     if (!aParser.iContent)
       
    91         {
       
    92         return;
       
    93         }
       
    94         
       
    95     switch (aState)
       
    96         {
       
    97         case EDomainIdState:
       
    98             iResponse->iDomainId = aParser.iContent->AllocL();
       
    99             break;
       
   100         }
       
   101     }
       
   102 
       
   103 //  End of File