diff -r 22de2e391156 -r 20ac952a623c atext/server/inc/utils.h --- a/atext/server/inc/utils.h Thu Sep 23 17:06:47 2010 +0300 +++ b/atext/server/inc/utils.h Wed Oct 13 16:20:29 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -46,6 +46,23 @@ {CleanupResetDestroyClose::PushL(aRef);} template +class CleanupDeleteAndNull + { +public: + inline static void PushL(T*& aRef) {CleanupStack::PushL(TCleanupItem(&DeleteAndNull,&aRef));}; +private: + static void DeleteAndNull(TAny *aPtr) {T*& ptr = *static_cast(aPtr); delete ptr; ptr = NULL;}; + }; + +/** + * Pushes an object into CleanupStack and specifies the cleanup + * function as delete followed by NULLing the pointer reference. +*/ +template +inline void CleanupDeleteAndNullPushL(T*& aRef) + {CleanupDeleteAndNull::PushL(aRef);} + +template static TBool OperatorEqual(const T& aT1, const T& aT2) { return aT1 == aT2;