|
1 /* |
|
2 * Copyright (c) 2005 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: TMMCScBkupArchiveVector implementation |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 #include "TMMCScBkupArchiveVector.h" |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 // ========================= MEMBER FUNCTIONS ================================ |
|
25 |
|
26 // --------------------------------------------------------------------------- |
|
27 // TMMCScBkupArchiveVector::ExternalizedSize() |
|
28 // |
|
29 // |
|
30 // --------------------------------------------------------------------------- |
|
31 |
|
32 TInt TMMCScBkupArchiveVector::ExternalizedSize() |
|
33 { |
|
34 return 20; // 4 bytes for offset, 4 bytes for length, 4 bytes stream version, 4 bytes spare1, 4 bytes spare2 |
|
35 } |
|
36 |
|
37 |
|
38 // --------------------------------------------------------------------------- |
|
39 // TMMCScBkupArchiveVector::ExternalizeL() |
|
40 // |
|
41 // |
|
42 // --------------------------------------------------------------------------- |
|
43 |
|
44 void TMMCScBkupArchiveVector::ExternalizeL(RWriteStream& aStream) const |
|
45 { |
|
46 aStream.WriteInt32L( EStreamFormatVersion1 ); |
|
47 aStream.WriteInt32L( Offset() ); |
|
48 aStream.WriteInt32L( Length() ); |
|
49 aStream.WriteInt32L( 0 ); // Spare1 |
|
50 aStream.WriteInt32L( 0 ); // Spare2 |
|
51 } |
|
52 |
|
53 // --------------------------------------------------------------------------- |
|
54 // TMMCScBkupArchiveVector::InternalizeL() |
|
55 // |
|
56 // |
|
57 // --------------------------------------------------------------------------- |
|
58 |
|
59 void TMMCScBkupArchiveVector::InternalizeL(RReadStream& aStream) |
|
60 { |
|
61 aStream.ReadInt32L(); // stream format version |
|
62 iOffset = aStream.ReadInt32L(); |
|
63 iLength = aStream.ReadInt32L(); |
|
64 aStream.ReadInt32L(); // Spare1 |
|
65 aStream.ReadInt32L(); // Spare2 |
|
66 // |
|
67 if (iOffset < 0 || iLength < 0) |
|
68 { |
|
69 User::Leave(KErrCorrupt); |
|
70 } |
|
71 } |
|
72 |
|
73 |
|
74 |
|
75 // ========================= MEMBER FUNCTIONS ================================ |
|
76 |
|
77 // --------------------------------------------------------------------------- |
|
78 // TMMCScBkupArchiveDriveAndVector::InternalizeL() |
|
79 // |
|
80 // |
|
81 // --------------------------------------------------------------------------- |
|
82 void TMMCScBkupArchiveDriveAndVector::InternalizeL( RReadStream& aStream ) |
|
83 { |
|
84 aStream.ReadInt32L(); // EStreamFormatVersion1 |
|
85 aStream.ReadInt32L(); // spare1 |
|
86 aStream.ReadInt32L(); // spare2 |
|
87 aStream.ReadInt32L(); // spare3 |
|
88 // |
|
89 iDrive = static_cast<TDriveNumber>( aStream.ReadUint8L() ); |
|
90 aStream >> iVector; |
|
91 } |
|
92 |
|
93 |
|
94 // --------------------------------------------------------------------------- |
|
95 // TMMCScBkupArchiveDriveAndVector::ExternalizeL() |
|
96 // |
|
97 // |
|
98 // --------------------------------------------------------------------------- |
|
99 void TMMCScBkupArchiveDriveAndVector::ExternalizeL( RWriteStream& aStream ) const |
|
100 { |
|
101 aStream.WriteInt32L( EStreamFormatVersion1 ); |
|
102 aStream.WriteInt32L( 0 ); // spare1 |
|
103 aStream.WriteInt32L( 0 ); // spare2 |
|
104 aStream.WriteInt32L( 0 ); // spare3 |
|
105 // |
|
106 aStream.WriteUint8L( iDrive ); |
|
107 aStream << iVector; |
|
108 } |
|
109 |
|
110 |