|
1 /* |
|
2 * Copyright (c) 2003 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: Tls holder used to check if resource file is loaded or not |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CWVSETTINGSUITLSHOLDER_H |
|
19 #define CWVSETTINGSUITLSHOLDER_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <E32Base.h> |
|
23 |
|
24 |
|
25 // FORWARD DECLARATIONS |
|
26 |
|
27 |
|
28 // CLASS DECLARATION |
|
29 |
|
30 /** |
|
31 * TLS holder used to check if resource file is loaded or not |
|
32 * and if it can be unloaded or not. |
|
33 * |
|
34 * @lib WVServiceSettingsUi.dll |
|
35 * @since 2.1 |
|
36 */ |
|
37 NONSHARABLE_CLASS( CWVSettingsUITlsHolder ) : public CBase |
|
38 { |
|
39 public: // Constructors and destructor |
|
40 |
|
41 /** |
|
42 * Singleton pointer retrieve method. |
|
43 */ |
|
44 static CWVSettingsUITlsHolder* InstanceL(); |
|
45 |
|
46 |
|
47 /** |
|
48 * Trys to delete all owned singletons and |
|
49 * also this holder object. |
|
50 * If NULLing the TLS pointer, pointing to this |
|
51 * holder object fails, doesn't delete holder, only |
|
52 * owned singletons. After that this TLS holder can |
|
53 * be still reused, by issuing again first InstanceL() |
|
54 * and to the retrived pointer one of existing sinleton |
|
55 * retrieve requests, |
|
56 * |
|
57 * NOTE!! After calling DestroySingletonsAndHolder() |
|
58 * all singleton object pointers must be retrived |
|
59 * again before using them!! |
|
60 * |
|
61 * @since 2.1 |
|
62 * @return If fully succesfull KErrNone. Else one of |
|
63 * system wide errorcodes. |
|
64 */ |
|
65 static TInt DestroySingletonsAndHolder(); |
|
66 |
|
67 |
|
68 public: // New functions |
|
69 |
|
70 /** |
|
71 * Tells if the resource is loaded |
|
72 * @since 2.1 |
|
73 */ |
|
74 TBool ResourceIsLoaded() const; |
|
75 |
|
76 /** |
|
77 * Adds one to the reference count of the resource file |
|
78 * @since 2.1 |
|
79 */ |
|
80 void ResourceLoaded(); |
|
81 |
|
82 /** |
|
83 * Removes one to the reference count of the resource file |
|
84 * @since 2.1 |
|
85 */ |
|
86 void ResourceUnLoaded(); |
|
87 |
|
88 TBool OkToUnloadResource() const; |
|
89 |
|
90 private: //new functions |
|
91 |
|
92 |
|
93 /** |
|
94 * Deletes owned singleton objects. |
|
95 * |
|
96 * @since 2.1 |
|
97 */ |
|
98 void DoReleaseSingletons(); |
|
99 |
|
100 private: |
|
101 |
|
102 /** |
|
103 * Two-phased constructor. |
|
104 * Leaves created object on the cleanupstack. |
|
105 * @since 2.1 |
|
106 */ |
|
107 static CWVSettingsUITlsHolder* NewLC(); |
|
108 |
|
109 |
|
110 /** |
|
111 * C++ default constructor. |
|
112 */ |
|
113 CWVSettingsUITlsHolder(); |
|
114 |
|
115 |
|
116 /** |
|
117 * Protected destructor. |
|
118 * |
|
119 * Singleton holder can be only destroyed trough |
|
120 * DestroySingletonsAndHolder() method. |
|
121 */ |
|
122 virtual ~CWVSettingsUITlsHolder(); |
|
123 |
|
124 |
|
125 private: // Data |
|
126 |
|
127 ///Publish level manager singleton, owned |
|
128 TBool iResourceLoaded; |
|
129 |
|
130 ///Spare member for future extensions |
|
131 TAny* iReserved; |
|
132 |
|
133 TInt iResourceReferenceCount; |
|
134 |
|
135 }; |
|
136 |
|
137 #endif // CWVSETTINGSUITLSHOLDER_H |
|
138 |
|
139 // End of File |