|
1 /* |
|
2 * Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Phonebook 2 smart destruction indicator. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef TPBK2DESTRUCTIONINDICATOR_H |
|
20 #define TPBK2DESTRUCTIONINDICATOR_H |
|
21 |
|
22 // CLASS DECLARATION |
|
23 |
|
24 /** |
|
25 * Phonebook 2 smart destruction indicator. |
|
26 * Responsible for reseting the destruction indicator pointer in case |
|
27 * the destruction does not happen. This class is meant to be used |
|
28 * in classes that launch waiting dialogs. If application is killed |
|
29 * during the dialog the dialog code will return and run the code of the |
|
30 * deleted object. In that case the deleted object has to perform some checks |
|
31 * to find out if it is deleted. This class is used in that process to |
|
32 * help to perform that task safely. |
|
33 */ |
|
34 class TPbk2DestructionIndicator |
|
35 { |
|
36 public: // Construction and destruction |
|
37 |
|
38 /** |
|
39 * Constructor. |
|
40 * |
|
41 * @param aDestructionIndicator Pointer to a destruction |
|
42 * indicator. |
|
43 * @param aDestroyedPtr Reference to a pointer pointing |
|
44 * to given destruction indicator. |
|
45 */ |
|
46 TPbk2DestructionIndicator( |
|
47 TBool* aDestructionIndicator, |
|
48 TBool*& aDestroyedPtr ); |
|
49 |
|
50 /** |
|
51 * Destructor. |
|
52 */ |
|
53 ~TPbk2DestructionIndicator(); |
|
54 |
|
55 private: // Data |
|
56 /// Ref: Destruction indicator |
|
57 TBool* iDestructionIndicator; |
|
58 /// Ref: Points to the destruction indicator |
|
59 TBool*& iDestroyedPtr; |
|
60 }; |
|
61 |
|
62 // INLINE IMPLEMENTATION |
|
63 |
|
64 // -------------------------------------------------------------------------- |
|
65 // TPbk2DestructionIndicator::TPbk2DestructionIndicator |
|
66 // -------------------------------------------------------------------------- |
|
67 // |
|
68 inline TPbk2DestructionIndicator::TPbk2DestructionIndicator |
|
69 ( TBool* aDestructionIndicator, TBool*& aDestroyedPtr ) : |
|
70 iDestructionIndicator( aDestructionIndicator ), |
|
71 iDestroyedPtr( aDestroyedPtr ) |
|
72 { |
|
73 } |
|
74 |
|
75 // -------------------------------------------------------------------------- |
|
76 // TPbk2DestructionIndicator::~TPbk2DestructionIndicator |
|
77 // -------------------------------------------------------------------------- |
|
78 // |
|
79 inline TPbk2DestructionIndicator::~TPbk2DestructionIndicator() |
|
80 { |
|
81 if ( !*iDestructionIndicator ) |
|
82 { |
|
83 // Reset the pointer to destruction indicator if destruction |
|
84 // has not happened (iDestructionIndicator == EFalse) |
|
85 iDestroyedPtr = NULL; |
|
86 } |
|
87 } |
|
88 |
|
89 #endif // TPBK2DESTRUCTIONINDICATOR_H |
|
90 |
|
91 // End of File |