Symbian3/SDK/Source/GUID-76D1438E-445E-5864-BA9D-27BC61D72C1B.dita
author Graeme Price <GRAEME.PRICE@NOKIA.COM>
Fri, 15 Oct 2010 14:32:18 +0100
changeset 15 307f4279f433
parent 0 89d6a7a84779
permissions -rw-r--r--
Initial contribution of the Adaptation Documentation.

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="GUID-76D1438E-445E-5864-BA9D-27BC61D72C1B" xml:lang="en"><title>How
to use CleanupClosePushL()</title><shortdesc>The CleanupClosePushL() templated function constructs and pushes
a TCleanupItem onto the cleanup stack.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
<p>The <codeph>CleanupClosePushL()</codeph> templated function constructs
and pushes a <codeph>TCleanupItem</codeph> onto the cleanup stack. When <codeph>CleanupStack::PopAndDestroy()</codeph> is
called, the <codeph>Close()</codeph> member function of the object encapsulated
by the <codeph>TCleanupItem</codeph> is called.</p>
<codeblock id="GUID-78CAEA8F-8A04-5A57-837F-18D6019EFB7A" xml:space="preserve">...
RTestTwo two;
CleanupClosePushL(two);
...
CleanupStack::PopAndDestroy();
...</codeblock>
<p>The <codeph>TCleanupItem</codeph> object encapsulates a reference to the <codeph>RTestTwo</codeph> object;
the cleanup operation is the static function <codeph>Close()</codeph> of the
templated class <codeph>CleanupClose&lt;class         T&gt;</codeph>. This is
implemented by simply calling the <codeph>Close()</codeph> member function
of <codeph>RTestTwo</codeph>. This means that <codeph>RTestTwo</codeph> must
define or inherit a member function <codeph>Close()</codeph> which performs
whatever clean up is required.</p>
<section id="GUID-CEDA4BF3-8D2D-4EFD-BEE3-D8CAC2635791"><title>Note</title> <ul>
<li id="GUID-0FAA2AE7-D7B9-52DC-A326-2B3D9183C15D"><p>In practice, this type
of cleanup operation is commonly applied to handles which are constructed
on the program stack.</p> </li>
</ul> </section>
</conbody></concept>