mtpfws/mtpfw/inc/cmtpdeltadatamgr.h
changeset 0 d0791faffa3f
equal deleted inserted replaced
-1:000000000000 0:d0791faffa3f
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // cmtpdeltadatamgr.h
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @publishedPartner
       
    21  @released
       
    22 */
       
    23 
       
    24 
       
    25 #ifndef CMTPDELTADATAMGR_H
       
    26 #define CMTPDELTADATAMGR_H
       
    27 
       
    28 #include "mtpdebug.h"
       
    29 
       
    30 #include <e32base.h>
       
    31 #include <d32dbms.h>
       
    32 #include "dbutility.h"
       
    33 #include "mtpframeworkconst.h"
       
    34 #include <mtp/cmtptypearray.h>
       
    35 #include <mtp/tmtptypeuint128.h>
       
    36 class RDbDatabase;
       
    37 class TMTPTypeUint32;
       
    38 
       
    39 class CMtpDeltaDataMgr : public CBase
       
    40 {
       
    41 private:
       
    42     CMtpDeltaDataMgr (RDbDatabase& aDatabase);
       
    43     void ConstructL();
       
    44     
       
    45 
       
    46 public:    
       
    47     static CMtpDeltaDataMgr* NewL(RDbDatabase& aDatabase);
       
    48     ~CMtpDeltaDataMgr();
       
    49     /**
       
    50     The enumeration for operations on file .
       
    51     */
       
    52     enum TOpCode
       
    53     {
       
    54     EAdded=0,
       
    55     EDeleted=1,
       
    56     EModified=2,
       
    57     }; 
       
    58     
       
    59     /**
       
    60     updates the delta data table with the params , if the suid identifier param passesd is
       
    61     a not found in the table a new entry will be created with opcode as EAdded.
       
    62     */
       
    63     void UpdateDeltaDataTableL(TInt64 aSuidId, TOpCode aOpCode);
       
    64     
       
    65     IMPORT_C void CreateDeltaDataTableL();
       
    66     IMPORT_C void CreateAnchorIdTableL();
       
    67     IMPORT_C void InsertAnchorIdL(TInt aAnchorId, TInt aIdentifier);
       
    68     IMPORT_C void UpdateAnchorIdL(TInt aAnchorId, TInt aIdentifier);
       
    69     IMPORT_C TInt GetAnchorIdL(TInt aIdentifier);
       
    70     IMPORT_C void UpdatePersistentIndexL(TInt aCurindex, TInt aIdentifier);
       
    71     IMPORT_C TInt GetPersistentIndexL(TInt aIdentifier);
       
    72     
       
    73     IMPORT_C TInt GetAddedPuidsL(TInt aMaxArraySize, TInt &aPosition, CMTPTypeArray& aAddedPuidIdArray);
       
    74     IMPORT_C TInt GetDeletedPuidsL(TInt aMaxArraySize, TInt &aPosition, CMTPTypeArray& aDeletedPuidIdArray);
       
    75     IMPORT_C TInt GetModifiedPuidsL(TInt aMaxArraySize, TInt &aPosition, CMTPTypeArray& aModifiedPuidIdArray);
       
    76     IMPORT_C TInt GetChangedPuidsL(TInt aMaxArraySize, TInt &aPosition, CMTPTypeArray& aModifiedPuidIdArray, CMTPTypeArray& aDeletedPuidArray);    
       
    77     
       
    78     IMPORT_C void ResetMTPDeltaDataTableL();
       
    79 
       
    80 private: // Not owned
       
    81 
       
    82     RDbDatabase& iDatabase; 
       
    83     TBuf<KMTPMaxSqlStatementLen>    iSqlStatement;
       
    84     RArray <TMTPTypeUint128> iSuidIdArray;
       
    85    
       
    86     RDbView iView;
       
    87     TBool iNeedToSendMore;
       
    88     TInt iTotalRows;    
       
    89     RDbTable iDeltaTableBatched;
       
    90     RDbTable iAnchorTableBatched;
       
    91    /**
       
    92     FLOGGER debug trace member variable.
       
    93     */
       
    94     __FLOG_DECLARATION_MEMBER_MUTABLE;
       
    95 };
       
    96 
       
    97 #endif // CMTPDELTADATAMGR_H