filemanager/src/fmbkupengine/inc/CMMCScBkupArchive.h
branchRCL_3
changeset 20 491b3ed49290
equal deleted inserted replaced
19:95243422089a 20:491b3ed49290
       
     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 CMMCScBkupArchive 
       
    15 *     
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef __CMMCSCBKUPARCHIVE_H__
       
    20 #define __CMMCSCBKUPARCHIVE_H__
       
    21 
       
    22 // System includes
       
    23 #include <f32file.h>
       
    24 #include <babitflags.h>
       
    25 
       
    26 // Classes referenced
       
    27 class MMMCScBkupDriver;
       
    28 class CMMCScBkupArchiveHeader;
       
    29 class CMMCScBkupArchiveFooter;
       
    30 class MMMCScBkupProgressObserver;
       
    31 class CMMCScBkupArchiveDataManager;
       
    32 class MMMCScBkupArchiveDataInterface;
       
    33 
       
    34 
       
    35 /**
       
    36 *
       
    37 *
       
    38 * @since 3.0
       
    39 */
       
    40 NONSHARABLE_CLASS(CMMCScBkupArchive) : public CBase
       
    41     {
       
    42     public:
       
    43 
       
    44         /**
       
    45         * Static constructor
       
    46         */
       
    47         static CMMCScBkupArchive* NewL( RFs& aFsSession, MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupDriver& aDriver, TBitFlags aCategory );
       
    48 
       
    49         /**
       
    50         * C++ destructor
       
    51         */
       
    52         ~CMMCScBkupArchive();
       
    53 
       
    54     private:
       
    55 
       
    56         /**
       
    57         * C++ default constructor
       
    58         */
       
    59         CMMCScBkupArchive( RFs& aFsSession, MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupDriver& aDriver, TBitFlags aCategory );
       
    60 
       
    61         /**
       
    62         *
       
    63         */
       
    64         void ConstructL();
       
    65 
       
    66     public: // API
       
    67 
       
    68         /**
       
    69         *
       
    70         */
       
    71         void OpenForReadingL(const TDesC& aName);
       
    72 
       
    73         /**
       
    74         *
       
    75         */
       
    76         void OpenForWritingL(const TDesC& aName);
       
    77         
       
    78         /**
       
    79         *
       
    80         */
       
    81         void RestoreOldArchive();
       
    82         
       
    83         /**
       
    84         *
       
    85         */
       
    86         void DeleteOldArchive();
       
    87 
       
    88         /**
       
    89         *
       
    90         */
       
    91         void Close( TInt aError );
       
    92 
       
    93         /**
       
    94         *
       
    95         */
       
    96         CMMCScBkupArchiveHeader& Header() const;
       
    97 
       
    98         /**
       
    99         *
       
   100         */
       
   101         CMMCScBkupArchiveFooter& Footer() const;
       
   102 
       
   103         /**
       
   104         *
       
   105         */
       
   106         MMMCScBkupArchiveDataInterface& ADI() const;
       
   107 
       
   108         /**
       
   109         *
       
   110         */
       
   111         static TBool ValidArchiveForRestoreL( RFs& aFsSession, const TDesC& aFileName );
       
   112         
       
   113         /**
       
   114         *
       
   115         */
       
   116         TBitFlags Category() const { return iCategory; }
       
   117 
       
   118     private: // Internal enumerations
       
   119 
       
   120         /**
       
   121         *
       
   122         */
       
   123         enum TMode
       
   124             {
       
   125             EModeUninitialised = 0,
       
   126             //
       
   127             EModeReading,
       
   128             EModeWriting
       
   129             };
       
   130 
       
   131     private: // Internal methods
       
   132        
       
   133         /**
       
   134         *
       
   135         */
       
   136         TInt PrepareToOverwrite( const TDesC& aFile );
       
   137 
       
   138         /**
       
   139         *
       
   140         */
       
   141         void SetMode(TMode aMode);
       
   142 
       
   143         /**
       
   144         *
       
   145         */
       
   146         void PrepareObjectsL();
       
   147         
       
   148         /**
       
   149         *
       
   150         */
       
   151         inline TMode Mode() const { return iMode; }
       
   152 
       
   153     private: // Member data
       
   154 
       
   155         //
       
   156         RFs& iFsSession;
       
   157         //
       
   158         RFile64 iArchiveFile;
       
   159         //
       
   160         MMMCScBkupProgressObserver& iProgressManager;
       
   161         //
       
   162         MMMCScBkupDriver& iDriver;
       
   163         //
       
   164         TMode iMode;
       
   165         //
       
   166         CMMCScBkupArchiveDataManager* iDataManager;
       
   167         //
       
   168         CMMCScBkupArchiveHeader* iHeader;
       
   169         //
       
   170         CMMCScBkupArchiveFooter* iFooter;
       
   171         //
       
   172         HBufC* iArchiveFileName;
       
   173         //
       
   174         HBufC* iOldArchiveFileName;
       
   175         //
       
   176         TBitFlags iCategory;
       
   177     };
       
   178 
       
   179 
       
   180 
       
   181 
       
   182 #endif // __CMMCSCBKUPARCHIVE_H__
       
   183 
       
   184 //End of File