|
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 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "CLogsViewGlobals.h" |
|
21 #include "CLogsExtensionLoader.h" |
|
22 |
|
23 CLogsViewGlobals* CLogsViewGlobals::singleThis; |
|
24 |
|
25 /// Unnamed namespace for local definitions |
|
26 namespace { |
|
27 |
|
28 // ==================== LOCAL FUNCTIONS ==================== |
|
29 |
|
30 /** |
|
31 * Returns global instance of CLogsViewGlobals. |
|
32 */ |
|
33 inline CLogsViewGlobals* Instance() |
|
34 { |
|
35 |
|
36 return CLogsViewGlobals::singleThis; |
|
37 |
|
38 } |
|
39 |
|
40 } |
|
41 |
|
42 // ================= MEMBER FUNCTIONS ======================= |
|
43 |
|
44 inline CLogsViewGlobals::CLogsViewGlobals() |
|
45 { |
|
46 } |
|
47 |
|
48 inline CLogsViewGlobals* CLogsViewGlobals::NewLC() |
|
49 { |
|
50 CLogsViewGlobals* self = new (ELeave) CLogsViewGlobals; |
|
51 self->PushL(); |
|
52 return self; |
|
53 } |
|
54 |
|
55 /** |
|
56 * Increments reference count of this instance. |
|
57 */ |
|
58 inline void CLogsViewGlobals::IncRef() |
|
59 { |
|
60 ++iRefCount; |
|
61 } |
|
62 |
|
63 /** |
|
64 * Decrements reference count. |
|
65 */ |
|
66 inline TInt CLogsViewGlobals::DecRef() |
|
67 { |
|
68 return --iRefCount; |
|
69 } |
|
70 |
|
71 /** |
|
72 * Returns reference count. |
|
73 */ |
|
74 inline TInt CLogsViewGlobals::RefCount() |
|
75 { |
|
76 return iRefCount; |
|
77 } |
|
78 |
|
79 CLogsViewGlobals* CLogsViewGlobals::InstanceL() |
|
80 { |
|
81 CLogsViewGlobals* instance = Instance(); |
|
82 |
|
83 if (!instance) |
|
84 { |
|
85 instance = CLogsViewGlobals::NewLC(); |
|
86 |
|
87 CLogsViewGlobals::singleThis = instance; |
|
88 |
|
89 CleanupStack::Pop(instance); |
|
90 } |
|
91 |
|
92 instance->IncRef(); |
|
93 |
|
94 return instance; |
|
95 } |
|
96 |
|
97 CLogsViewGlobals::~CLogsViewGlobals() |
|
98 { |
|
99 delete iLoader; |
|
100 } |
|
101 |
|
102 void CLogsViewGlobals::DoRelease() |
|
103 { |
|
104 if ( DecRef() == 0 ) |
|
105 { |
|
106 |
|
107 singleThis = 0; |
|
108 |
|
109 delete this; |
|
110 } |
|
111 } |
|
112 |
|
113 MLogsExtensionFactory& CLogsViewGlobals::ExtensionFactoryL() |
|
114 { |
|
115 if (!iLoader) |
|
116 { |
|
117 iLoader = CLogsExtensionLoader::NewL(); |
|
118 } |
|
119 |
|
120 return iLoader->ExtensionFactory(); |
|
121 } |
|
122 |
|
123 // End of File |