|
1 /* |
|
2 * Copyright (c) 2006-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: Class representing a search field |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_SEARCHFIELD_H |
|
20 #define C_SEARCHFIELD_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <s32strm.h> |
|
24 #include <searchcommon.h> |
|
25 |
|
26 |
|
27 /** |
|
28 * Class for all search field. |
|
29 * |
|
30 * @lib searchutilities.lib |
|
31 */ |
|
32 NONSHARABLE_CLASS( CSearchField ) : public CBase |
|
33 { |
|
34 |
|
35 public: |
|
36 /** |
|
37 * two phased constructor |
|
38 * |
|
39 * @return CSearchField* |
|
40 */ |
|
41 IMPORT_C static CSearchField* NewL(); |
|
42 |
|
43 /** |
|
44 * two phased constructor - Contructing from a stream |
|
45 * |
|
46 * @param aStream |
|
47 * @return CSearchField* |
|
48 */ |
|
49 IMPORT_C static CSearchField* NewL( RReadStream& aStream ); |
|
50 |
|
51 /** |
|
52 * destructor |
|
53 */ |
|
54 virtual ~CSearchField(); |
|
55 |
|
56 /** |
|
57 * Externalize function |
|
58 * @param aStream |
|
59 */ |
|
60 IMPORT_C void ExternalizeL( RWriteStream& aStream ) const; |
|
61 |
|
62 /** |
|
63 * Sets the field id. |
|
64 * |
|
65 * @param aFieldId Id of the field. |
|
66 */ |
|
67 IMPORT_C void SetFieldId( TSearchFieldId aFieldId ); |
|
68 |
|
69 /** |
|
70 * Gets the field id. |
|
71 * |
|
72 * @return Field id. |
|
73 */ |
|
74 IMPORT_C TSearchFieldId FieldId() const; |
|
75 |
|
76 /** |
|
77 * Sets the field data type |
|
78 * @param aData |
|
79 */ |
|
80 IMPORT_C TSearchFieldDataType DataType( ) const; |
|
81 |
|
82 /** |
|
83 * Sets the field data and its type |
|
84 * @param aData |
|
85 */ |
|
86 IMPORT_C void SetDataL( TDesC8& aData, TSearchFieldDataType aDataType ); |
|
87 |
|
88 /** |
|
89 * Gets the field data. |
|
90 * |
|
91 * @param aData On return contains the field data. |
|
92 * @return KErrNone if get was successfull. |
|
93 * KErrNotSupported if the data type is wrong. |
|
94 */ |
|
95 IMPORT_C TInt GetData( TInt& aData ) const; |
|
96 |
|
97 /** |
|
98 * Gets the field data. |
|
99 * @param aData On return contains the field data. |
|
100 * @return KErrNone if get was successfull. |
|
101 * KErrNotSupported if the data type is wrong. |
|
102 */ |
|
103 IMPORT_C TInt GetData( TReal& aData ) const; |
|
104 |
|
105 /** |
|
106 * Gets the field data. |
|
107 * |
|
108 * @param aData On return contains the field data. |
|
109 * @return KErrNone if get was successfull. |
|
110 * KErrNotSupported if the data type is wrong. |
|
111 */ |
|
112 IMPORT_C TInt GetData( TTime& aData ) const; |
|
113 |
|
114 /** |
|
115 * Gets the field data. |
|
116 * @param aData On return contains the field data. |
|
117 * @return KErrNone if get was successfull. |
|
118 * KErrNotSupported if the data type is wrong. |
|
119 */ |
|
120 IMPORT_C TInt GetData( TPtrC8& aData ) const; |
|
121 |
|
122 private: |
|
123 |
|
124 /** |
|
125 * constructor |
|
126 */ |
|
127 CSearchField(); |
|
128 |
|
129 /** |
|
130 * 2nd phase constructor |
|
131 * @param aStream |
|
132 */ |
|
133 void ConstructL( RReadStream& aStream ); |
|
134 |
|
135 private: // data |
|
136 |
|
137 /** |
|
138 * Field |
|
139 * Own |
|
140 */ |
|
141 HBufC8* iField; |
|
142 |
|
143 /** |
|
144 * Field Id |
|
145 */ |
|
146 TSearchFieldId iFieldId; |
|
147 |
|
148 /** |
|
149 * Custom field |
|
150 */ |
|
151 HBufC8* iCustomFieldId; |
|
152 |
|
153 /** |
|
154 * Field Data type |
|
155 */ |
|
156 TSearchFieldDataType iType; |
|
157 |
|
158 /** |
|
159 * int data |
|
160 */ |
|
161 TInt iIntData; |
|
162 |
|
163 /** |
|
164 * time data |
|
165 */ |
|
166 TTime iTimeData; |
|
167 |
|
168 /** |
|
169 * real data |
|
170 */ |
|
171 TReal iRealData; |
|
172 |
|
173 /** |
|
174 * Buffer for unicode |
|
175 */ |
|
176 HBufC* iBuf16Data; |
|
177 |
|
178 /** |
|
179 * Buffer for utf8 |
|
180 */ |
|
181 HBufC8* iBuf8Data; |
|
182 |
|
183 }; |
|
184 |
|
185 #endif //C_SEARCHFIELD_H |
|
186 |