iaupdate/IAD/engine/controller/src/iaupdateplatformversionroofxmlparser.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 "iaupdateplatformversionroofxmlparser.h"
       
    25 #include "iaupdateplatformdependency.h"
       
    26 #include "iaupdateprotocolconsts.h"
       
    27 
       
    28 
       
    29 CIAUpdatePlatformVersionRoofXmlParser* CIAUpdatePlatformVersionRoofXmlParser::NewL( 
       
    30                                               CIAUpdatePlatformDependency& aDependency )
       
    31     {
       
    32     CIAUpdatePlatformVersionRoofXmlParser* self =
       
    33         CIAUpdatePlatformVersionRoofXmlParser::NewLC( aDependency );
       
    34     CleanupStack::Pop( self );
       
    35     return self;
       
    36     }
       
    37 
       
    38 
       
    39 CIAUpdatePlatformVersionRoofXmlParser* CIAUpdatePlatformVersionRoofXmlParser::NewLC( 
       
    40                                               CIAUpdatePlatformDependency& aDependency )
       
    41     {
       
    42     CIAUpdatePlatformVersionRoofXmlParser* self =
       
    43         new( ELeave ) CIAUpdatePlatformVersionRoofXmlParser( aDependency );
       
    44     CleanupStack::PushL( self );
       
    45     self->ConstructL();
       
    46     return self;    
       
    47     }
       
    48 
       
    49 
       
    50 CIAUpdatePlatformVersionRoofXmlParser::CIAUpdatePlatformVersionRoofXmlParser( 
       
    51                                               CIAUpdatePlatformDependency& aDependency )
       
    52 : CIAUpdatePlatformVersionXmlParser( aDependency )
       
    53     {
       
    54     Version().SetToRoof();
       
    55     }
       
    56     
       
    57     
       
    58 void CIAUpdatePlatformVersionRoofXmlParser::ConstructL()
       
    59     {
       
    60     CIAUpdatePlatformVersionXmlParser::ConstructL( 
       
    61                                         IAUpdateProtocolConsts::KPlatformVersionTo() );    
       
    62     }
       
    63 
       
    64 
       
    65 CIAUpdatePlatformVersionRoofXmlParser::~CIAUpdatePlatformVersionRoofXmlParser()
       
    66     {
       
    67     }
       
    68 
       
    69 
       
    70 void CIAUpdatePlatformVersionRoofXmlParser::OnStartElementL( 
       
    71                                               const Xml::RTagInfo& aElement, 
       
    72                                               const Xml::RAttributeArray& aAttributes, 
       
    73                                               TInt aErrorCode )
       
    74     {
       
    75     // Let the parent do necessary initializations.
       
    76     CIAUpdatePlatformVersionXmlParser::OnStartElementL( aElement, aAttributes, aErrorCode );
       
    77 
       
    78     // If the element is for this element, then set the version information to roof
       
    79     // as default because this parser may be used multiple times. We do not want old
       
    80     // values be lef hanging.
       
    81     if ( AcceptData() )
       
    82         {
       
    83         Version().SetToRoof();
       
    84         }            
       
    85     }
       
    86 
       
    87 
       
    88 void CIAUpdatePlatformVersionRoofXmlParser::OnEndElementL( const Xml::RTagInfo& aElement, 
       
    89                                                            TInt aErrorCode )
       
    90     {
       
    91     // If the parent wants to do something with the information.
       
    92     CIAUpdatePlatformVersionXmlParser::OnEndElementL( aElement, aErrorCode );
       
    93 
       
    94     if ( IsElementEnded() )
       
    95         {
       
    96         // We have finished the parsing of this element.
       
    97         // Now, set the version information to the dependency object.
       
    98         Dependency().SetVersionRoof( Version() );
       
    99         }
       
   100     }