|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @publishedPartner |
|
19 @released |
|
20 */ |
|
21 |
|
22 #ifndef TMTPTYPEFLATBASE_H |
|
23 #define TMTPTYPEFLATBASE_H |
|
24 |
|
25 #include <e32std.h> |
|
26 #include <mtp/mmtptype.h> |
|
27 #include <mtp/mtptypessimple.h> |
|
28 |
|
29 |
|
30 |
|
31 /** |
|
32 Defines the MTP flat data types base class. Flat data types are used to |
|
33 represent MTP datasets comprising a single contiguous sequence of data |
|
34 elements, each of a known type and length. This class implements generic |
|
35 flat data type storage management capabilities and is intended for derivation |
|
36 by concrete classes which implement specific MTP datasets. |
|
37 @publishedPartner |
|
38 @released |
|
39 */ |
|
40 class TMTPTypeFlatBase : public MMTPType |
|
41 { |
|
42 public: |
|
43 |
|
44 IMPORT_C TMTPTypeFlatBase(); |
|
45 |
|
46 IMPORT_C virtual void Reset(); |
|
47 |
|
48 IMPORT_C virtual void GetL(TInt aElementId, MMTPType& aElement) const; |
|
49 IMPORT_C virtual void SetL(TInt aElementId, const MMTPType& aElement); |
|
50 |
|
51 IMPORT_C virtual void SetInt8(TInt aElementId, TInt8 aData); |
|
52 IMPORT_C virtual void SetInt16(TInt aElementId, TInt16 aData); |
|
53 IMPORT_C virtual void SetInt32(TInt aElementId, TInt32 aData); |
|
54 IMPORT_C virtual void SetInt64(TInt aElementId, TInt64 aData); |
|
55 |
|
56 IMPORT_C virtual void SetUint8(TInt aElementId, TUint8 aData); |
|
57 IMPORT_C virtual void SetUint16(TInt aElementId, TUint16 aData); |
|
58 IMPORT_C virtual void SetUint32(TInt aElementId, TUint32 aData); |
|
59 IMPORT_C virtual void SetUint64(TInt aElementId, TUint64 aData); |
|
60 |
|
61 IMPORT_C virtual TInt8 Int8(TInt aElementId) const; |
|
62 IMPORT_C virtual TInt16 Int16(TInt aElementId) const; |
|
63 IMPORT_C virtual TInt32 Int32(TInt aElementId) const; |
|
64 IMPORT_C virtual TInt64 Int64(TInt aElementId) const; |
|
65 |
|
66 IMPORT_C virtual TUint8 Uint8(TInt aElementId) const; |
|
67 IMPORT_C virtual TUint16 Uint16(TInt aElementId) const; |
|
68 IMPORT_C virtual TUint32 Uint32(TInt aElementId) const; |
|
69 IMPORT_C virtual TUint64 Uint64(TInt aElementId) const; |
|
70 |
|
71 inline TPtr8& DataBuffer() |
|
72 { |
|
73 return iBuffer; |
|
74 } |
|
75 |
|
76 |
|
77 |
|
78 public: // From MMTPType |
|
79 |
|
80 IMPORT_C virtual TInt FirstReadChunk(TPtrC8& aChunk) const; |
|
81 IMPORT_C virtual TInt NextReadChunk(TPtrC8& aChunk) const; |
|
82 IMPORT_C virtual TInt FirstWriteChunk(TPtr8& aChunk); |
|
83 IMPORT_C virtual TInt NextWriteChunk(TPtr8& aChunk); |
|
84 IMPORT_C virtual TUint64 Size() const; |
|
85 IMPORT_C virtual TUint Type() const; |
|
86 |
|
87 public: |
|
88 |
|
89 /** |
|
90 Defines the MTP flat data types element meta data. |
|
91 */ |
|
92 struct TElementInfo |
|
93 { |
|
94 /** |
|
95 The element's MTP type identifier. |
|
96 */ |
|
97 TInt iType; |
|
98 |
|
99 /** |
|
100 The offset (in bytes) of the element data from the start of the managed |
|
101 dataset buffer. |
|
102 */ |
|
103 TInt iOffset; |
|
104 |
|
105 /** |
|
106 The size (in bytes) of the element data. |
|
107 */ |
|
108 TInt iSize; |
|
109 }; |
|
110 |
|
111 protected: |
|
112 |
|
113 IMPORT_C virtual void SetBuffer(const TDes8& aBuffer); |
|
114 |
|
115 /** |
|
116 Provides the meta data for the specified element. |
|
117 @param aElementId The identifier of the requested element. |
|
118 @return The requested element's meta data. |
|
119 */ |
|
120 virtual const TElementInfo& ElementInfo(TInt aElementId) const = 0; |
|
121 |
|
122 //not owned |
|
123 /** |
|
124 The managed MTP dataset buffer. |
|
125 */ |
|
126 TPtr8 iBuffer; |
|
127 }; |
|
128 |
|
129 #endif //TMTPTYPEFLATBASE_H |