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