|
1 /* |
|
2 * Copyright (c) 2006 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: MPresenceInfoFieldValueEnum API object implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "presenceinfofieldvalueenumimp.h" |
|
20 #include "presenceinfofieldvalueenum.h" |
|
21 #include "ximprbufhelpers.h" |
|
22 #include "ximpobjecthelpers.h" |
|
23 |
|
24 // ============================ MEMBER FUNCTIONS ============================= |
|
25 |
|
26 // --------------------------------------------------------------------------- |
|
27 // CPresenceInfoFieldValueEnumImp::NewLC() |
|
28 // --------------------------------------------------------------------------- |
|
29 // |
|
30 EXPORT_C CPresenceInfoFieldValueEnumImp* CPresenceInfoFieldValueEnumImp::NewLC() |
|
31 { |
|
32 CPresenceInfoFieldValueEnumImp* self = new ( ELeave ) CPresenceInfoFieldValueEnumImp(); |
|
33 CleanupStack::PushL( self ); |
|
34 self->ConstructL(); |
|
35 return self; |
|
36 } |
|
37 |
|
38 // --------------------------------------------------------------------------- |
|
39 // CPresenceInfoFieldValueEnumImp::NewFromStreamLC() |
|
40 // --------------------------------------------------------------------------- |
|
41 // |
|
42 XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CPresenceInfoFieldValueEnumImp ) |
|
43 |
|
44 // --------------------------------------------------------------------------- |
|
45 // Implement supported interface access. |
|
46 // --------------------------------------------------------------------------- |
|
47 // |
|
48 XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CPresenceInfoFieldValueEnumImp, MPresenceInfoFieldValueEnum ) |
|
49 XIMPIMP_IF_BASE_GET_CLASS( CXIMPApiDataObjBase, this ) |
|
50 XIMPIMP_IF_BASE_GET_INTERFACE_END() |
|
51 XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CPresenceInfoFieldValueEnumImp, MPresenceInfoFieldValueEnum ) |
|
52 XIMPIMP_IF_BASE_GET_CONST_CLASS( CXIMPApiDataObjBase, this ) |
|
53 XIMPIMP_IF_BASE_GET_INTERFACE_END() |
|
54 |
|
55 // --------------------------------------------------------------------------- |
|
56 // CPresenceInfoFieldValueEnumImp::~CPresenceInfoFieldValueEnumImp() |
|
57 // --------------------------------------------------------------------------- |
|
58 // |
|
59 CPresenceInfoFieldValueEnumImp::~CPresenceInfoFieldValueEnumImp() |
|
60 { |
|
61 // nothing |
|
62 } |
|
63 |
|
64 // --------------------------------------------------------------------------- |
|
65 // CPresenceInfoFieldValueEnumImp::CPresenceInfoFieldValueEnumImp() |
|
66 // --------------------------------------------------------------------------- |
|
67 // |
|
68 CPresenceInfoFieldValueEnumImp::CPresenceInfoFieldValueEnumImp() |
|
69 { |
|
70 // nothing |
|
71 iMaxValue = KMaxTInt32; |
|
72 iMinValue = KMinTInt32; |
|
73 } |
|
74 |
|
75 // --------------------------------------------------------------------------- |
|
76 // CPresenceInfoFieldValueEnumImp::ConstructL() |
|
77 // --------------------------------------------------------------------------- |
|
78 // |
|
79 void CPresenceInfoFieldValueEnumImp::ConstructL() |
|
80 { |
|
81 // nothing |
|
82 } |
|
83 |
|
84 // --------------------------------------------------------------------------- |
|
85 // CPresenceInfoFieldValueEnumImp::ExternalizeL() |
|
86 // --------------------------------------------------------------------------- |
|
87 // |
|
88 void CPresenceInfoFieldValueEnumImp::ExternalizeL( RWriteStream& aStream ) const |
|
89 { |
|
90 aStream.WriteInt32L( iMaxValue ); |
|
91 aStream.WriteInt32L( iMinValue ); |
|
92 aStream.WriteInt32L( iValue ); |
|
93 } |
|
94 |
|
95 // --------------------------------------------------------------------------- |
|
96 // CPresenceInfoFieldValueEnumImp::InternalizeL() |
|
97 // --------------------------------------------------------------------------- |
|
98 // |
|
99 EXPORT_C void CPresenceInfoFieldValueEnumImp::InternalizeL( RReadStream& aStream ) |
|
100 { |
|
101 iMaxValue = aStream.ReadInt32L(); |
|
102 iMinValue = aStream.ReadInt32L(); |
|
103 iValue = aStream.ReadInt32L(); |
|
104 } |
|
105 |
|
106 // --------------------------------------------------------------------------- |
|
107 // CPresenceInfoFieldValueEnumImp::EqualsContent() |
|
108 // --------------------------------------------------------------------------- |
|
109 // |
|
110 TBool CPresenceInfoFieldValueEnumImp::EqualsContent( |
|
111 const CXIMPApiDataObjBase& aOtherInstance ) const |
|
112 { |
|
113 const CPresenceInfoFieldValueEnumImp* tmp = |
|
114 TXIMPGetImpClassOrPanic< const CPresenceInfoFieldValueEnumImp >::From( |
|
115 aOtherInstance.Base() ); |
|
116 |
|
117 TBool same = ETrue; |
|
118 TBool x = iMaxValue == tmp->iMaxValue; |
|
119 same &= x; |
|
120 |
|
121 x = iMinValue == tmp->iMinValue; |
|
122 same &= x; |
|
123 |
|
124 x = iValue == tmp->iValue; |
|
125 same &= x; |
|
126 |
|
127 return same; |
|
128 } |
|
129 |
|
130 // --------------------------------------------------------------------------- |
|
131 // CPresenceInfoFieldValueEnumImp::MinValue() |
|
132 // --------------------------------------------------------------------------- |
|
133 // |
|
134 TInt CPresenceInfoFieldValueEnumImp::MinValue() const |
|
135 { |
|
136 return iMinValue; |
|
137 } |
|
138 |
|
139 // --------------------------------------------------------------------------- |
|
140 // CPresenceInfoFieldValueEnumImp::MaxValue() |
|
141 // --------------------------------------------------------------------------- |
|
142 // |
|
143 TInt CPresenceInfoFieldValueEnumImp::MaxValue() const |
|
144 { |
|
145 return iMaxValue; |
|
146 } |
|
147 |
|
148 // --------------------------------------------------------------------------- |
|
149 // CPresenceInfoFieldValueEnumImp::Value() |
|
150 // --------------------------------------------------------------------------- |
|
151 // |
|
152 TInt CPresenceInfoFieldValueEnumImp::Value() const |
|
153 { |
|
154 return iValue; |
|
155 } |
|
156 |
|
157 // --------------------------------------------------------------------------- |
|
158 // CPresenceInfoFieldValueEnumImp::SetValueL |
|
159 // --------------------------------------------------------------------------- |
|
160 // |
|
161 void CPresenceInfoFieldValueEnumImp::SetValueL( TInt aValue ) |
|
162 { |
|
163 User::LeaveIfError( aValue > iMaxValue ? KErrOverflow : KErrNone ); |
|
164 User::LeaveIfError( aValue < iMinValue ? KErrUnderflow : KErrNone ); |
|
165 |
|
166 iValue = aValue; |
|
167 } |
|
168 |
|
169 // --------------------------------------------------------------------------- |
|
170 // CPresenceInfoFieldValueEnumImp::SetLimits |
|
171 // --------------------------------------------------------------------------- |
|
172 // |
|
173 void CPresenceInfoFieldValueEnumImp::SetLimits( TInt aMin, TInt aMax ) |
|
174 { |
|
175 iMinValue = aMin; |
|
176 iMaxValue = aMax; |
|
177 } |
|
178 |
|
179 // End of file |