syncmlfw/ds/hostserver/dshostclient/inc/nsmldsitemmodificationset.h
changeset 0 b497e44ab2fc
equal deleted inserted replaced
-1:000000000000 0:b497e44ab2fc
       
     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:  Utilities for DS Loader Framework
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __NSMLDSITEMMODIFICATIONSET_H__ 
       
    20 #define __NSMLDSITEMMODIFICATIONSET_H__
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <s32strm.h>
       
    25 #include <SyncMLDef.h>
       
    26 #include <SmlDataSyncDefs.h>
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class MSmlDataItemUidSet;
       
    30 
       
    31 // CLASS DECLARATION
       
    32 
       
    33 // ------------------------------------------------------------------------------------------------
       
    34 // TNSmlDbItemModification
       
    35 //
       
    36 // @lib nsmldshostclient.lib
       
    37 // ------------------------------------------------------------------------------------------------
       
    38 class TNSmlDbItemModification
       
    39 	{
       
    40 	public:
       
    41 			
       
    42 		enum TNSmlDbItemModificationType
       
    43 			{
       
    44 			ENSmlDbItemAdd = 1,
       
    45 			ENSmlDbItemDelete,
       
    46 			ENSmlDbItemSoftDelete,
       
    47 			ENSmlDbItemMove,
       
    48 			ENSmlDbItemModify
       
    49 			};
       
    50 			
       
    51 		/**
       
    52 		* C++ constructor.
       
    53 		* @param aItemId. UID of item.
       
    54 		* @param aModType. Type of modification.
       
    55 		*/
       
    56 		IMPORT_C TNSmlDbItemModification( TSmlDbItemUid aItemId, TNSmlDbItemModificationType aModType );
       
    57 
       
    58 		/**
       
    59 		* C++ copy constructor.
       
    60 		* @param aDim. source for copy
       
    61 		*/	
       
    62 		IMPORT_C TNSmlDbItemModification( const TNSmlDbItemModification& aDim );
       
    63 		
       
    64 		/**
       
    65 		* Retuns the item UID.
       
    66 		* @return TSmlDsItemUid. Retuns the item UID.
       
    67 		*/
       
    68 		IMPORT_C TSmlDbItemUid ItemId() const;
       
    69 		
       
    70 		/**
       
    71 		* Retuns the modification type.
       
    72 		* @return TNSmlModificationItem::TNSmlModificationType. Type of modification.
       
    73 		*/
       
    74 		IMPORT_C TNSmlDbItemModification::TNSmlDbItemModificationType ModificationType() const;
       
    75 
       
    76 		/**
       
    77 		* Assignment operator
       
    78 		* @param aDim. source for assignment
       
    79 		* @return TNSmlDbItemModification&. Reference to this object.
       
    80 		*/		
       
    81 		TNSmlDbItemModification& operator=( const TNSmlDbItemModification& aDim );
       
    82 		
       
    83 	private:
       
    84 
       
    85 		TSmlDbItemUid 					iItemId;
       
    86 		TNSmlDbItemModificationType 	iModType;
       
    87 	};
       
    88 
       
    89 // ------------------------------------------------------------------------------------------------
       
    90 // Class for transporting modifications over IPC.
       
    91 //
       
    92 // @lib nsmldshostclient.lib
       
    93 // ------------------------------------------------------------------------------------------------
       
    94 class RNSmlDbItemModificationSet
       
    95 	{
       
    96 	public:
       
    97 			
       
    98 		/**
       
    99 		* Adds item to modification set.
       
   100 		* @param aItem. Item that will be added to list.
       
   101 		* @return TInt. KErrNone or one of the system wide error codes.
       
   102 		*/
       
   103 		IMPORT_C TInt AddItemL( const TNSmlDbItemModification& aItem );
       
   104 		
       
   105 		/**
       
   106 		* Removes the item at a specified position from the modification set.
       
   107 		* @param aIndex Index of the item to be removed.
       
   108 		*/
       
   109 		IMPORT_C void RemoveItem( TInt aIndex );
       
   110 		
       
   111 		/**
       
   112 		* Adds group of items to modification set.
       
   113 		* @param aUidSet. Items that will be added to list.
       
   114 		* @param aModType. Modification type of all items.
       
   115 		*/             
       
   116 		IMPORT_C void AddGroupL( const MSmlDataItemUidSet& aUidSet, TNSmlDbItemModification::TNSmlDbItemModificationType aModType );
       
   117 		
       
   118 		/**
       
   119 		* Returns the number of items in the set.
       
   120 		* @return TInt. KErrNone or one of the system wide error codes.
       
   121 		*/
       
   122 		IMPORT_C TInt ItemCount() const;
       
   123 		
       
   124 		/**
       
   125 		* Returns the index of modification item.
       
   126 		* @param aItemId. UID of item.
       
   127 		* @return TInt. The index of specified item UID in the set, or -1 if the item UID is not present.
       
   128 		*/
       
   129 		IMPORT_C TInt ItemIndex( const TSmlDbItemUid aItemId ) const;
       
   130 		
       
   131 		/**
       
   132 		* Retuns the modifcation item.
       
   133 		* @param aIndex. Indes of item.
       
   134 		* @return TNSmlDbItemModification.Retuns the item at the specified index in the set.
       
   135 		*/
       
   136 		IMPORT_C TNSmlDbItemModification ItemAt( TInt aIndex ) const;
       
   137 		
       
   138 		/**
       
   139 		* Resets modification set.
       
   140 		*/
       
   141 		IMPORT_C void Reset();
       
   142 		
       
   143 		/**
       
   144 		* Closes modification set.
       
   145 		*/
       
   146 		IMPORT_C void Close();
       
   147 		
       
   148 		/**
       
   149 		* This method externalizes class to stream.
       
   150 		* @param aStream. Externalize is done to this stream.
       
   151 		*/
       
   152 		IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
       
   153 		
       
   154 		/**
       
   155 		* This method internalizes class from stream.
       
   156 		* @param aStream. Internalize is done from this stream.
       
   157 		*/
       
   158 		IMPORT_C void InternalizeL( RReadStream& aStream );
       
   159 		
       
   160 		/**
       
   161 		* calculates size needed for stream when externalized.
       
   162 		* @return TInt. Size in bytes.
       
   163 		*/
       
   164 		IMPORT_C TInt StreamSize() const;
       
   165 		
       
   166 	private:
       
   167 
       
   168 		RArray<TNSmlDbItemModification> iItemSet;
       
   169 	};
       
   170 	
       
   171 #endif
       
   172 
       
   173 // End of File