filemanager/src/fmbkupengine/inc/CMMCScBkupOperationParameters.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 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 for CMMCScBkupOpParamsBase
       
    15 *     
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef __CMMCSCBKUPOPERATIONPARAMETERS_H__
       
    20 #define __CMMCSCBKUPOPERATIONPARAMETERS_H__
       
    21 
       
    22 // System includes
       
    23 #include <connect/sbdefs.h>
       
    24 #include <connect/sbtypes.h>
       
    25 #include <barsread.h>
       
    26 #include <babitflags.h>
       
    27 
       
    28 // User includes
       
    29 #include "MMCScBkupOperations.h"
       
    30 #include "CMMCScBkupDataOwnerInfo.h"
       
    31 #include "RMMCScBkupPointerArray.h"
       
    32 
       
    33 // Namespaces
       
    34 using namespace conn;
       
    35 
       
    36 // Classes referenced
       
    37 class CMMCScBkupDriveAndOperationTypeManager;
       
    38 class CMMCScBkupArchiveInfo;
       
    39 
       
    40 _LIT( KBackUpFolder, "\\Backup\\" );
       
    41 _LIT( KBackUpFiles, "*.arc" );
       
    42 const TInt KCArrayGranularity = 10;
       
    43 
       
    44 class TBkupDrivesAndOperation
       
    45 {
       
    46 public:
       
    47 	TBkupDrivesAndOperation(){}
       
    48 	TBkupDrivesAndOperation( unsigned int drvCategories, unsigned int ownerDataType );
       
    49 	TBkupDrivesAndOperation( const TBkupDrivesAndOperation &other )
       
    50     { 
       
    51         mDrvCategories  = other.mDrvCategories;
       
    52         mOwnerDataType  = other.mOwnerDataType;
       
    53     }
       
    54 
       
    55     void setDrvCategories( unsigned int drvCategories ){ mDrvCategories = drvCategories; }
       
    56     void setOwnerDataType( unsigned int ownerDataType ){ mOwnerDataType = ownerDataType; }
       
    57 
       
    58     unsigned int drvCategories(){ return mDrvCategories; }
       
    59     unsigned int ownerDataType(){ return mOwnerDataType; }
       
    60 private:
       
    61     unsigned int mDrvCategories;
       
    62     unsigned int mOwnerDataType;
       
    63 };
       
    64 
       
    65 class CBkupCategory: CBase
       
    66 {
       
    67 private:
       
    68       
       
    69 	CBkupCategory()
       
    70 	{
       
    71 	}
       
    72 public:
       
    73 	
       
    74 	static CBkupCategory* NewL()
       
    75 	{
       
    76 	CBkupCategory* self = NewLC();
       
    77 		CleanupStack::Pop(self);
       
    78 		return self;
       
    79 	}
       
    80 	static CBkupCategory* NewLC()
       
    81 	{
       
    82 	    CBkupCategory* self = new(ELeave) CBkupCategory();
       
    83 		CleanupStack::PushL(self);
       
    84 		self->ConstructL();
       
    85 		return self;
       
    86 	}
       
    87 	void ConstructL()
       
    88 	    {
       
    89 	    mUids = new ( ELeave ) CArrayFixFlat<unsigned int>( KCArrayGranularity );
       
    90 	    mExclude_uids = new ( ELeave ) CArrayFixFlat<unsigned int>( KCArrayGranularity );
       
    91 	    mArchive_name = 0;
       
    92 	    }
       
    93 	
       
    94     ~CBkupCategory()
       
    95     {
       
    96         mUids->Reset();
       
    97         mExclude_uids->Reset();
       
    98         delete mArchive_name;
       
    99     }
       
   100 
       
   101     void setCategory( unsigned int category )
       
   102     {
       
   103         mCategory = category;
       
   104     }
       
   105 
       
   106     void setArchive_name( TDesC16& archive_name )
       
   107     {
       
   108         if ( mArchive_name != 0 )
       
   109             {
       
   110             delete mArchive_name;            
       
   111             }		
       
   112         TRAP_IGNORE( mArchive_name = HBufC::NewL( archive_name.Length() ) );
       
   113         *mArchive_name = archive_name;
       
   114     }
       
   115 
       
   116     void setSpecial_flags( unsigned int special_flags )
       
   117     {
       
   118         mSpecial_flags = special_flags;
       
   119     }
       
   120 
       
   121     void setExclude_special_flags( unsigned int exclude_special_flags )
       
   122     { 
       
   123         mExclude_special_flags = exclude_special_flags; 
       
   124     }
       
   125 
       
   126     void addUids( unsigned int uid )
       
   127     {
       
   128         TRAP_IGNORE( mUids->AppendL( uid, sizeof(unsigned int) ) );
       
   129     }
       
   130 
       
   131     void addExclude_uids( unsigned int exclude_uid )
       
   132     {
       
   133         TRAP_IGNORE( mExclude_uids->AppendL( exclude_uid, sizeof(unsigned int) ) ); 
       
   134     }
       
   135 
       
   136     unsigned int        category()              { return mCategory; }
       
   137     HBufC*              archive_name()         { return mArchive_name; }
       
   138     unsigned int        special_flags()         { return mSpecial_flags; }
       
   139     unsigned int        exclude_special_flags() { return mExclude_special_flags; }
       
   140     CArrayFixFlat<unsigned int>* uids()         { return mUids; }
       
   141     CArrayFixFlat<unsigned int>* exclude_uids() { return mExclude_uids; }
       
   142 
       
   143 private:
       
   144     unsigned int                     mCategory;
       
   145     HBufC*                           mArchive_name;
       
   146     unsigned int                     mSpecial_flags;
       
   147     unsigned int                     mExclude_special_flags;
       
   148     CArrayFixFlat<unsigned int>*     mUids;
       
   149     CArrayFixFlat<unsigned int>*     mExclude_uids;
       
   150 };
       
   151 
       
   152 typedef CArrayFixFlat<TBkupDrivesAndOperation> BkupDrivesAndOperationList;
       
   153 typedef RPointerArray<CBkupCategory>          BkupCategoryList;
       
   154 
       
   155 /**
       
   156 *
       
   157 *
       
   158 * @since 3.0
       
   159 */
       
   160 NONSHARABLE_CLASS(CMMCScBkupOpParamsBase) : public CBase
       
   161     {
       
   162     public:
       
   163 
       
   164         /**
       
   165         *
       
   166         */
       
   167         IMPORT_C ~CMMCScBkupOpParamsBase();
       
   168 
       
   169     protected:
       
   170 
       
   171         /**
       
   172         *
       
   173         */
       
   174         CMMCScBkupOpParamsBase( );
       
   175 
       
   176         /**
       
   177         *
       
   178         */
       
   179         void ConstructL( BkupDrivesAndOperationList *aDriveList, TBitFlags aCategories );
       
   180 
       
   181     public: // Common mandatory framework methods
       
   182 
       
   183         /**
       
   184         *
       
   185         */
       
   186         virtual TMMCScBkupOperationType AssociatedOpType() const = 0;
       
   187 
       
   188         /**
       
   189         *
       
   190         */
       
   191         virtual TBURPartType PartType() const = 0;
       
   192 
       
   193         /**
       
   194         *
       
   195         */
       
   196         virtual TBackupIncType IncrementType() const = 0;
       
   197 
       
   198         /**
       
   199         *
       
   200         */
       
   201         virtual TTransferDataType PassiveTransferType() const = 0;
       
   202 
       
   203         /**
       
   204         *
       
   205         */
       
   206         virtual TTransferDataType ActiveTransferType() const = 0;
       
   207 
       
   208         /**
       
   209         *
       
   210         */
       
   211         virtual TPackageDataType PackageTransferType() const = 0;
       
   212 
       
   213     public: // Common attributes
       
   214 
       
   215         /**
       
   216         *
       
   217         */
       
   218         IMPORT_C const CMMCScBkupDriveAndOperationTypeManager& DriveAndOperations() const;
       
   219         
       
   220         /**
       
   221         *
       
   222         */
       
   223         IMPORT_C void SetArchiveInfosL(RPointerArray<CMMCScBkupArchiveInfo>& aInfos);
       
   224         
       
   225         /**
       
   226         *
       
   227         */
       
   228         RMMCScBkupPointerArray<CMMCScBkupArchiveInfo>& ArchiveInfos();
       
   229         
       
   230         /**
       
   231         *
       
   232         */
       
   233         const CMMCScBkupArchiveInfo& ArchiveInfo(TBitFlags aCategory) const;
       
   234 
       
   235         /**
       
   236         *
       
   237         */
       
   238         const TDesC& FileName(TInt aIndex) const;
       
   239 
       
   240         /**
       
   241         *
       
   242         */
       
   243         TBitFlags Categories() { return iCategories; }
       
   244         
       
   245     private: // Data members
       
   246 
       
   247         //
       
   248         CMMCScBkupDriveAndOperationTypeManager* iDriveAndOperations;
       
   249         //
       
   250         RMMCScBkupPointerArray< CMMCScBkupArchiveInfo > iArchiveInfos;
       
   251         //
       
   252         TBitFlags iCategories;
       
   253     };
       
   254 
       
   255 
       
   256 
       
   257 /**
       
   258 *
       
   259 *
       
   260 * @since 3.0
       
   261 */
       
   262 NONSHARABLE_CLASS(CMMCScBkupOpParamsBackupFull) : public CMMCScBkupOpParamsBase
       
   263     {
       
   264     public:
       
   265 
       
   266         /**
       
   267         *
       
   268         */
       
   269         IMPORT_C static CMMCScBkupOpParamsBackupFull* NewL( 
       
   270         		BkupDrivesAndOperationList *aDriveList, 
       
   271         		BkupCategoryList *aCategoryList,
       
   272             TDriveNumber aDrive, TBitFlags aCategories );
       
   273 
       
   274         /**
       
   275         *
       
   276         */
       
   277         IMPORT_C ~CMMCScBkupOpParamsBackupFull();
       
   278 
       
   279     private:
       
   280 
       
   281         /**
       
   282         *
       
   283         */
       
   284         CMMCScBkupOpParamsBackupFull( TDriveNumber aDrive );
       
   285 
       
   286         /**
       
   287         *
       
   288         */
       
   289         void ConstructL( BkupDrivesAndOperationList *aDriveList, 
       
   290         		BkupCategoryList *aCategoryList, TBitFlags aCategories );
       
   291 
       
   292         /**
       
   293         *
       
   294         */
       
   295         void ReadFromResourceL( BkupCategoryList *aCategoryList );
       
   296         
       
   297     public: // From CMMCScBkupOpParamsBase
       
   298         IMPORT_C TMMCScBkupOperationType AssociatedOpType() const;
       
   299         IMPORT_C TBURPartType PartType() const;
       
   300         IMPORT_C TBackupIncType IncrementType() const;
       
   301         IMPORT_C TTransferDataType PassiveTransferType() const;
       
   302         IMPORT_C TTransferDataType ActiveTransferType() const;
       
   303         IMPORT_C TPackageDataType PackageTransferType() const;
       
   304 
       
   305     private: // Data members
       
   306 
       
   307         //
       
   308         TDriveNumber iDrive;
       
   309     };
       
   310 
       
   311 
       
   312 
       
   313 
       
   314 /**
       
   315 *
       
   316 *
       
   317 * @since 3.0
       
   318 */
       
   319 NONSHARABLE_CLASS(CMMCScBkupOpParamsRestoreFull) : public CMMCScBkupOpParamsBase
       
   320     {
       
   321     public:
       
   322 
       
   323         /**
       
   324         *
       
   325         */
       
   326         IMPORT_C static CMMCScBkupOpParamsRestoreFull* NewL( 
       
   327         		BkupDrivesAndOperationList *aDriveList, TBitFlags aCategories );
       
   328 
       
   329         /**
       
   330         *
       
   331         */
       
   332         IMPORT_C ~CMMCScBkupOpParamsRestoreFull();
       
   333 
       
   334     private:
       
   335 
       
   336         /**
       
   337         *
       
   338         */
       
   339         CMMCScBkupOpParamsRestoreFull();
       
   340 
       
   341     public: // From CMMCScBkupOpParamsBase
       
   342         IMPORT_C TMMCScBkupOperationType AssociatedOpType() const;
       
   343         IMPORT_C TBURPartType PartType() const;
       
   344         IMPORT_C TBackupIncType IncrementType() const;
       
   345         IMPORT_C TTransferDataType PassiveTransferType() const;
       
   346         IMPORT_C TTransferDataType ActiveTransferType() const;
       
   347         IMPORT_C TPackageDataType PackageTransferType() const;
       
   348     };
       
   349 
       
   350 
       
   351 
       
   352 
       
   353 
       
   354 #endif // __CMMCSCBKUPOPERATIONPARAMETERS_H__
       
   355 
       
   356 //End of File