browser/engine/inc/ResetAndDestroy.h
author David Caabeiro <david.caabeiro@seqpoint.com>
Fri, 25 Jun 2010 12:50:05 +0200
changeset 0 c316ab048e9d
permissions -rw-r--r--
First public commit
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
     1
/*
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
     2
 * Helper classes
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
     3
 */
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
     4
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
     5
//#include <ecom/ImplementationInformation.h>
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
     6
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
     7
/*
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
     8
 * Function passed in as a parameter to TCleanupItem constructor to reset and 
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
     9
 * destroy the received aPtr.
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    10
 * @param aPtr A pointer to the object that is to be cleaned up
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    11
 */
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    12
inline void ResetAndDestroy(TAny* aPtr)
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    13
{
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    14
    reinterpret_cast<RImplInfoPtrArray*>(aPtr)->ResetAndDestroy();
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    15
}
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    16
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    17
/*
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    18
 * Function that creates a cleanup item for aArray and specifies the cleanup
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    19
 * function as ResetAndDestroy. When the item is removed from the cleanup stack
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    20
 * the function ResetAndDestroy will be called on aArray.
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    21
 * @param aArray The array to be destroyed.
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    22
 */
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    23
inline void CleanupResetAndDestroyPushL(RImplInfoPtrArray& aArray)
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    24
{       
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    25
    TCleanupItem item(ResetAndDestroy, &aArray);
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    26
    CleanupStack::PushL(item);
c316ab048e9d First public commit
David Caabeiro <david.caabeiro@seqpoint.com>
parents:
diff changeset
    27
}