filemanager/src/fmbkupengine/inc/CMMCScBkupDriveDataSizeManager.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 CMMCScBkupDriveSizer
       
    15 *     
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef __CMMCSCBKUPDRIVEDATASIZEMANAGER_H__
       
    20 #define __CMMCSCBKUPDRIVEDATASIZEMANAGER_H__
       
    21 
       
    22 // System includes
       
    23 #include <s32strm.h>
       
    24 #include <f32file.h>
       
    25 
       
    26 // User includes
       
    27 #include "TMMCScBkupDriveAndSize.h"
       
    28 #include "RMMCScBkupPointerArray.h"
       
    29 #include "TMMCScBkupOwnerDataType.h"
       
    30 
       
    31 
       
    32 /**
       
    33 *
       
    34 * @since 3.0
       
    35 */
       
    36 NONSHARABLE_CLASS(CMMCScBkupDriveSizer) : public CBase
       
    37     {
       
    38     public:
       
    39 
       
    40         /**
       
    41         * 
       
    42         */
       
    43         static CMMCScBkupDriveSizer* NewLC( TMMCScBkupOwnerDataType aType );
       
    44 
       
    45         /**
       
    46         * 
       
    47         */
       
    48         static CMMCScBkupDriveSizer* NewLC( RReadStream& aStream );
       
    49 
       
    50         /**
       
    51         * C++ destructor
       
    52         */
       
    53         ~CMMCScBkupDriveSizer();
       
    54 
       
    55     private:
       
    56 
       
    57         /**
       
    58         * C++ constructor
       
    59         */
       
    60         CMMCScBkupDriveSizer( TMMCScBkupOwnerDataType aType );
       
    61 
       
    62         /**
       
    63         * 
       
    64         */
       
    65         void ConstructL();
       
    66 
       
    67     public: // API
       
    68 
       
    69         /**
       
    70         *
       
    71         */
       
    72         inline TMMCScBkupOwnerDataType DataType() const { return iDataType; }
       
    73 
       
    74         /**
       
    75         *
       
    76         */
       
    77         void AddToSizeL( TInt64 aAmount, TDriveNumber aDrive );
       
    78 
       
    79         /**
       
    80         *
       
    81         */
       
    82         void Reset();
       
    83 
       
    84         /**
       
    85         *
       
    86         */
       
    87         void Reset( TDriveNumber aDrive );
       
    88 
       
    89         /**
       
    90         *
       
    91         */
       
    92         TInt64 Size() const;
       
    93 
       
    94         /**
       
    95         *
       
    96         */
       
    97         TInt64 Size( TDriveNumber aDrive ) const;
       
    98 
       
    99     public:
       
   100 
       
   101         /**
       
   102         * Internalize object from stream
       
   103         */
       
   104         void InternalizeL( RReadStream& aStream );
       
   105 
       
   106         /**
       
   107         * Externalize object to stream
       
   108         */
       
   109         void ExternalizeL( RWriteStream& aStream ) const;
       
   110 
       
   111     private: // Internal methods
       
   112 
       
   113         /**
       
   114         *
       
   115         */
       
   116         TMMCScBkupDriveAndSize* EntryByDrive( TDriveNumber aDrive );
       
   117 
       
   118     private: // Internal enumerations
       
   119         enum
       
   120             {
       
   121             EStreamFormatVersion1 = 1
       
   122             };
       
   123 
       
   124     private: // Data members
       
   125 
       
   126         //
       
   127         RArray<TMMCScBkupDriveAndSize> iEntries;
       
   128         //
       
   129         TMMCScBkupOwnerDataType iDataType;
       
   130     };
       
   131 
       
   132 
       
   133 
       
   134 
       
   135 
       
   136 
       
   137 /**
       
   138 *
       
   139 * @since 3.0
       
   140 */
       
   141 NONSHARABLE_CLASS(CMMCScBkupDataTypeSizer) : public CBase
       
   142     {
       
   143     public:
       
   144 
       
   145         /**
       
   146         * 
       
   147         */
       
   148         static CMMCScBkupDataTypeSizer* NewL();
       
   149         
       
   150         /**
       
   151         * 
       
   152         */
       
   153         static CMMCScBkupDataTypeSizer* NewLC( RReadStream& aStream );
       
   154 
       
   155         /**
       
   156         * C++ destructor
       
   157         */
       
   158         ~CMMCScBkupDataTypeSizer();
       
   159 
       
   160     private:
       
   161 
       
   162         /**
       
   163         * C++ constructor
       
   164         */
       
   165         CMMCScBkupDataTypeSizer();
       
   166 
       
   167         /**
       
   168         * 
       
   169         */
       
   170         void ConstructL();
       
   171 
       
   172     public: // API
       
   173 
       
   174         /**
       
   175         *
       
   176         */
       
   177         void AddToSizeL( TMMCScBkupOwnerDataType aDataType, TInt64 aAmount, TDriveNumber aDrive );
       
   178 
       
   179         /**
       
   180         *
       
   181         */
       
   182         void Reset( TMMCScBkupOwnerDataType aDataType );
       
   183 
       
   184         /**
       
   185         *
       
   186         */
       
   187         void Reset( TMMCScBkupOwnerDataType aDataType, TDriveNumber aDrive );
       
   188 
       
   189         /**
       
   190         *
       
   191         */
       
   192         TInt64 Size( TMMCScBkupOwnerDataType aDataType ) const;
       
   193 
       
   194         /**
       
   195         *
       
   196         */
       
   197         TInt64 Size( TMMCScBkupOwnerDataType aDataType, TDriveNumber aDrive ) const;
       
   198 
       
   199         /**
       
   200         *
       
   201         */
       
   202         void GetSizesL( RArray<TMMCScBkupDriveAndSize>& aSizes ) const;
       
   203 
       
   204         /**
       
   205         *
       
   206         */
       
   207         TInt64 CombinedSize( TDriveNumber aDrive ) const;
       
   208 
       
   209     public:
       
   210 
       
   211         /**
       
   212         * Internalize object from stream
       
   213         */
       
   214         void InternalizeL( RReadStream& aStream );
       
   215 
       
   216         /**
       
   217         * Externalize object to stream
       
   218         */
       
   219         void ExternalizeL( RWriteStream& aStream ) const;
       
   220 
       
   221     private: // Internal methods
       
   222 
       
   223         /**
       
   224         *
       
   225         */
       
   226         CMMCScBkupDriveSizer* SizerByDataType( TMMCScBkupOwnerDataType aDataType );
       
   227 
       
   228     private: // Internal enumerations
       
   229         enum
       
   230             {
       
   231             EStreamFormatVersion1 = 1
       
   232             };
       
   233 
       
   234     private: // Data members
       
   235 
       
   236         //
       
   237         RMMCScBkupPointerArray<CMMCScBkupDriveSizer> iSizers;
       
   238     };
       
   239 
       
   240 
       
   241 
       
   242 
       
   243 
       
   244 
       
   245 #endif // __CMMCSCBKUPDRIVEDATASIZEMANAGER_H__
       
   246 
       
   247 //End of File