|
1 // Copyright (c) 1998-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 // Class TTextOps |
|
17 inline TUint TTextOps::Fold(TUint aChar) const |
|
18 { |
|
19 return iFold(aChar); |
|
20 } |
|
21 |
|
22 inline TInt TTextOps::Match(const TDesC8& aDes,const TDesC8& aPattern) const |
|
23 { |
|
24 return iMatch8(aDes,aPattern); |
|
25 } |
|
26 |
|
27 inline TInt TTextOps::Compare(const TText8* aLeftPtr, |
|
28 TInt aLeftLen, |
|
29 const TText8* aRightPtr, |
|
30 TInt aRightLen) const |
|
31 { |
|
32 return iCompare8(aLeftPtr,aLeftLen,aRightPtr,aRightLen); |
|
33 } |
|
34 |
|
35 inline TInt TTextOps::Match(const TDesC16& aDes,const TDesC16& aPattern) const |
|
36 { |
|
37 return iMatch16(aDes,aPattern); |
|
38 } |
|
39 |
|
40 inline TInt TTextOps::Compare(const TText16* aLeftPtr, |
|
41 TInt aLeftLen, |
|
42 const TText16* aRightPtr, |
|
43 TInt aRightLen) const |
|
44 { |
|
45 return iCompare16(aLeftPtr,aLeftLen,aRightPtr,aRightLen); |
|
46 } |
|
47 |
|
48 /** |
|
49 The method compares aLeftPtr and aRightPtr unicode strings. |
|
50 Collation level 3 will be used. |
|
51 @param aLeftPtr Left string to compare. |
|
52 @param aLeftLen The length of left string. |
|
53 @param aRightPtr Right string to compare. |
|
54 @param aRightLen The length of right string. |
|
55 This method is used by sorting algorithms when the key field is a unciode string. |
|
56 @return Positive. if aLeftPtr is greater than aRightPtr. |
|
57 Negative. if aLeftPtr is less than aRightPtr. |
|
58 Zero, if aLeftPtr is equal to aRightPtr. |
|
59 */ |
|
60 inline TInt TTextOps::Order(const TText16* aLeftPtr, TInt aLeftLen, const TText16* aRightPtr, TInt aRightLen) const |
|
61 { |
|
62 return iOrder16(aLeftPtr, aLeftLen, aRightPtr, aRightLen); |
|
63 } |
|
64 |
|
65 // Class TDbBlob |
|
66 inline TDbBlob::TDbBlob() : |
|
67 iId(KDbNullBlobId), |
|
68 iSize(0) |
|
69 { |
|
70 } |
|
71 |
|
72 inline TDbBlob::TDbBlob(TDbBlobId anId,TInt aSize) : |
|
73 iId(anId), |
|
74 iSize(aSize) |
|
75 { |
|
76 } |
|
77 |
|
78 inline TDbBlob::TDbBlob(const TUint8* aPtr,TInt aSize) : |
|
79 iId(KDbNullBlobId), |
|
80 iSize(aSize) |
|
81 { |
|
82 __ASSERT_DEBUG(aSize>=0&&aSize<=KDbMaxInlineBlobSize,User::Invariant()); |
|
83 Mem::Copy(iInline,aPtr,aSize); |
|
84 } |
|
85 |
|
86 inline TUint8* TDbBlob::InlineBuffer() |
|
87 { |
|
88 __ASSERT_DEBUG(IsInline(),User::Invariant()); |
|
89 return iInline; |
|
90 } |
|
91 |
|
92 inline void TDbBlob::SetId(TDbBlobId anId) |
|
93 { |
|
94 iId=anId; |
|
95 } |
|
96 |
|
97 inline void TDbBlob::SetSize(TInt aSize) |
|
98 { |
|
99 iSize=aSize; |
|
100 } |
|
101 |
|
102 inline TBool TDbBlob::IsInline() const |
|
103 { |
|
104 return iId==KDbNullBlobId; |
|
105 } |
|
106 |
|
107 inline TInt TDbBlob::Size() const |
|
108 { |
|
109 return iSize; |
|
110 } |
|
111 |
|
112 inline const TUint8* TDbBlob::Data() const |
|
113 { |
|
114 __ASSERT_DEBUG(IsInline(),User::Invariant()); |
|
115 return iInline; |
|
116 } |
|
117 |
|
118 inline TPtrC8 TDbBlob::PtrC8() const |
|
119 { |
|
120 __ASSERT_DEBUG(IsInline(),User::Invariant()); |
|
121 return TPtrC8(iInline,iSize); |
|
122 } |
|
123 |
|
124 inline TPtrC16 TDbBlob::PtrC16() const |
|
125 { |
|
126 __ASSERT_DEBUG(IsInline(),User::Invariant()); |
|
127 return TPtrC16((const TUint16*)iInline,iSize>>1); |
|
128 } |
|
129 |
|
130 inline TDbBlobId TDbBlob::Id() const |
|
131 { |
|
132 __ASSERT_DEBUG(!IsInline(),User::Invariant()); |
|
133 return iId; |
|
134 } |
|
135 |
|
136 inline TInt TDbBlob::CellSize() const |
|
137 { |
|
138 return _FOFF(TDbBlob,iInline[IsInline() ? Size() : 0]); |
|
139 } |
|
140 |
|
141 inline TInt TDbBlob::InlineSize(TInt aSize) |
|
142 { |
|
143 return _FOFF(TDbBlob,iInline[aSize]); |
|
144 } |
|
145 |
|
146 inline TInt TDbBlob::RefSize() |
|
147 { |
|
148 return _FOFF(TDbBlob,iInline[0]); |
|
149 } |
|
150 |
|
151 // CLass TDbCell |
|
152 inline TInt TDbCell::Size(TInt aLength) |
|
153 { |
|
154 return Align4(aLength+sizeof(TInt)); |
|
155 } |
|
156 |
|
157 inline TInt TDbCell::Size() const |
|
158 { |
|
159 return Size(iLength); |
|
160 } |
|
161 |
|
162 inline TInt TDbCell::Length() const |
|
163 { |
|
164 return iLength; |
|
165 } |
|
166 |
|
167 inline const TDbCell* TDbCell::Next() const |
|
168 { |
|
169 return PtrAdd(this,Size()); |
|
170 } |
|
171 |
|
172 inline TDbCell* TDbCell::Next() |
|
173 { |
|
174 return PtrAdd(this,Size()); |
|
175 } |
|
176 |
|
177 inline TAny* TDbCell::Data() |
|
178 { |
|
179 return iBuf; |
|
180 } |
|
181 |
|
182 inline const TAny* TDbCell::Data() const |
|
183 { |
|
184 return iBuf; |
|
185 } |
|
186 |
|
187 inline void TDbCell::SetLength(TInt aLength) |
|
188 { |
|
189 iLength=aLength; |
|
190 } |
|
191 |
|
192 // Class TDbColumnC |
|
193 inline TDbColumnC::TDbColumnC(const RDbRow& aRow,TDbColNo aCol) : |
|
194 iCell(aRow.ColCell(aCol)) |
|
195 { |
|
196 } |
|
197 |
|
198 inline TInt TDbColumnC::Size() const |
|
199 { |
|
200 return iCell->Length(); |
|
201 } |
|
202 |
|
203 inline TBool TDbColumnC::IsNull() const |
|
204 { |
|
205 return Size()==0; |
|
206 } |
|
207 |
|
208 inline TInt8 TDbColumnC::Int8() const |
|
209 { |
|
210 return TInt8(*(const TInt32*)iCell->Data()); |
|
211 } |
|
212 |
|
213 inline TInt16 TDbColumnC::Int16() const |
|
214 { |
|
215 return TInt16(*(const TInt32*)iCell->Data()); |
|
216 } |
|
217 |
|
218 inline TInt32 TDbColumnC::Int32() const |
|
219 { |
|
220 return *(const TInt32*)iCell->Data(); |
|
221 } |
|
222 |
|
223 inline const TInt64& TDbColumnC::Int64() const |
|
224 { |
|
225 return *(const TInt64*)iCell->Data(); |
|
226 } |
|
227 |
|
228 inline TUint8 TDbColumnC::Uint8() const |
|
229 { |
|
230 return TUint8(*(const TUint8*)iCell->Data()); |
|
231 } |
|
232 |
|
233 inline TUint16 TDbColumnC::Uint16() const |
|
234 { |
|
235 return TUint16(*(const TUint32*)iCell->Data()); |
|
236 } |
|
237 |
|
238 inline TUint32 TDbColumnC::Uint32() const |
|
239 { |
|
240 return *(const TUint32*)iCell->Data(); |
|
241 } |
|
242 |
|
243 inline TReal32 TDbColumnC::Real32() const |
|
244 { |
|
245 return *(const TReal32*)iCell->Data(); |
|
246 } |
|
247 |
|
248 inline const TReal64& TDbColumnC::Real64() const |
|
249 { |
|
250 return *(const TReal64*)iCell->Data(); |
|
251 } |
|
252 |
|
253 inline TPtrC8 TDbColumnC::PtrC8() const |
|
254 { |
|
255 return TPtrC8((const TUint8*)iCell->Data(),iCell->Length()); |
|
256 } |
|
257 |
|
258 inline TPtrC16 TDbColumnC::PtrC16() const |
|
259 { |
|
260 return TPtrC16((const TUint16*)iCell->Data(),iCell->Length()>>1); |
|
261 } |
|
262 |
|
263 inline const TTime& TDbColumnC::Time() const |
|
264 { |
|
265 return *(const TTime*)iCell->Data(); |
|
266 } |
|
267 |
|
268 inline const TDbBlob& TDbColumnC::Blob() const |
|
269 { |
|
270 return *(const TDbBlob*)iCell->Data(); |
|
271 } |
|
272 |
|
273 // Class TDbColumn |
|
274 inline TDbColumn::TDbColumn() |
|
275 #ifdef _DEBUG |
|
276 : iRow(0) |
|
277 #endif |
|
278 { |
|
279 } |
|
280 |
|
281 inline TDbColumn::TDbColumn(RDbRow& aRow,TDbColNo aCol) : |
|
282 iRow(&aRow), |
|
283 iColumn(aCol) |
|
284 { |
|
285 } |
|
286 |
|
287 inline RDbRow& TDbColumn::Row() const |
|
288 { |
|
289 __ASSERT_DEBUG(iRow,User::Invariant()); |
|
290 return *iRow; |
|
291 } |
|
292 |
|
293 inline void TDbColumn::SetNull() |
|
294 { |
|
295 Row().SetColumnWidthL(iColumn,0); |
|
296 } |
|
297 |
|
298 inline void TDbColumn::SetL(TInt32 aValue) |
|
299 { |
|
300 SetL(TUint32(aValue)); |
|
301 } |
|
302 |
|
303 inline void TDbColumn::SetL(const TTime& aValue) |
|
304 { |
|
305 SetL(aValue.Int64()); |
|
306 } |
|
307 |
|
308 inline void TDbColumn::SetL(const TDbCell* aCell) |
|
309 { |
|
310 SetL(aCell->Data(),aCell->Length()); |
|
311 } |
|
312 |
|
313 inline void TDbColumn::SetL(const TDbColumnC& aColumn) |
|
314 { |
|
315 SetL(aColumn.iCell); |
|
316 } |
|
317 |
|
318 // Class TDbColumnC |
|
319 inline TDbColumnC::TDbColumnC(const TDbColumn& aCol) : |
|
320 iCell(aCol.Row().ColCell(aCol.iColumn)) |
|
321 { |
|
322 } |
|
323 |
|
324 // Class RDbRow |
|
325 inline RDbRow::RDbRow(TAny* aBuf,TInt aMaxSize) |
|
326 { |
|
327 Open(aBuf,0,aMaxSize); |
|
328 } |
|
329 |
|
330 inline RDbRow::RDbRow(TAny* aBuf,TInt aSize,TInt aMaxSize) |
|
331 { |
|
332 Open(aBuf,aSize,aMaxSize); |
|
333 } |
|
334 |
|
335 inline void RDbRow::Open(TAny* aBuf,TInt aMaxSize) |
|
336 { |
|
337 Open(aBuf,0,aMaxSize); |
|
338 } |
|
339 |
|
340 inline void RDbRow::Reset() |
|
341 { |
|
342 SetSize(0); |
|
343 } |
|
344 |
|
345 inline TDbCell* RDbRow::First() |
|
346 { |
|
347 return iFirst; |
|
348 } |
|
349 |
|
350 inline const TDbCell* RDbRow::First() const |
|
351 { |
|
352 return iFirst; |
|
353 } |
|
354 |
|
355 inline const TDbCell* RDbRow::Last() const |
|
356 { |
|
357 return iLast; |
|
358 } |
|
359 |
|
360 inline const TDbCell* RDbRow::End() const |
|
361 { |
|
362 return iEnd; |
|
363 } |
|
364 |
|
365 inline TInt RDbRow::Diff(const TDbCell* aLeft,const TDbCell* aRight) |
|
366 { |
|
367 return (const TUint8*)aRight-(const TUint8*)aLeft; |
|
368 } |
|
369 |
|
370 inline TInt RDbRow::Size() const |
|
371 { |
|
372 return Diff(iFirst,iLast); |
|
373 } |
|
374 |
|
375 inline TInt RDbRow::MaxSize() const |
|
376 { |
|
377 return Diff(iFirst,iEnd); |
|
378 } |
|
379 |
|
380 // Class CDbObject |
|
381 inline const CDbContext* CDbObject::Context() const |
|
382 { |
|
383 return iContext; |
|
384 } |
|
385 |
|
386 |
|
387 // Class RDbHandleBase |
|
388 inline void RDbHandleBase::Set(CDbObject* aObject) |
|
389 { |
|
390 iObject=aObject; |
|
391 } |
|
392 |
|
393 // template Class RDbHandle |
|
394 template <class T> |
|
395 inline T* RDbHandle<T>::operator=(T* aT) |
|
396 { |
|
397 Set(aT);return aT; |
|
398 } |
|
399 |
|
400 template <class T> |
|
401 inline T* RDbHandle<T>::operator->() const |
|
402 { |
|
403 return &STATIC_CAST(T&,Object()); |
|
404 } |
|
405 |
|
406 template <class T> |
|
407 inline T& RDbHandle<T>::operator*() const |
|
408 { |
|
409 return STATIC_CAST(T&,Object()); |
|
410 } |
|
411 |
|
412 template <class T> |
|
413 inline T* RDbHandle<T>::operator()() const |
|
414 { |
|
415 return STATIC_CAST(T*,iObject); |
|
416 } |