installationservices/swi/source/sisfile/sisinstallblock.cpp
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2004-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 the License "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: 
       
    15 * Definition of the Swi::Sis::CInstallBlock
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 /**
       
    21  @file sisinstallblock.cpp
       
    22 */
       
    23 
       
    24 #include "sisinstallblock.h"
       
    25 
       
    26 using namespace Swi::Sis;
       
    27 
       
    28 EXPORT_C /*static*/ CInstallBlock* CInstallBlock::NewLC(MSisDataProvider& aDataProvider, TInt64& aBytesRead, TReadTypeBehaviour aTypeReadBehaviour)
       
    29 	{
       
    30 	CInstallBlock* self = new(ELeave) CInstallBlock();
       
    31 	CleanupStack::PushL(self);
       
    32 	self->ConstructL(aDataProvider, aBytesRead, aTypeReadBehaviour);
       
    33 	return self;
       
    34 	}
       
    35 
       
    36 EXPORT_C /*static*/ CInstallBlock* CInstallBlock::NewL(MSisDataProvider& aDataProvider, TInt64& aBytesRead, TReadTypeBehaviour aTypeReadBehaviour)
       
    37 	{
       
    38 	CInstallBlock* self = NewLC(aDataProvider, aBytesRead, aTypeReadBehaviour);
       
    39 	CleanupStack::Pop(self);
       
    40 	return self;
       
    41 	}
       
    42 	
       
    43 EXPORT_C CInstallBlock* CInstallBlock::NewLC(TPtrProvider& aDataProvider, TInt64& aBytesRead, TReadTypeBehaviour aTypeReadBehaviour)
       
    44 	{
       
    45 	CInstallBlock* self = new (ELeave) CInstallBlock;
       
    46 	CleanupStack::PushL(self);
       
    47 	self->ConstructL(aDataProvider, aBytesRead, aTypeReadBehaviour);
       
    48 	return self;
       
    49 	}
       
    50 
       
    51 EXPORT_C CInstallBlock* CInstallBlock::NewL(TPtrProvider& aDataProvider, TInt64& aBytesRead, TReadTypeBehaviour aTypeReadBehaviour)
       
    52 	{
       
    53 	CInstallBlock* self = CInstallBlock::NewLC(aDataProvider, aBytesRead, aTypeReadBehaviour);
       
    54 	CleanupStack::Pop(self);
       
    55 	return self;
       
    56 	}
       
    57 
       
    58 CInstallBlock::CInstallBlock()
       
    59 	{
       
    60 	}
       
    61 
       
    62 EXPORT_C CInstallBlock::~CInstallBlock()
       
    63 	{
       
    64 	iFileDescriptions.ResetAndDestroy();
       
    65 	iEmbeddedControllers.ResetAndDestroy();
       
    66 	iIfStatements.ResetAndDestroy();
       
    67 	}
       
    68 
       
    69 void CInstallBlock::ConstructL(MSisDataProvider& aDataProvider, TInt64& aBytesRead, TReadTypeBehaviour aTypeReadBehaviour)
       
    70 	{
       
    71 	TInt64 fieldOffset = aBytesRead;
       
    72 	
       
    73 	CField::ConstructL(aDataProvider, EFieldTypeInstallBlock, aBytesRead, aTypeReadBehaviour);
       
    74 
       
    75 	ReadMemberArrayL(aDataProvider, iFileDescriptions, EFieldTypeFileDescription, aBytesRead);
       
    76 
       
    77 	ReadMemberArrayL(aDataProvider, iEmbeddedControllers, EFieldTypeController, aBytesRead);
       
    78 
       
    79 	ReadMemberArrayL(aDataProvider, iIfStatements, EFieldTypeIf, aBytesRead);
       
    80 	
       
    81 	CField::SkipUnknownFieldsL(aDataProvider, aBytesRead - fieldOffset, aBytesRead, aTypeReadBehaviour);
       
    82 	CField::EnsureAlignedL(aDataProvider, aBytesRead - fieldOffset, aBytesRead, aTypeReadBehaviour);	
       
    83 	}
       
    84 
       
    85 void CInstallBlock::ConstructL(TPtrProvider& aDataProvider, TInt64& aBytesRead, TReadTypeBehaviour aTypeReadBehaviour)
       
    86 	{
       
    87 	TInt64 fieldOffset = aBytesRead;
       
    88 	
       
    89 	CField::ConstructL(aDataProvider, EFieldTypeInstallBlock, aBytesRead, aTypeReadBehaviour);
       
    90 
       
    91 	ReadMemberArrayL(aDataProvider, iFileDescriptions, EFieldTypeFileDescription, aBytesRead);
       
    92 
       
    93 	ReadMemberArrayL(aDataProvider, iEmbeddedControllers, EFieldTypeController, aBytesRead);
       
    94 
       
    95 	ReadMemberArrayL(aDataProvider, iIfStatements, EFieldTypeIf, aBytesRead);
       
    96 	
       
    97 	CField::SkipUnknownFieldsL(aDataProvider, aBytesRead - fieldOffset, aBytesRead, aTypeReadBehaviour);
       
    98 	CField::EnsureAlignedL(aDataProvider, aBytesRead - fieldOffset, aBytesRead, aTypeReadBehaviour);	
       
    99 	}