|
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 item result definitions for MdE* |
|
15 */ |
|
16 |
|
17 #include "mdcresult.h" |
|
18 |
|
19 ///////////////// |
|
20 // TMdCItems // |
|
21 ///////////////// |
|
22 |
|
23 EXPORT_C TMdCItems::TMdCItems() : TMdCSerializationType( EMdCItems ) |
|
24 { |
|
25 } |
|
26 |
|
27 EXPORT_C void TMdCItems::SerializeL(CMdCSerializationBuffer& aBuffer) |
|
28 { |
|
29 TMdCSerializationType::SerializeL( aBuffer, sizeof(*this) ); |
|
30 } |
|
31 |
|
32 EXPORT_C void TMdCItems::DeserializeL(CMdCSerializationBuffer& aBuffer) |
|
33 { |
|
34 TMdCSerializationType::DeserializeL( aBuffer, sizeof(*this) ); |
|
35 } |
|
36 |
|
37 EXPORT_C const TMdCItems& TMdCItems::GetFromBufferL( CMdCSerializationBuffer& aBuffer ) |
|
38 { |
|
39 const TInt bufferPosition = aBuffer.Position(); |
|
40 TMdCItems* items = (TMdCItems*)(aBuffer.Buffer().Ptr() + bufferPosition); |
|
41 if (items->iType != EMdCItems) |
|
42 { |
|
43 __ASSERT_DEBUG( EFalse, User::Panic( _L("No TMdCItems!"), KErrCorrupt ) ); |
|
44 |
|
45 User::Leave( KErrCorrupt ); |
|
46 } |
|
47 const TInt size = sizeof(TMdCItems) % 2 ? sizeof(TMdCItems)+1 : sizeof(TMdCItems); |
|
48 aBuffer.PositionL( bufferPosition + size ); |
|
49 return *items; |
|
50 } |
|
51 |
|
52 |
|
53 /////////////////// |
|
54 // TMdCItemIds // |
|
55 /////////////////// |
|
56 |
|
57 EXPORT_C TMdCItemIds::TMdCItemIds() : TMdCSerializationType( EMdCItemIds ) |
|
58 { |
|
59 } |
|
60 |
|
61 EXPORT_C void TMdCItemIds::SerializeL(CMdCSerializationBuffer& aBuffer) |
|
62 { |
|
63 TMdCSerializationType::SerializeL( aBuffer, sizeof(*this) ); |
|
64 } |
|
65 |
|
66 EXPORT_C void TMdCItemIds::DeserializeL(CMdCSerializationBuffer& aBuffer) |
|
67 { |
|
68 TMdCSerializationType::DeserializeL( aBuffer, sizeof(*this) ); |
|
69 } |
|
70 |
|
71 EXPORT_C const TMdCItemIds& TMdCItemIds::GetFromBufferL( CMdCSerializationBuffer& aBuffer ) |
|
72 { |
|
73 const TInt bufferPosition = aBuffer.Position(); |
|
74 TMdCItemIds* itemIds = (TMdCItemIds*)(aBuffer.Buffer().Ptr() + bufferPosition); |
|
75 if (itemIds->iType != EMdCItemIds) |
|
76 { |
|
77 __ASSERT_DEBUG( EFalse, User::Panic( _L("No TMdCItemIds!"), KErrCorrupt ) ); |
|
78 |
|
79 User::Leave( KErrCorrupt ); |
|
80 } |
|
81 const TInt size = sizeof(TMdCItemIds) % 2 ? sizeof(TMdCItemIds)+1 : sizeof(TMdCItemIds); |
|
82 aBuffer.PositionL( bufferPosition + size ); |
|
83 return *itemIds; |
|
84 } |
|
85 |
|
86 |
|
87 ////////////////////// |
|
88 // TMdCItemCounts // |
|
89 ////////////////////// |
|
90 |
|
91 EXPORT_C TMdCItemCounts::TMdCItemCounts() : TMdCSerializationType( EMdCItemCount ) |
|
92 { |
|
93 } |
|
94 |
|
95 EXPORT_C void TMdCItemCounts::SerializeL(CMdCSerializationBuffer& aBuffer) |
|
96 { |
|
97 TMdCSerializationType::SerializeL( aBuffer, sizeof(*this) ); |
|
98 } |
|
99 |
|
100 EXPORT_C void TMdCItemCounts::DeserializeL(CMdCSerializationBuffer& aBuffer) |
|
101 { |
|
102 TMdCSerializationType::DeserializeL( aBuffer, sizeof(*this) ); |
|
103 } |
|
104 |
|
105 EXPORT_C const TMdCItemCounts& TMdCItemCounts::GetFromBufferL( CMdCSerializationBuffer& aBuffer ) |
|
106 { |
|
107 const TInt bufferPosition = aBuffer.Position(); |
|
108 TMdCItemCounts* itemCounts = (TMdCItemCounts*)(aBuffer.Buffer().Ptr() + bufferPosition); |
|
109 if (itemCounts->iType != EMdCItemCount) |
|
110 { |
|
111 __ASSERT_DEBUG( EFalse, User::Panic( _L("No TMdCItemCounts!"), KErrCorrupt ) ); |
|
112 |
|
113 User::Leave( KErrCorrupt ); |
|
114 } |
|
115 const TInt size = sizeof(TMdCItemCounts) % 2 ? sizeof(TMdCItemCounts)+1 : sizeof(TMdCItemCounts); |
|
116 aBuffer.PositionL( bufferPosition + size ); |
|
117 return *itemCounts; |
|
118 } |