iaupdate/IAD/engine/controller/src/iaupdateversionmajorxmlparser.cpp
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2009 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 <xml/documentparameters.h>
       
    21 #include <xml/taginfo.h>
       
    22 #include <xml/attribute.h>
       
    23 
       
    24 #include "iaupdateversionmajorxmlparser.h"
       
    25 #include "iaupdateprotocolconsts.h"
       
    26 
       
    27 
       
    28 CIAUpdateVersionMajorXmlParser* CIAUpdateVersionMajorXmlParser::NewL( TIAUpdateVersion& aVersion )
       
    29     {
       
    30     CIAUpdateVersionMajorXmlParser* self =
       
    31         CIAUpdateVersionMajorXmlParser::NewLC( aVersion );
       
    32     CleanupStack::Pop( self );
       
    33     return self;
       
    34     }
       
    35 
       
    36 
       
    37 CIAUpdateVersionMajorXmlParser* CIAUpdateVersionMajorXmlParser::NewLC( TIAUpdateVersion& aVersion )
       
    38     {
       
    39     CIAUpdateVersionMajorXmlParser* self =
       
    40         new( ELeave ) CIAUpdateVersionMajorXmlParser( aVersion );
       
    41     CleanupStack::PushL( self );
       
    42     self->ConstructL();
       
    43     return self;    
       
    44     }
       
    45 
       
    46 
       
    47 CIAUpdateVersionMajorXmlParser::CIAUpdateVersionMajorXmlParser( TIAUpdateVersion& aVersion )
       
    48 : CIAUpdateXmlSubParser(),
       
    49   iVersion( aVersion )
       
    50     {
       
    51     
       
    52     }
       
    53     
       
    54     
       
    55 void CIAUpdateVersionMajorXmlParser::ConstructL()
       
    56     {
       
    57     CIAUpdateXmlSubParser::ConstructL( IAUpdateProtocolConsts::KVersionMajor() );    
       
    58     }
       
    59 
       
    60 
       
    61 CIAUpdateVersionMajorXmlParser::~CIAUpdateVersionMajorXmlParser()
       
    62     {
       
    63     }
       
    64 
       
    65 
       
    66 void CIAUpdateVersionMajorXmlParser::OnContentL( const TDesC8& aBytes, 
       
    67                                                  TInt aErrorCode )
       
    68     {
       
    69     // If the parent wants to do something with the information.
       
    70     CIAUpdateXmlSubParser::OnContentL( aBytes, aErrorCode );
       
    71 
       
    72     if ( AcceptData() )
       
    73         {
       
    74         // Because there is no current subparser set, this means
       
    75         // that this parser is the leaf parser at the moment.
       
    76 
       
    77         // We have gotten content for this element.
       
    78         // Now, set the platform information to the dependency object.
       
    79         TInt value( 0 );
       
    80         TLex8 lex( aBytes );
       
    81         // If aBytes value was corrputed, 
       
    82         // then just set the default value.
       
    83         lex.Val( value );
       
    84         Version().iMajor = value;
       
    85         }
       
    86     }
       
    87 
       
    88 
       
    89 TIAUpdateVersion& CIAUpdateVersionMajorXmlParser::Version()
       
    90     {
       
    91     return iVersion;
       
    92     }
       
    93