|
1 /* |
|
2 * Copyright (c) 2004 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: mmsmmboxviewheaders implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <msvstore.h> |
|
23 |
|
24 #include "mmsmmboxviewheaders.h" |
|
25 |
|
26 // EXTERNAL DATA STRUCTURES |
|
27 |
|
28 // EXTERNAL FUNCTION PROTOTYPES |
|
29 |
|
30 // CONSTANTS |
|
31 |
|
32 // MACROS |
|
33 |
|
34 // LOCAL CONSTANTS AND MACROS |
|
35 |
|
36 // MODULE DATA STRUCTURES |
|
37 |
|
38 // LOCAL FUNCTION PROTOTYPES |
|
39 |
|
40 // FORWARD DECLARATIONS |
|
41 |
|
42 // ============================= LOCAL FUNCTIONS =============================== |
|
43 |
|
44 // ============================ MEMBER FUNCTIONS =============================== |
|
45 |
|
46 // ----------------------------------------------------------------------------- |
|
47 // CMmsMMBoxViewHeaders::CMmsMMBoxViewHeaders |
|
48 // C++ default constructor can NOT contain any code, that |
|
49 // might leave. |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 CMmsMMBoxViewHeaders::CMmsMMBoxViewHeaders() |
|
53 { |
|
54 } |
|
55 |
|
56 // Destructor |
|
57 CMmsMMBoxViewHeaders::~CMmsMMBoxViewHeaders() |
|
58 { |
|
59 iAttributes.Reset(); |
|
60 iMmsMMStates.Reset(); |
|
61 } |
|
62 |
|
63 // ----------------------------------------------------------------------------- |
|
64 // CMmsMMBoxViewHeaders::Internalize |
|
65 // ----------------------------------------------------------------------------- |
|
66 // |
|
67 void CMmsMMBoxViewHeaders::InternalizeL( RMsvReadStream& aStream ) |
|
68 { |
|
69 iAttributes.Reset(); |
|
70 iMmsMMStates.Reset(); |
|
71 |
|
72 iMmsStart = aStream.ReadInt32L(); |
|
73 iMmsLimit = aStream.ReadInt32L(); |
|
74 iMmsTotals = aStream.ReadInt32L(); |
|
75 iMmsQuotas = aStream.ReadInt32L(); |
|
76 iMmsMessageCount = aStream.ReadInt32L(); |
|
77 iMMBoxTotalNumber = aStream.ReadInt32L(); |
|
78 iMMBoxTotalSize = aStream.ReadInt32L(); |
|
79 iMMBoxQuotaNumber = aStream.ReadInt32L(); |
|
80 iMMBoxQuotaSize = aStream.ReadInt32L(); |
|
81 |
|
82 TInt32 length = 0; |
|
83 TInt i; |
|
84 TInt value; |
|
85 length = aStream.ReadInt32L(); |
|
86 for ( i = 0; i < length; i++ ) |
|
87 { |
|
88 value = aStream.ReadInt32L(); |
|
89 User::LeaveIfError( iAttributes.Append( value ) ); |
|
90 } |
|
91 length = aStream.ReadInt32L(); |
|
92 for ( i = 0; i < length; i++ ) |
|
93 { |
|
94 value = aStream.ReadInt32L(); |
|
95 User::LeaveIfError( iMmsMMStates.Append( value ) ); |
|
96 } |
|
97 } |
|
98 |
|
99 // ----------------------------------------------------------------------------- |
|
100 // CMmsMMBoxViewHeaders::ExternalizeL |
|
101 // ----------------------------------------------------------------------------- |
|
102 // |
|
103 void CMmsMMBoxViewHeaders::ExternalizeL( RMsvWriteStream& aStream ) const |
|
104 { |
|
105 aStream.WriteInt32L( iMmsStart ); |
|
106 aStream.WriteInt32L( iMmsLimit ); |
|
107 aStream.WriteInt32L( iMmsTotals ); |
|
108 aStream.WriteInt32L( iMmsQuotas ); |
|
109 aStream.WriteInt32L( iMmsMessageCount ); |
|
110 aStream.WriteInt32L( iMMBoxTotalNumber ); |
|
111 aStream.WriteInt32L( iMMBoxTotalSize ); |
|
112 aStream.WriteInt32L( iMMBoxQuotaNumber ); |
|
113 aStream.WriteInt32L( iMMBoxQuotaSize ); |
|
114 |
|
115 // Write Attibutes array only if present |
|
116 TInt32 length = iAttributes.Count(); |
|
117 TInt i; |
|
118 aStream.WriteInt32L( length ); |
|
119 for ( i = 0; i < length; i++ ) |
|
120 { |
|
121 aStream.WriteInt32L( iAttributes[i] ); |
|
122 } |
|
123 |
|
124 // Write state filter array |
|
125 length = iMmsMMStates.Count(); |
|
126 aStream.WriteInt32L( length ); |
|
127 for ( i = 0; i < length; i++ ) |
|
128 { |
|
129 aStream.WriteInt32L( iMmsMMStates[i] ); |
|
130 } |
|
131 } |
|
132 |
|
133 // ----------------------------------------------------------------------------- |
|
134 // CMmsMMBoxViewHeaders::Size |
|
135 // ----------------------------------------------------------------------------- |
|
136 // |
|
137 TInt CMmsMMBoxViewHeaders::Size() const |
|
138 { |
|
139 TInt size = 0; |
|
140 size += sizeof( iMmsStart ); |
|
141 size += sizeof( iMmsLimit ); |
|
142 size += sizeof( iMmsTotals ); |
|
143 size += sizeof( iMmsQuotas ); |
|
144 size += sizeof( iMmsMessageCount ); |
|
145 size += sizeof( iMMBoxTotalNumber ); |
|
146 size += sizeof( iMMBoxTotalSize ); |
|
147 size += sizeof( iMMBoxQuotaNumber ); |
|
148 size += sizeof( iMMBoxQuotaSize ); |
|
149 |
|
150 size += sizeof( TInt32 ); |
|
151 TInt i; |
|
152 for ( i = 0; i < iAttributes.Count(); i++) |
|
153 { |
|
154 size += sizeof( TUint ); |
|
155 } |
|
156 |
|
157 size += sizeof( TInt32 ); |
|
158 for ( i = 0; i < iMmsMMStates.Count(); i++) |
|
159 { |
|
160 size += sizeof( TInt ); |
|
161 } |
|
162 |
|
163 return size; |
|
164 } |
|
165 |
|
166 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
167 |
|
168 // End of File |