filemanager/src/fmbkupengine/inc/CMMCScBkupDataOwnerCollection.h
branchRCL_3
changeset 21 65326cf895ed
parent 20 491b3ed49290
child 22 f5c50b8af68c
equal deleted inserted replaced
20:491b3ed49290 21:65326cf895ed
     1 /*
       
     2 * Copyright (c) 2005-2008 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: Declaration of CMMCScBkupDataOwnerCollection
       
    15 *     
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef __CMMCSCBKUPDATAOWNERCOLLECTION_H__
       
    20 #define __CMMCSCBKUPDATAOWNERCOLLECTION_H__
       
    21 
       
    22 // System includes
       
    23 #include <connect/sbtypes.h>
       
    24 #include <s32strm.h>
       
    25 #include <babitflags.h>
       
    26 #include <bldvariant.hrh>
       
    27 
       
    28 // User includes
       
    29 #include "RMMCScBkupPointerArray.h"
       
    30 
       
    31 // Namespaces
       
    32 using namespace conn;
       
    33 
       
    34 // Classes referenced
       
    35 class MMMCScBkupDriver;
       
    36 class CMMCScBkupDriveSizer;
       
    37 class CMMCScBkupDataOwnerInfo;
       
    38 
       
    39 #ifndef RD_FILE_MANAGER_BACKUP
       
    40 // Type definitions
       
    41 typedef RPointerArray<CDataOwnerInfo> RDataOwnerInfoArray;
       
    42 #endif
       
    43 
       
    44 /**
       
    45 *
       
    46 *
       
    47 * @since 3.0
       
    48 */
       
    49 NONSHARABLE_CLASS(CMMCScBkupDataOwnerCollection) : public CBase
       
    50     {
       
    51     public:
       
    52 
       
    53         /**
       
    54         * Static constructor
       
    55         */
       
    56         static CMMCScBkupDataOwnerCollection* NewL( MMMCScBkupDriver& aDriver, TBitFlags aCategory );
       
    57 
       
    58         /**
       
    59         * C++ destructor
       
    60         */
       
    61         ~CMMCScBkupDataOwnerCollection();
       
    62 
       
    63     private:
       
    64 
       
    65         /**
       
    66         * C++ default constructor
       
    67         */
       
    68         CMMCScBkupDataOwnerCollection( MMMCScBkupDriver& aDriver, TBitFlags aCategory );
       
    69 
       
    70         /**
       
    71         *
       
    72         */
       
    73         void ConstructL();
       
    74 
       
    75     public: // API
       
    76 
       
    77         /**
       
    78         *
       
    79         */
       
    80 #ifdef RD_FILE_MANAGER_BACKUP
       
    81         TBool AssignL( const CMMCScBkupDataOwnerInfo& dataOwnersInfo );
       
    82 #else
       
    83         void AssignL( RDataOwnerInfoArray& aArray );
       
    84 #endif
       
    85 
       
    86         /**
       
    87         *
       
    88         */
       
    89         void AppendL( CMMCScBkupDataOwnerInfo* aNewEntry );
       
    90 
       
    91         /**
       
    92         *
       
    93         */
       
    94         TInt Count() const;
       
    95 
       
    96         /**
       
    97         *
       
    98         */
       
    99         CMMCScBkupDataOwnerInfo& Owner( TInt aIndex );
       
   100 
       
   101         /**
       
   102         *
       
   103         */
       
   104         const CMMCScBkupDataOwnerInfo& Owner( TInt aIndex ) const;
       
   105 
       
   106         /**
       
   107         *
       
   108         */
       
   109         CMMCScBkupDataOwnerInfo& OwnerL( TSecureId aSID );
       
   110 
       
   111         /**
       
   112         *
       
   113         */
       
   114         const CMMCScBkupDataOwnerInfo& OwnerL( TSecureId aSID ) const;
       
   115 
       
   116         /**
       
   117         *
       
   118         */
       
   119         CMMCScBkupDataOwnerInfo& OwnerL( TUid aPackageId );
       
   120 
       
   121         /**
       
   122         *
       
   123         */
       
   124         const CMMCScBkupDataOwnerInfo& OwnerL( TUid aPackageId ) const;
       
   125 
       
   126         /**
       
   127         *
       
   128         */
       
   129         CMMCScBkupDataOwnerInfo& OwnerL( const TDesC& aHash );
       
   130 
       
   131         /**
       
   132         *
       
   133         */
       
   134         const CMMCScBkupDataOwnerInfo& OwnerL( const TDesC& aHash ) const;
       
   135 
       
   136         /**
       
   137         *
       
   138         */
       
   139         void Remove( TInt aIndex );
       
   140 
       
   141         /**
       
   142         *
       
   143         */
       
   144         void Reset();
       
   145 
       
   146         /**
       
   147         * The amount of space required spanning all drives.
       
   148         * This is used as the total progress amount during
       
   149         * restore operations.
       
   150         */
       
   151         TInt64 TotalOperationalSizeL() const;
       
   152 
       
   153         /**
       
   154         * Whether one or more data owners require a reboot
       
   155         * after restore has completed.
       
   156         */
       
   157         TBool RebootRequired() const;
       
   158 
       
   159         /**
       
   160         * 
       
   161         */
       
   162         TInt64 DiskSpaceRequiredForRestore( TDriveNumber aDrive ) const;
       
   163 
       
   164         /**
       
   165         *
       
   166         */
       
   167         void CalculateDiskSpaceRequiredForRestoreL();
       
   168 
       
   169         /**
       
   170         *
       
   171         */
       
   172         TBitFlags Category() const { return iCategory; }
       
   173         
       
   174     public:
       
   175 
       
   176         /**
       
   177         * Internalize 'iRestoreSizer' from stream
       
   178         */
       
   179         void InternalizeL( RReadStream& aStream );
       
   180 
       
   181         /**
       
   182         * Externalize 'iRestoreSizer' to stream
       
   183         */
       
   184         void ExternalizeL( RWriteStream& aStream ) const;
       
   185 
       
   186     private:
       
   187         
       
   188 #ifdef RD_FILE_MANAGER_BACKUP
       
   189         /**
       
   190         *
       
   191         */
       
   192         TBool BelongsToL(const CMMCScBkupDataOwnerInfo& aInfo, TBitFlags aFlags, TBitFlags aExcludedFlags,
       
   193             const RArray<TSecureId> aSecureIds, const RArray<TSecureId> aExcludedSecureIds) const;
       
   194 #endif
       
   195     
       
   196     private: // Internal enumerations
       
   197         enum
       
   198             {
       
   199             EStreamFormatVersion1 = 1
       
   200             };
       
   201 
       
   202     private: // Member data
       
   203 
       
   204         //
       
   205         MMMCScBkupDriver& iDriver;
       
   206         // Array of data owners
       
   207         RMMCScBkupPointerArray<CMMCScBkupDataOwnerInfo> iOwners;
       
   208         //
       
   209         CMMCScBkupDriveSizer* iRestoreSizer;
       
   210         //
       
   211         TBitFlags iCategory;
       
   212     };
       
   213 
       
   214 
       
   215 
       
   216 
       
   217 #endif // __CMMCSCBKUPDATAOWNERCOLLECTION_H__
       
   218 
       
   219 //End of File