realtimenetprots/sipfw/ProfileAgent/Server/Inc/SipProfileCacheCleanupItem.h
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     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 * Name        : sipprofilecachecleanupitem.h
       
    16 * Part of     : SIP Profile Server
       
    17 * Interface   : private
       
    18 * The class used for roll back with CleanupStack in case of failure
       
    19 * Version     : 1.0
       
    20 *
       
    21 */
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 /**
       
    27  @internalComponent
       
    28 */
       
    29 
       
    30 
       
    31 #ifndef CSIPPROFILECACHECLEANUPITEM_H
       
    32 #define CSIPPROFILECACHECLEANUPITEM_H
       
    33 
       
    34 // INCLUDES
       
    35 #include <e32base.h>
       
    36 
       
    37 // FORWARD DECLARATIONS
       
    38 
       
    39 // CLASS DECLARATION
       
    40 
       
    41 /**
       
    42  * The class used for roll back with CleanupStack in case of failure
       
    43  */
       
    44 class CSIPProfileCacheCleanupItem : public CBase
       
    45 	{
       
    46 	public:
       
    47 
       
    48 	    /**
       
    49         * Cleans up resources in case of failure during
       
    50 		* adding of profile. Keeps store and memory consistent.
       
    51         */
       
    52 		inline void CrashRevert() 
       
    53 			{
       
    54 			if (iCache)
       
    55 				{
       
    56 				for (int i = 0; i < iCache->Count(); i++)
       
    57 					{
       
    58 					if ((*(iCache))[i] == iCacheItem)
       
    59 						{
       
    60 						iCache->Remove(i);
       
    61 						delete iCacheItem;
       
    62                                                 iCacheItem = NULL;
       
    63 						}
       
    64 					}
       
    65 				}
       
    66 			else
       
    67 				{
       
    68 				delete iCacheItem;
       
    69 				}
       
    70 			}
       
    71 
       
    72 	public: // Data
       
    73 
       
    74 		// Owned
       
    75 		CSIPProfileCacheItem* iCacheItem;
       
    76 		// Not owned
       
    77 		RPointerArray<CSIPProfileCacheItem>* iCache;
       
    78 	};
       
    79 
       
    80 #endif