Update contrib.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
17 inline TUint TTextOps::Fold(TUint aChar) const
22 inline TInt TTextOps::Match(const TDesC8& aDes,const TDesC8& aPattern) const
24 return iMatch8(aDes,aPattern);
27 inline TInt TTextOps::Compare(const TText8* aLeftPtr,
29 const TText8* aRightPtr,
32 return iCompare8(aLeftPtr,aLeftLen,aRightPtr,aRightLen);
35 inline TInt TTextOps::Match(const TDesC16& aDes,const TDesC16& aPattern) const
37 return iMatch16(aDes,aPattern);
40 inline TInt TTextOps::Compare(const TText16* aLeftPtr,
42 const TText16* aRightPtr,
45 return iCompare16(aLeftPtr,aLeftLen,aRightPtr,aRightLen);
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.
60 inline TInt TTextOps::Order(const TText16* aLeftPtr, TInt aLeftLen, const TText16* aRightPtr, TInt aRightLen) const
62 return iOrder16(aLeftPtr, aLeftLen, aRightPtr, aRightLen);
66 inline TDbBlob::TDbBlob() :
72 inline TDbBlob::TDbBlob(TDbBlobId anId,TInt aSize) :
78 inline TDbBlob::TDbBlob(const TUint8* aPtr,TInt aSize) :
82 __ASSERT_DEBUG(aSize>=0&&aSize<=KDbMaxInlineBlobSize,User::Invariant());
83 Mem::Copy(iInline,aPtr,aSize);
86 inline TUint8* TDbBlob::InlineBuffer()
88 __ASSERT_DEBUG(IsInline(),User::Invariant());
92 inline void TDbBlob::SetId(TDbBlobId anId)
97 inline void TDbBlob::SetSize(TInt aSize)
102 inline TBool TDbBlob::IsInline() const
104 return iId==KDbNullBlobId;
107 inline TInt TDbBlob::Size() const
112 inline const TUint8* TDbBlob::Data() const
114 __ASSERT_DEBUG(IsInline(),User::Invariant());
118 inline TPtrC8 TDbBlob::PtrC8() const
120 __ASSERT_DEBUG(IsInline(),User::Invariant());
121 return TPtrC8(iInline,iSize);
124 inline TPtrC16 TDbBlob::PtrC16() const
126 __ASSERT_DEBUG(IsInline(),User::Invariant());
127 return TPtrC16((const TUint16*)iInline,iSize>>1);
130 inline TDbBlobId TDbBlob::Id() const
132 __ASSERT_DEBUG(!IsInline(),User::Invariant());
136 inline TInt TDbBlob::CellSize() const
138 return _FOFF(TDbBlob,iInline[IsInline() ? Size() : 0]);
141 inline TInt TDbBlob::InlineSize(TInt aSize)
143 return _FOFF(TDbBlob,iInline[aSize]);
146 inline TInt TDbBlob::RefSize()
148 return _FOFF(TDbBlob,iInline[0]);
152 inline TInt TDbCell::Size(TInt aLength)
154 return Align4(aLength+sizeof(TInt));
157 inline TInt TDbCell::Size() const
159 return Size(iLength);
162 inline TInt TDbCell::Length() const
167 inline const TDbCell* TDbCell::Next() const
169 return PtrAdd(this,Size());
172 inline TDbCell* TDbCell::Next()
174 return PtrAdd(this,Size());
177 inline TAny* TDbCell::Data()
182 inline const TAny* TDbCell::Data() const
187 inline void TDbCell::SetLength(TInt aLength)
193 inline TDbColumnC::TDbColumnC(const RDbRow& aRow,TDbColNo aCol) :
194 iCell(aRow.ColCell(aCol))
198 inline TInt TDbColumnC::Size() const
200 return iCell->Length();
203 inline TBool TDbColumnC::IsNull() const
208 inline TInt8 TDbColumnC::Int8() const
210 return TInt8(*(const TInt32*)iCell->Data());
213 inline TInt16 TDbColumnC::Int16() const
215 return TInt16(*(const TInt32*)iCell->Data());
218 inline TInt32 TDbColumnC::Int32() const
220 return *(const TInt32*)iCell->Data();
223 inline const TInt64& TDbColumnC::Int64() const
225 return *(const TInt64*)iCell->Data();
228 inline TUint8 TDbColumnC::Uint8() const
230 return TUint8(*(const TUint8*)iCell->Data());
233 inline TUint16 TDbColumnC::Uint16() const
235 return TUint16(*(const TUint32*)iCell->Data());
238 inline TUint32 TDbColumnC::Uint32() const
240 return *(const TUint32*)iCell->Data();
243 inline TReal32 TDbColumnC::Real32() const
245 return *(const TReal32*)iCell->Data();
248 inline const TReal64& TDbColumnC::Real64() const
250 return *(const TReal64*)iCell->Data();
253 inline TPtrC8 TDbColumnC::PtrC8() const
255 return TPtrC8((const TUint8*)iCell->Data(),iCell->Length());
258 inline TPtrC16 TDbColumnC::PtrC16() const
260 return TPtrC16((const TUint16*)iCell->Data(),iCell->Length()>>1);
263 inline const TTime& TDbColumnC::Time() const
265 return *(const TTime*)iCell->Data();
268 inline const TDbBlob& TDbColumnC::Blob() const
270 return *(const TDbBlob*)iCell->Data();
274 inline TDbColumn::TDbColumn()
281 inline TDbColumn::TDbColumn(RDbRow& aRow,TDbColNo aCol) :
287 inline RDbRow& TDbColumn::Row() const
289 __ASSERT_DEBUG(iRow,User::Invariant());
293 inline void TDbColumn::SetNull()
295 //SetColumnWidthL() can't leave when the second parameter value is 0 ("aWidth" parameter).
296 //TRAP_IGNORE() not used because makes the code heavier and SetNull() is a public, exported, inline method.
297 //coverity[naming_error]
298 Row().SetColumnWidthL(iColumn,0);
301 inline void TDbColumn::SetL(TInt32 aValue)
303 SetL(TUint32(aValue));
306 inline void TDbColumn::SetL(const TTime& aValue)
308 SetL(aValue.Int64());
311 inline void TDbColumn::SetL(const TDbCell* aCell)
313 SetL(aCell->Data(),aCell->Length());
316 inline void TDbColumn::SetL(const TDbColumnC& aColumn)
322 inline TDbColumnC::TDbColumnC(const TDbColumn& aCol) :
323 iCell(aCol.Row().ColCell(aCol.iColumn))
328 inline RDbRow::RDbRow(TAny* aBuf,TInt aMaxSize)
330 Open(aBuf,0,aMaxSize);
333 inline RDbRow::RDbRow(TAny* aBuf,TInt aSize,TInt aMaxSize)
335 Open(aBuf,aSize,aMaxSize);
338 inline void RDbRow::Open(TAny* aBuf,TInt aMaxSize)
340 Open(aBuf,0,aMaxSize);
343 inline void RDbRow::Reset()
348 inline TDbCell* RDbRow::First()
353 inline const TDbCell* RDbRow::First() const
358 inline const TDbCell* RDbRow::Last() const
363 inline const TDbCell* RDbRow::End() const
368 inline TInt RDbRow::Diff(const TDbCell* aLeft,const TDbCell* aRight)
370 return (const TUint8*)aRight-(const TUint8*)aLeft;
373 inline TInt RDbRow::Size() const
375 return Diff(iFirst,iLast);
378 inline TInt RDbRow::MaxSize() const
380 return Diff(iFirst,iEnd);
384 inline const CDbContext* CDbObject::Context() const
390 // Class RDbHandleBase
391 inline void RDbHandleBase::Set(CDbObject* aObject)
396 // template Class RDbHandle
398 inline T* RDbHandle<T>::operator=(T* aT)
404 inline T* RDbHandle<T>::operator->() const
406 return &STATIC_CAST(T&,Object());
410 inline T& RDbHandle<T>::operator*() const
412 return STATIC_CAST(T&,Object());
416 inline T* RDbHandle<T>::operator()() const
418 return STATIC_CAST(T*,iObject);