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