phonebookengines/contactsmodel/cntplsql/inc/cntpersistenceutility.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /**
       
     2 * Copyright (c) 2007-2009 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:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 /**
       
    21  @file
       
    22  @internalComponent
       
    23  @released
       
    24 */
       
    25 
       
    26 #ifndef __PERSISTENCEUTILITY_H__
       
    27 #define __PERSISTENCEUTILITY_H__
       
    28 
       
    29 #include <cntitem.h>
       
    30 #include <sqldb.h>
       
    31 
       
    32 NONSHARABLE_CLASS(TCntPersistenceUtility)
       
    33 	{
       
    34 public:
       
    35 	static void ReadBlobL(CContactItem& aItem, const CContactItemViewDef& aView, const CContactItem* aTemplate, RSqlDatabase& aDatabase);
       
    36 	static void ReadTextBlobL(CEmbeddedStore& aTextHeaderStore, TPtrC& aTextValues, CContactItem& aItem, const CContactItemViewDef& aView, const CContactItem* aTemplate);
       
    37 	static void ReadBinaryBlobL(CEmbeddedStore& aBinaryHeaderStore, CEmbeddedStore& aBinaryBlobStore, CContactItem& aItem, const CContactItemViewDef& aView, const CContactItem* aTemplate);
       
    38 	static void WriteBlobL(CEmbeddedStore& aTextEmbeddedStore, RWriteStream& aTextValues, CEmbeddedStore& aBinaryEmbeddedStore, CEmbeddedStore& aBinaryEmbeddedBlobStore, const CContactItem& aItem, const CContactTemplate* aSysTemplate);
       
    39 
       
    40     static void ReadTextBlobL(RReadStream& aHeaderStream, const HBufC* aTextBuffer, const CContactTextDef& aTextDef, const CContactTemplate& aSystemTemplate, RPointerArray<CContactItemField>& aFields, TBool& aSearchFastAccessFields);	
       
    41 	            
       
    42 	static TBool FindTxtFieldInTextBlobL(RReadStream& aHeaderStream, HBufC* aTextFieldsBuf, const CContactTemplate& aSystemTemplate, const TFieldType& aFieldType, TDes& aText);
       
    43 	
       
    44 	static TBool CopyMinFieldText(TPtrC aSrc,TDes& aDest);
       
    45 	static TBool IsFastAccessField(TFieldType aFieldType);	
       
    46 	
       
    47 	static const TDesC& GetFastAccessColumnNameById(TInt32 aFieldUid);
       
    48 	static void  ResetAndDestroyRPointerArray(TAny *aArray);
       
    49 	
       
    50 	//Functions for type flags
       
    51 	static TInt  TypeFlagsToHint(TInt aTypeFlags);
       
    52 	static TUid  TypeFlagsToContactTypeUid(TInt aTypeFlags);
       
    53     static TInt  ContactTypeUidToTypeFlags(TUid aContactTypeUid);
       
    54 
       
    55 private:
       
    56 	static void ReadTextBlobL(CContactItem& aItem, const CContactItemViewDef& aView, const CContactItem* aTemplate, RSqlDatabase& aDatabase);
       
    57 	static void ReadBinaryBlobL(CContactItem& aItem, const CContactItemViewDef& aView, const CContactItem* aTemplate, RSqlDatabase& aDatabase);
       
    58 	
       
    59 	static HBufC* LoadTextStreamLC(RReadStream& aStream);
       
    60 	static void RestoreTextL(CContactItemFieldSet& aFieldSet, CStreamStore& aHeaderStore, TStreamId aId, HBufC* textStream, const CContactItemViewDef& aViewDef, const CContactItem* aTemplate);
       
    61 	static void RestoreBinaryL(CContactItemFieldSet& aFieldSet, CStreamStore& aHeaderStore, TStreamId aId, CStreamStore* aBlobStore, const CContactItemViewDef& aViewDef, const CContactItem* aTemplate);
       
    62 	};
       
    63 
       
    64 #endif