|
1 /* |
|
2 * Copyright (c) 2007-2009 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: common definition for MdE* |
|
15 */ |
|
16 |
|
17 #include "mdcdef.h" |
|
18 |
|
19 ///////////////////// |
|
20 // TMdCObjectDef // |
|
21 ///////////////////// |
|
22 |
|
23 EXPORT_C TMdCObjectDef::TMdCObjectDef() : TMdCDef( EMdCObject ) |
|
24 { |
|
25 } |
|
26 |
|
27 EXPORT_C void TMdCObjectDef::SerializeL(CMdCSerializationBuffer& aBuffer) |
|
28 { |
|
29 TMdCSerializationType::SerializeL( aBuffer, sizeof(*this) ); |
|
30 } |
|
31 |
|
32 EXPORT_C void TMdCObjectDef::DeserializeL(CMdCSerializationBuffer& aBuffer) |
|
33 { |
|
34 TMdCSerializationType::DeserializeL( aBuffer, sizeof(*this) ); |
|
35 } |
|
36 EXPORT_C const TMdCObjectDef& TMdCObjectDef::GetFromBufferL( CMdCSerializationBuffer& aBuffer ) |
|
37 { |
|
38 const TInt bufferPosition = aBuffer.Position(); |
|
39 TMdCObjectDef* objectDef = (TMdCObjectDef*)(aBuffer.Buffer().Ptr() + bufferPosition); |
|
40 if (objectDef->iType != EMdCObject) |
|
41 { |
|
42 __ASSERT_DEBUG( EFalse, User::Panic( _L("No TMdCObjectDef!"), KErrCorrupt ) ); |
|
43 |
|
44 User::Leave( KErrCorrupt ); |
|
45 } |
|
46 const TInt size = sizeof(TMdCObjectDef) % 2 ? sizeof(TMdCObjectDef)+1 : sizeof(TMdCObjectDef); |
|
47 aBuffer.PositionL( bufferPosition + size ); |
|
48 return *objectDef; |
|
49 } |
|
50 |
|
51 |
|
52 /////////////////////// |
|
53 // TMdCRelationDef // |
|
54 /////////////////////// |
|
55 |
|
56 EXPORT_C TMdCRelationDef::TMdCRelationDef() : TMdCDef( EMdCRelationDef ) |
|
57 { |
|
58 } |
|
59 |
|
60 EXPORT_C void TMdCRelationDef::SerializeL(CMdCSerializationBuffer& aBuffer) |
|
61 { |
|
62 TMdCSerializationType::SerializeL( aBuffer, sizeof(*this) ); |
|
63 } |
|
64 |
|
65 EXPORT_C void TMdCRelationDef::DeserializeL(CMdCSerializationBuffer& aBuffer) |
|
66 { |
|
67 TMdCSerializationType::DeserializeL( aBuffer, sizeof(*this) ); |
|
68 } |
|
69 EXPORT_C const TMdCRelationDef& TMdCRelationDef::GetFromBufferL( CMdCSerializationBuffer& aBuffer ) |
|
70 { |
|
71 const TInt bufferPosition = aBuffer.Position(); |
|
72 TMdCRelationDef* relationDef = (TMdCRelationDef*)(aBuffer.Buffer().Ptr() + bufferPosition); |
|
73 if (relationDef->iType != EMdCRelationDef) |
|
74 { |
|
75 __ASSERT_DEBUG( EFalse, User::Panic( _L("No TMdCRelationDef!"), KErrCorrupt ) ); |
|
76 |
|
77 User::Leave( KErrCorrupt ); |
|
78 } |
|
79 const TInt size = sizeof(TMdCRelationDef) % 2 ? sizeof(TMdCRelationDef)+1 : sizeof(TMdCRelationDef); |
|
80 aBuffer.PositionL( bufferPosition + size ); |
|
81 return *relationDef; |
|
82 } |
|
83 |
|
84 |
|
85 //////////////////// |
|
86 // TMdCEventDef // |
|
87 //////////////////// |
|
88 |
|
89 EXPORT_C TMdCEventDef::TMdCEventDef() : TMdCDef( EMdCEventDef ) |
|
90 { |
|
91 } |
|
92 |
|
93 EXPORT_C void TMdCEventDef::SerializeL(CMdCSerializationBuffer& aBuffer) |
|
94 { |
|
95 TMdCSerializationType::SerializeL( aBuffer, sizeof(*this) ); |
|
96 } |
|
97 |
|
98 EXPORT_C void TMdCEventDef::DeserializeL(CMdCSerializationBuffer& aBuffer) |
|
99 { |
|
100 TMdCSerializationType::DeserializeL( aBuffer, sizeof(*this) ); |
|
101 } |
|
102 EXPORT_C const TMdCEventDef& TMdCEventDef::GetFromBufferL( CMdCSerializationBuffer& aBuffer ) |
|
103 { |
|
104 const TInt bufferPosition = aBuffer.Position(); |
|
105 TMdCEventDef* eventDef = (TMdCEventDef*)(aBuffer.Buffer().Ptr() + bufferPosition); |
|
106 if (eventDef->iType != EMdCEventDef) |
|
107 { |
|
108 __ASSERT_DEBUG( EFalse, User::Panic( _L("No TMdCEventDef!"), KErrCorrupt ) ); |
|
109 |
|
110 User::Leave( KErrCorrupt ); |
|
111 } |
|
112 const TInt size = sizeof(TMdCEventDef) % 2 ? sizeof(TMdCEventDef)+1 : sizeof(TMdCEventDef); |
|
113 aBuffer.PositionL( bufferPosition + size ); |
|
114 return *eventDef; |
|
115 } |
|
116 |
|
117 |
|
118 /////////////////////// |
|
119 // TMdCPropertyDef // |
|
120 /////////////////////// |
|
121 |
|
122 EXPORT_C TMdCPropertyDef::TMdCPropertyDef() : TMdCDef( EMdCPropertyDef ) |
|
123 { |
|
124 } |
|
125 |
|
126 EXPORT_C void TMdCPropertyDef::SerializeL(CMdCSerializationBuffer& aBuffer) |
|
127 { |
|
128 TMdCSerializationType::SerializeL( aBuffer, sizeof(*this) ); |
|
129 } |
|
130 |
|
131 EXPORT_C void TMdCPropertyDef::DeserializeL(CMdCSerializationBuffer& aBuffer) |
|
132 { |
|
133 TMdCSerializationType::DeserializeL( aBuffer, sizeof(*this) ); |
|
134 } |
|
135 EXPORT_C const TMdCPropertyDef& TMdCPropertyDef::GetFromBufferL( CMdCSerializationBuffer& aBuffer ) |
|
136 { |
|
137 const TInt bufferPosition = aBuffer.Position(); |
|
138 TMdCPropertyDef* propertyDef = (TMdCPropertyDef*)(aBuffer.Buffer().Ptr() + bufferPosition); |
|
139 if (propertyDef->iType != EMdCPropertyDef) |
|
140 { |
|
141 __ASSERT_DEBUG( EFalse, User::Panic( _L("No TMdCPropertyDef!"), KErrCorrupt ) ); |
|
142 |
|
143 User::Leave( KErrCorrupt ); |
|
144 } |
|
145 const TInt size = sizeof(TMdCPropertyDef) % 2 ? sizeof(TMdCPropertyDef)+1 : sizeof(TMdCPropertyDef); |
|
146 aBuffer.PositionL( bufferPosition + size ); |
|
147 return *propertyDef; |
|
148 } |
|
149 |
|
150 |
|
151 //////////////////////// |
|
152 // TMdCNamespaceDef // |
|
153 //////////////////////// |
|
154 |
|
155 EXPORT_C TMdCNamespaceDef::TMdCNamespaceDef() : TMdCDef( EMdCNamespaceDef ) |
|
156 { |
|
157 } |
|
158 |
|
159 EXPORT_C void TMdCNamespaceDef::SerializeL(CMdCSerializationBuffer& aBuffer) |
|
160 { |
|
161 TMdCSerializationType::SerializeL( aBuffer, sizeof(*this) ); |
|
162 } |
|
163 |
|
164 EXPORT_C void TMdCNamespaceDef::DeserializeL(CMdCSerializationBuffer& aBuffer) |
|
165 { |
|
166 TMdCSerializationType::DeserializeL( aBuffer, sizeof(*this) ); |
|
167 } |
|
168 |
|
169 EXPORT_C const TMdCNamespaceDef& TMdCNamespaceDef::GetFromBufferL( CMdCSerializationBuffer& aBuffer ) |
|
170 { |
|
171 const TInt bufferPosition = aBuffer.Position(); |
|
172 TMdCNamespaceDef* namespaceDef = (TMdCNamespaceDef*)(aBuffer.Buffer().Ptr() + bufferPosition); |
|
173 if (namespaceDef->iType != EMdCNamespaceDef) |
|
174 { |
|
175 __ASSERT_DEBUG( EFalse, User::Panic( _L("No TMdCNamespaceDef!"), KErrCorrupt ) ); |
|
176 |
|
177 User::Leave( KErrCorrupt ); |
|
178 } |
|
179 const TInt size = sizeof(TMdCNamespaceDef) % 2 ? sizeof(TMdCNamespaceDef)+1 : sizeof(TMdCNamespaceDef); |
|
180 aBuffer.PositionL( bufferPosition + size ); |
|
181 return *namespaceDef; |
|
182 } |
|
183 |
|
184 |
|
185 ////////////////// |
|
186 // TMdCSchema // |
|
187 ////////////////// |
|
188 |
|
189 EXPORT_C TMdCSchema::TMdCSchema() : TMdCSerializationType( EMdCSchema ) |
|
190 { |
|
191 } |
|
192 |
|
193 EXPORT_C void TMdCSchema::SerializeL(CMdCSerializationBuffer& aBuffer) |
|
194 { |
|
195 TMdCSerializationType::SerializeL( aBuffer, sizeof(*this) ); |
|
196 } |
|
197 |
|
198 EXPORT_C void TMdCSchema::DeserializeL(CMdCSerializationBuffer& aBuffer) |
|
199 { |
|
200 TMdCSerializationType::DeserializeL( aBuffer, sizeof(*this) ); |
|
201 } |
|
202 EXPORT_C const TMdCSchema& TMdCSchema::GetFromBufferL( CMdCSerializationBuffer& aBuffer ) |
|
203 { |
|
204 const TInt bufferPosition = aBuffer.Position(); |
|
205 TMdCSchema* schema = (TMdCSchema*)(aBuffer.Buffer().Ptr() + bufferPosition); |
|
206 if (schema->iType != EMdCSchema) |
|
207 { |
|
208 __ASSERT_DEBUG( EFalse, User::Panic( _L("No TMdCSchema!"), KErrCorrupt ) ); |
|
209 |
|
210 User::Leave( KErrCorrupt ); |
|
211 } |
|
212 const TInt size = sizeof(TMdCSchema) % 2 ? sizeof(TMdCSchema)+1 : sizeof(TMdCSchema); |
|
213 aBuffer.PositionL( bufferPosition + size ); |
|
214 return *schema; |
|
215 } |
|
216 |