|
1 /* |
|
2 * Copyright (c) 2007 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: Basic Diagnostics Test Result Detail Item class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef DIAGRESULTDETAILBASICITEM_H |
|
20 #define DIAGRESULTDETAILBASICITEM_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> // CBase |
|
24 |
|
25 // FORWARD DECLARATIONS |
|
26 class RWriteStream; |
|
27 class RReadStream; |
|
28 |
|
29 /** |
|
30 * Diagnostics Result Database Detail Item Classe. |
|
31 * |
|
32 * This class stores information needed for each entry in |
|
33 * CDiagResultDetailBasic. |
|
34 * |
|
35 * @since S60 v5.0 |
|
36 */ |
|
37 class CDiagResultDetailBasicItem : public CBase |
|
38 { |
|
39 public: // Data Types |
|
40 enum TFieldType |
|
41 { |
|
42 ETypeInt = 0, // data is TInt type |
|
43 ETypeDes16, // data is TDesC16 type |
|
44 ETypeDes8, // data is TDesC8 type |
|
45 }; |
|
46 |
|
47 public: // Constructors |
|
48 /** |
|
49 * Two-phase constructor. |
|
50 * |
|
51 * @param aFieldId - Field Id. |
|
52 * @param aFieldName - Textual description of the field. |
|
53 * @param aValue - TInt value. |
|
54 */ |
|
55 static CDiagResultDetailBasicItem* NewL( TInt aFieldId, |
|
56 const TDesC8& aFieldName, |
|
57 TInt aValue ); |
|
58 |
|
59 /** |
|
60 * Two-phase constructor. |
|
61 * |
|
62 * @param aFieldId - Field Id. |
|
63 * @param aFieldName - Textual description of the field. |
|
64 * @param aValue - TDesC8 Text value. |
|
65 */ |
|
66 static CDiagResultDetailBasicItem* NewL( TInt aFieldId, |
|
67 const TDesC8& aFieldName, |
|
68 const TDesC8& aValue ); |
|
69 |
|
70 /** |
|
71 * Two-phase constructor. |
|
72 * |
|
73 * @param aFieldId - Field Id |
|
74 * @param aFieldName - Textual description of the field. |
|
75 * @param aValue - TDesC16 Text value. |
|
76 */ |
|
77 static CDiagResultDetailBasicItem* NewL( TInt aFieldId, |
|
78 const TDesC8& aFieldName, |
|
79 const TDesC16& aValue ); |
|
80 |
|
81 /** |
|
82 * Two-phase constructor with RReadStream |
|
83 * |
|
84 * @param aReadStream - stream to internalize from |
|
85 */ |
|
86 static CDiagResultDetailBasicItem* NewL( RReadStream& aReadStream ); |
|
87 |
|
88 /** |
|
89 * Destructor |
|
90 */ |
|
91 ~CDiagResultDetailBasicItem(); |
|
92 |
|
93 /** |
|
94 * Get the field Id. |
|
95 * |
|
96 * @return Field Id. |
|
97 */ |
|
98 TInt FieldId() const; |
|
99 |
|
100 /** |
|
101 * Get the name of the field. |
|
102 * |
|
103 * @return Name of the field. |
|
104 */ |
|
105 const TDesC8& FieldName() const; |
|
106 |
|
107 /** |
|
108 * Get the type of the field. |
|
109 * |
|
110 * @return Type of the field. |
|
111 */ |
|
112 TFieldType Type() const; |
|
113 |
|
114 /** |
|
115 * Get value. If invalid aFieldId is passed, or type does not |
|
116 * match, function will leave with KErrArgument. |
|
117 * |
|
118 * @param aValue - Output paramater. The data will be stored |
|
119 * here. |
|
120 * @param KErrArgument if type does not match |
|
121 */ |
|
122 TInt GetValue( TInt& aValue ) const; |
|
123 TInt GetValue( TPtrC8& aValue ) const; |
|
124 TInt GetValue( TPtrC16& aValue ) const; |
|
125 |
|
126 /** |
|
127 * Externalize to a stream. |
|
128 * |
|
129 */ |
|
130 void ExternalizeL( RWriteStream& aWriteStream ) const; |
|
131 |
|
132 private: |
|
133 /** |
|
134 * Constructor |
|
135 * |
|
136 */ |
|
137 CDiagResultDetailBasicItem(); |
|
138 |
|
139 /** |
|
140 * Internalize from stream. |
|
141 * |
|
142 * @param aReadStream - stream to read from. |
|
143 */ |
|
144 void InternalizeL( RReadStream& aReadStream ); |
|
145 |
|
146 |
|
147 private: // Private Data Types |
|
148 |
|
149 typedef union |
|
150 { |
|
151 HBufC16* iBuffer16; |
|
152 HBufC8* iBuffer8; |
|
153 TInt iInt; |
|
154 } TValue; |
|
155 |
|
156 private: // Data |
|
157 TFieldType iFieldType; |
|
158 TInt iFieldId; |
|
159 TValue iValue; |
|
160 HBufC8* iFieldName; |
|
161 }; |
|
162 |
|
163 #endif // DIAGRESULTDETAILBASICITEM_h |
|
164 |
|
165 // End of File |
|
166 |