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 * Implements interface for Loc event |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "locpsyeng.h" |
|
22 #include "locpsysettings.h" |
|
23 #include "locpsyengdebug.h" |
|
24 |
|
25 // CONSTANTS |
|
26 /// Unnamed namespace for local definitions |
|
27 #ifdef _DEBUG |
|
28 |
|
29 _LIT( KLocPanicText, "CLocPsyEng" ); |
|
30 // LOCAL CONSTANTS AND MACROS |
|
31 enum TPanicCode |
|
32 { |
|
33 KLocErrModelTypeNotSupported = -70 |
|
34 }; |
|
35 // ==================== LOCAL FUNCTIONS ==================== |
|
36 |
|
37 void Panic(TPanicCode aReason) |
|
38 { |
|
39 User::Panic( KLocPanicText, aReason ); |
|
40 } |
|
41 #endif |
|
42 |
|
43 // ============================ MEMBER FUNCTIONS =============================== |
|
44 |
|
45 // ----------------------------------------------------------------------------- |
|
46 // CLocPsyEng::NewL |
|
47 // Two-phased constructor. |
|
48 // ----------------------------------------------------------------------------- |
|
49 // |
|
50 EXPORT_C CLocPsyEng* CLocPsyEng::NewL() |
|
51 { |
|
52 CLocPsyEng* self = new (ELeave) CLocPsyEng(); |
|
53 // Nothing to do for the second stage construction. |
|
54 return self; |
|
55 } |
|
56 |
|
57 // ----------------------------------------------------------------------------- |
|
58 // CLocPsyEng::CLocPsyEng |
|
59 // C++ default constructor can NOT contain any code, that |
|
60 // might leave. |
|
61 // ----------------------------------------------------------------------------- |
|
62 // |
|
63 CLocPsyEng::CLocPsyEng() |
|
64 { |
|
65 } |
|
66 |
|
67 // Destructor |
|
68 |
|
69 EXPORT_C CLocPsyEng::~CLocPsyEng() |
|
70 { |
|
71 delete iSettings; |
|
72 } |
|
73 |
|
74 // ----------------------------------------------------------------------------- |
|
75 // CLocPsyEng::SettingsModel |
|
76 // Settings model getter. |
|
77 // ----------------------------------------------------------------------------- |
|
78 // |
|
79 EXPORT_C MLocPsySettings* CLocPsyEng::SettingsModel() |
|
80 { |
|
81 return iSettings; |
|
82 } |
|
83 |
|
84 // ----------------------------------------------------------------------------- |
|
85 // CLocPsyEng::CreateModelL() |
|
86 // Creates a given model type. |
|
87 // ----------------------------------------------------------------------------- |
|
88 // |
|
89 EXPORT_C void CLocPsyEng::CreateModelL( TLocModelType aModel ) |
|
90 { |
|
91 switch( aModel ) |
|
92 { |
|
93 case ELocPsySettings: |
|
94 { |
|
95 if ( !iSettings ) |
|
96 { |
|
97 iSettings = CLocPsySettings::NewL(); |
|
98 } |
|
99 break; |
|
100 } |
|
101 default: |
|
102 { |
|
103 // Not supported model type |
|
104 __ASSERT_DEBUG(EFalse, Panic(KLocErrModelTypeNotSupported)); |
|
105 break; |
|
106 } |
|
107 } |
|
108 } |
|
109 |
|
110 // ----------------------------------------------------------------------------- |
|
111 // CLocPsyEng::RemoveModel |
|
112 // Removes a given model type. |
|
113 // ----------------------------------------------------------------------------- |
|
114 // |
|
115 EXPORT_C void CLocPsyEng::RemoveModel( TLocModelType aModelType ) |
|
116 { |
|
117 switch ( aModelType ) |
|
118 { |
|
119 case ELocPsySettings: |
|
120 { |
|
121 delete iSettings; |
|
122 iSettings = NULL; |
|
123 break; |
|
124 } |
|
125 default: |
|
126 { |
|
127 // Not supported model type |
|
128 __ASSERT_DEBUG(EFalse, Panic(KLocErrModelTypeNotSupported)); |
|
129 } |
|
130 break; |
|
131 } |
|
132 } |
|
133 |
|
134 // End of File |
|