predictivesearch/PcsAlgorithm/Algorithm2/inc/CPcsAlgorithm2Utils.h
branchRCL_3
changeset 21 b3431bff8c19
parent 0 e686773b3f54
child 58 d4f567ce2e7c
--- a/predictivesearch/PcsAlgorithm/Algorithm2/inc/CPcsAlgorithm2Utils.h	Mon Mar 15 12:39:26 2010 +0200
+++ b/predictivesearch/PcsAlgorithm/Algorithm2/inc/CPcsAlgorithm2Utils.h	Wed Mar 31 21:13:53 2010 +0300
@@ -64,4 +64,21 @@
     static TBool IsGroupUri(TDesC& aURI);
 
     };
+
+// CleanupStack helpers for item owning RPointerArrays
+template <class T>
+class CleanupResetAndDestroy
+    {
+public:
+    inline static void PushL(T& aRef)
+        { CleanupStack::PushL(TCleanupItem(&ResetAndDestroy,&aRef)); }
+private:
+    inline static void ResetAndDestroy(TAny *aPtr)
+        { static_cast<T*>(aPtr)->ResetAndDestroy(); }
+    };
+
+template <class T>
+inline void CleanupResetAndDestroyPushL(T& aRef)
+    { CleanupResetAndDestroy<T>::PushL(aRef); }
+
 #endif // C_PCS_ALGORITHM_2_UTILS