|
1 /* |
|
2 * Copyright (c) 2002 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: |
|
15 * Logs.app global variables. A singleton class. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef CLogsViewGlobals_H |
|
21 #define CLogsViewGlobals_H |
|
22 |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32base.h> |
|
26 |
|
27 #include "MLogsExtensionFactory.h" |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class CLogsExtensionLoader; |
|
31 |
|
32 // CLASS DECLARATION |
|
33 |
|
34 /** |
|
35 * Logs.app global variables. A singleton class. |
|
36 */ |
|
37 class CLogsViewGlobals : private CBase |
|
38 { |
|
39 public: // Constructors and destructor |
|
40 /** |
|
41 * Returns the singleton CLogsViewGlobals instance. If no instance |
|
42 * exists yet it is created. |
|
43 */ |
|
44 static CLogsViewGlobals* InstanceL(); |
|
45 |
|
46 /** |
|
47 * Pushes this object on to the cleanup stack. |
|
48 */ |
|
49 void PushL(); |
|
50 |
|
51 public: // New functions |
|
52 /** |
|
53 * Returns view extension factory. If no instance exists yet it is |
|
54 * created. |
|
55 */ |
|
56 MLogsExtensionFactory& ExtensionFactoryL(); |
|
57 |
|
58 private: // Interface for Release(CLogsViewGlobals*) |
|
59 friend void Release(CLogsViewGlobals*); |
|
60 virtual void DoRelease(); |
|
61 static void CleanupRelease(TAny* aObj); |
|
62 |
|
63 private: // Implementation |
|
64 CLogsViewGlobals(); |
|
65 void ConstructL(); |
|
66 static CLogsViewGlobals* NewLC(); |
|
67 ~CLogsViewGlobals(); |
|
68 void IncRef(); |
|
69 TInt DecRef(); |
|
70 TInt RefCount(); |
|
71 |
|
72 private: // Data |
|
73 /// Own: reference count for InstanceL calls |
|
74 TInt iRefCount; |
|
75 /// Own: for loading dll and getting extension factory |
|
76 CLogsExtensionLoader* iLoader; |
|
77 |
|
78 // |
|
79 //Static pointer to singleton instance of this class |
|
80 public: |
|
81 static CLogsViewGlobals* singleThis; |
|
82 }; |
|
83 |
|
84 |
|
85 // INLINE FUNCTIONS |
|
86 |
|
87 inline void CLogsViewGlobals::PushL() |
|
88 { |
|
89 CleanupStack::PushL(TCleanupItem(CleanupRelease,this)); |
|
90 } |
|
91 |
|
92 inline void Release(CLogsViewGlobals* aObj) |
|
93 { |
|
94 if (aObj) |
|
95 { |
|
96 aObj->DoRelease(); |
|
97 } |
|
98 } |
|
99 |
|
100 inline void CLogsViewGlobals::CleanupRelease(TAny* aObj) |
|
101 { |
|
102 Release(static_cast<CLogsViewGlobals*>(aObj)); |
|
103 } |
|
104 |
|
105 |
|
106 #endif |
|
107 |
|
108 |
|
109 // End of File |