--- 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<T>::PushL(aRef);}
template <class T>
+class CleanupDeleteAndNull
+ {
+public:
+ inline static void PushL(T*& aRef) {CleanupStack::PushL(TCleanupItem(&DeleteAndNull,&aRef));};
+private:
+ static void DeleteAndNull(TAny *aPtr) {T*& ptr = *static_cast<T**>(aPtr); delete ptr; ptr = NULL;};
+ };
+
+/**
+ * Pushes an object into CleanupStack and specifies the cleanup
+ * function as delete followed by NULLing the pointer reference.
+*/
+template <class T>
+inline void CleanupDeleteAndNullPushL(T*& aRef)
+ {CleanupDeleteAndNull<T>::PushL(aRef);}
+
+template <class T>
static TBool OperatorEqual(const T& aT1, const T& aT2)
{
return aT1 == aT2;