1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/apacln.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -0,0 +1,69 @@
1.4 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +
1.20 +#if !defined(__APACLN_H__)
1.21 +#define __APACLN_H__
1.22 +
1.23 +#if !defined(__APPARC_H__)
1.24 +#include <apparc.h>
1.25 +#endif
1.26 +
1.27 +
1.28 +class TApaDocCleanupItem
1.29 +/** Allows CApaDocument-derived objects to be safely put onto the cleanup
1.30 +stack, by calling CApaProcess::DestroyDocument() should a leave or a call
1.31 +to CleanupStack::PopAndDestroy() occur.
1.32 +
1.33 +It is used as follows.
1.34 +@code
1.35 +TApaDocCleanupItem cleanup(iEikonEnv->Process(),doc);
1.36 +CleanupStack::PushL(cleanup);
1.37 +// some potentially leaving code here ...
1.38 +CleanupStack::Pop(cleanup);
1.39 +@endcode
1.40 +@publishedPartner
1.41 +@deprecated
1.42 +*/
1.43 + {
1.44 +public:
1.45 + inline TApaDocCleanupItem(CApaProcess* aProcess,CApaDocument* aDoc);
1.46 + inline operator TCleanupItem();
1.47 +private:
1.48 + IMPORT_C static void DoCleanup(TAny* aPtr);
1.49 +public:
1.50 + /** The process object that will be used to destroy the document. */
1.51 + CApaProcess* iApaProcess;
1.52 + /** The document to destroy as part of cleanup. */
1.53 + CApaDocument* iApaDoc;
1.54 + };
1.55 +
1.56 +
1.57 +inline TApaDocCleanupItem::TApaDocCleanupItem(CApaProcess* aProcess,CApaDocument* aDoc)
1.58 + : iApaProcess(aProcess), iApaDoc(aDoc)
1.59 +/** Constructs a cleanup item object for the specified document.
1.60 +
1.61 +@param aProcess A pointer to the process object that will be used to destroy the document.
1.62 +@param aDoc The document to destroy as part of cleanup. */
1.63 + {}
1.64 +
1.65 +inline TApaDocCleanupItem::operator TCleanupItem()
1.66 +/** A TCleanupItem cast operator that enables the TApaDocCleanupItem object to be pushed to
1.67 +the cleanup stack as a TCleanupItem, so that the document will be properly destroyed
1.68 +(by a call to CApaProcess::DestroyDocument()) should a leave or a call to
1.69 +CleanupStack::PopAndDestroy() occur. */
1.70 + {return TCleanupItem(DoCleanup,this);}
1.71 +
1.72 +#endif