|
1 /* |
|
2 * Copyright (c) 2007-2008 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 <liwservicehandler.h> |
|
20 |
|
21 #include "hnglobals.h" |
|
22 #include "hnmdbooleankey.h" |
|
23 |
|
24 |
|
25 // ======== MEMBER FUNCTIONS ======== |
|
26 |
|
27 // --------------------------------------------------------------------------- |
|
28 // |
|
29 // --------------------------------------------------------------------------- |
|
30 // |
|
31 CHnMdBooleanKey* CHnMdBooleanKey::NewL() |
|
32 { |
|
33 CHnMdBooleanKey* self = NewLC(); |
|
34 CleanupStack::Pop( self ); |
|
35 return self; |
|
36 } |
|
37 |
|
38 // --------------------------------------------------------------------------- |
|
39 // |
|
40 // --------------------------------------------------------------------------- |
|
41 // |
|
42 CHnMdBooleanKey* CHnMdBooleanKey::NewLC() |
|
43 { |
|
44 CHnMdBooleanKey* self = new ( ELeave ) CHnMdBooleanKey(); |
|
45 CleanupStack::PushL( self ); |
|
46 self->ConstructL(); |
|
47 return self; |
|
48 } |
|
49 |
|
50 // --------------------------------------------------------------------------- |
|
51 // |
|
52 // --------------------------------------------------------------------------- |
|
53 // |
|
54 CHnMdBooleanKey* CHnMdBooleanKey::NewL( const CHnMdBooleanKey* aKey ) |
|
55 { |
|
56 CHnMdBooleanKey* self = NewLC( aKey ); |
|
57 CleanupStack::Pop( self ); |
|
58 return self; |
|
59 } |
|
60 |
|
61 // --------------------------------------------------------------------------- |
|
62 // |
|
63 // --------------------------------------------------------------------------- |
|
64 // |
|
65 CHnMdBooleanKey* CHnMdBooleanKey::NewLC( const CHnMdBooleanKey* aKey ) |
|
66 { |
|
67 CHnMdBooleanKey* self = new ( ELeave ) CHnMdBooleanKey(); |
|
68 CleanupStack::PushL( self ); |
|
69 self->ConstructL( aKey ); |
|
70 return self; |
|
71 } |
|
72 |
|
73 // --------------------------------------------------------------------------- |
|
74 // |
|
75 // --------------------------------------------------------------------------- |
|
76 // |
|
77 CHnMdBaseKey* CHnMdBooleanKey::CopyLC() |
|
78 { |
|
79 CHnMdBooleanKey* self = CHnMdBooleanKey::NewL( this ); |
|
80 CleanupStack::PushL( self ); |
|
81 return self; |
|
82 } |
|
83 |
|
84 // --------------------------------------------------------------------------- |
|
85 // |
|
86 // --------------------------------------------------------------------------- |
|
87 // |
|
88 CHnMdBooleanKey::~CHnMdBooleanKey() |
|
89 { |
|
90 } |
|
91 |
|
92 // --------------------------------------------------------------------------- |
|
93 // |
|
94 // --------------------------------------------------------------------------- |
|
95 // |
|
96 TBool CHnMdBooleanKey::GetBooleanValueL() const |
|
97 { |
|
98 TBool ret( EFalse ); |
|
99 |
|
100 if ( !iContent.Compare( KStringFalse ) ) |
|
101 { |
|
102 ret = EFalse; |
|
103 } |
|
104 else if ( !iContent.Compare( KStringTrue ) ) |
|
105 { |
|
106 ret = ETrue; |
|
107 } |
|
108 else |
|
109 { |
|
110 TLex lex( iContent ); |
|
111 User::LeaveIfError( lex.Val( ret ) ); |
|
112 } |
|
113 |
|
114 return ret; |
|
115 } |
|
116 |
|
117 // --------------------------------------------------------------------------- |
|
118 // |
|
119 // --------------------------------------------------------------------------- |
|
120 // |
|
121 CHnMdBooleanKey::CHnMdBooleanKey() |
|
122 { |
|
123 } |
|
124 |
|
125 // --------------------------------------------------------------------------- |
|
126 // |
|
127 // --------------------------------------------------------------------------- |
|
128 // |
|
129 void CHnMdBooleanKey::ConstructL() |
|
130 { |
|
131 } |
|
132 |
|
133 // --------------------------------------------------------------------------- |
|
134 // |
|
135 // --------------------------------------------------------------------------- |
|
136 // |
|
137 void CHnMdBooleanKey::ConstructL( const CHnMdBooleanKey* aKey ) |
|
138 { |
|
139 BaseConstructL( aKey ); |
|
140 } |
|
141 |
|
142 // --------------------------------------------------------------------------- |
|
143 // |
|
144 // --------------------------------------------------------------------------- |
|
145 // |
|
146 void CHnMdBooleanKey::ToVariantL( TLiwVariant& aRet ) const |
|
147 { |
|
148 aRet.SetL( TLiwVariant( ( TBool ) ( GetBooleanValueL() ) ) ); |
|
149 } |
|
150 // End of file |