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 TInt DbsMessage(TInt aFunction,TInt aHandle)
19 return (aFunction<<KDbsHandleBits)|aHandle;
22 inline TDbsFunction DbsFunction(TInt aMessage)
24 return TDbsFunction(aMessage>>KDbsHandleBits);
27 inline TInt DbsHandle(TInt aMessage)
29 return aMessage&KDbsHandleMask;
32 inline TDbsType DbsType(TInt aHandle)
34 return TDbsType(aHandle&KDbsTypeMask);
37 inline TInt DbsMagic(TInt aHandle)
39 return (aHandle>>KDbsTypeBits)&KDbsMagicMask;
42 inline TInt DbsObjectIndex(TInt aHandle)
44 return aHandle>>(KDbsTypeBits+KDbsMagicBits);
47 inline TInt DbsMakeHandle(TInt aIndex,TInt aMagic,TDbsType aType)
49 return (((aIndex<<KDbsMagicBits)|aMagic)<<KDbsTypeBits)|aType;
52 inline TInt DbsSessionHandle()
54 return DbsMakeHandle(1<<(KDbsIndexBits-1),0,EDbsSession);
57 // streaming functions
58 inline RWriteStream& operator<<(RWriteStream& aStream,const TDbCol& aCol)
60 ExternalizeL(aCol,aStream);
64 inline RWriteStream& operator<<(RWriteStream& aStream,const CDbColSet& aColSet)
66 ExternalizeL(aColSet,aStream);
70 inline RReadStream& operator>>(RReadStream& aStream,CDbColSet& aColSet)
72 InternalizeL(aColSet,aStream);
76 inline RWriteStream& operator<<(RWriteStream& aStream,const CDbKey& aKey)
78 ExternalizeL(aKey,aStream);
82 inline RReadStream& operator>>(RReadStream& aStream,CDbKey& aKey)
84 InternalizeL(aKey,aStream);
88 inline RWriteStream& operator<<(RWriteStream& aStream,const CDbNames& aNames)
90 ExternalizeL(aNames,aStream);
94 inline RReadStream& operator>>(RReadStream& aStream,CDbNames& aNames)
96 InternalizeL(aNames,aStream);
101 This operator is used for externalizing CDbStrings array to a stream.
104 inline RWriteStream& operator<<(RWriteStream& aStream,const CDbStrings& aStrings)
106 ExternalizeL(aStrings,aStream);
111 This operator is used for internalizing CDbStrings array from a stream.
114 inline RReadStream& operator>>(RReadStream& aStream,CDbStrings& aStrings)
116 InternalizeL(aStrings,aStream);
121 inline TExternalizeFunction Externalizer(const T*)
123 return TExternalizer<T>::Function();
127 inline void TDbsParam::operator=(const TDesC8& aDes)
132 inline void TDbsParam::operator=(const TDesC16& aDes)
137 inline void TDbsParam::operator=(TInt aVal)
143 inline RDbsObject::RDbsObject():
148 inline RDbsObject::RDbsObject(const RDbs& aDbs):
150 iHandle(KDbsSessionHandle)
154 inline TInt RDbsObject::Handle() const
159 inline void RDbsObject::OpenL(const RDbsObject& aDbs,TDbsFunction aFunction)
161 OpenL(aDbs,aFunction,0);
164 inline void RDbsObject::OpenL(const RDbsObject& aDbs,TDbsFunction aFunction,const TIpcArgs& aArgs)
166 OpenL(aDbs,aFunction,&aArgs);
169 inline void RDbsObject::OpenL(const RDbs& aDbs,TDbsFunction aFunction,const TIpcArgs& aArgs)
171 OpenL(RDbsObject(aDbs),aFunction,&aArgs);
174 inline void RDbsObject::SendReceive(TDbsFunction aFunction,TRequestStatus& aStatus) const
176 SendReceive(aFunction,0,aStatus);
179 inline TInt RDbsObject::SendReceive(TDbsFunction aFunction,const TIpcArgs& aArgs) const
181 return SendReceive(aFunction,&aArgs);
184 inline TInt RDbsObject::SendReceiveL(TDbsFunction aFunction,const TIpcArgs& aArgs) const
186 return SendReceiveL(aFunction,&aArgs);
189 inline void RDbsObject::SendReceive(TDbsFunction aFunction,const TIpcArgs& aArgs,TRequestStatus& aStatus) const
191 SendReceive(aFunction,&aArgs,aStatus);
194 // Class CDbsDatabase
195 inline CDbsDatabase::CDbsDatabase()
199 // Class CDbsNotifier
200 inline CDbsNotifier::CDbsNotifier()
204 // Class CDbsIncrmental
205 inline CDbsIncremental::CDbsIncremental()
209 // Class CDbsConstraint
210 inline CDbsConstraint::CDbsConstraint()
215 inline HDbsBuf::HDbsBuf()
220 inline HDbsBuf::~HDbsBuf()
225 inline void HDbsBuf::SetPos(TRead,TInt aPos)
230 inline void HDbsBuf::SetPos(TWrite,TInt aPos)
235 inline TInt HDbsBuf::Pos(TRead) const
240 inline TInt HDbsBuf::Pos(TWrite) const
245 inline TInt HDbsBuf::MovePos(TRead,TInt anOffset)
247 return iRPos+=anOffset;
250 inline TInt HDbsBuf::MovePos(TWrite,TInt anOffset)
252 return iWPos+=anOffset;
255 inline TInt HDbsBuf::Lag(TRead) const
257 return Ptr(ERead)-End(ERead);
260 inline TInt HDbsBuf::Lag(TWrite) const
262 return Ptr(EWrite)-iBuf.iData;
265 inline TInt HDbsBuf::Mark(TRead) const
267 return Pos(ERead)+Lag(ERead);
270 inline TInt HDbsBuf::Mark(TWrite) const
272 return Pos(EWrite)+Lag(EWrite);
276 inline TInt CDbsSource::LinkOffset()
278 return _FOFF(CDbsSource,iLink);
281 inline CDbsSource::CDbsSource(const TDbFormat& aFormat):
286 inline void CDbsSource::Open()
291 inline CDbSource& CDbsSource::Source()
297 // Class CDbsDatabaseStub
298 inline CDbsDatabaseStub::CDbsDatabaseStub()
302 // Class CDbsConnection
303 inline void CDbsConnection::Set(CDbsSource& aSource)
310 inline CDbsSource& CDbsConnection::Source() const
316 inline const CDbsConnection& CDbsConnection::Connection(const CDbObject& aObject)
318 __ASSERT(aObject.Context());
319 return *STATIC_CAST(const CDbsConnection*,aObject.Context());
322 inline CDbsSource& CDbsConnection::Source(const CDbObject& aObject)
324 return Connection(aObject).Source();
328 inline RDbsSources::RDbsSources(RDbCache& aCache):
329 iSources(CDbsSource::LinkOffset()),
334 inline void RDbsSources::Close()
336 __ASSERT(iSources.IsEmpty());
341 inline TDes& CDbsServer::Name0()
346 inline TDes& CDbsServer::Name1()
351 inline TDes& CDbsServer::FileName()
356 inline RDbsSources& CDbsServer::Sources()
361 inline RFs& CDbsServer::Fs()
366 inline RDriveSpaceCol& CDbsServer::DriveSpaceCol()
368 return iDriveSpaceCol;
371 inline void CDbsServer::Panic(const TDesC& aCategory,TInt aPanic)
373 Message().Panic(aCategory,aPanic);
376 inline CPolicyProxy& CDbsServer::PolicyProxy() const
378 __ASSERT(iPolicyProxy);
379 return *iPolicyProxy;
382 inline RDbPropsFactory& CDbsServer::DbPropsFactory()
384 return iDbPropsFactory;
387 // Class CDbsSession::TEntry
388 inline TDbsType CDbsSession::TEntry::Type() const
390 return TDbsType(iType);
393 inline CDbsDatabaseStub& CDbsSession::TEntry::DatabaseStub()
395 __ASSERT(Type()==EDbsDatabase);
396 return *STATIC_CAST(CDbsDatabaseStub*,iObject);
399 inline CDbDatabase& CDbsSession::TEntry::Database()
401 __ASSERT(Type()==EDbsDatabase);
402 return *STATIC_CAST(CDbDatabase*,iObject);
405 inline CDbIncremental& CDbsSession::TEntry::Incremental()
407 __ASSERT(Type()==EDbsIncremental);
408 return *STATIC_CAST(CDbIncremental*,iObject);
411 inline CDbCursor& CDbsSession::TEntry::Cursor()
413 __ASSERT(Type()==EDbsCursor);
414 return *STATIC_CAST(CDbCursor*,iObject);
417 inline CDbRowConstraint& CDbsSession::TEntry::Constraint()
419 __ASSERT(Type()==EDbsConstraint);
420 return *STATIC_CAST(CDbRowConstraint*,iObject);
423 inline HDbsStream& CDbsSession::TEntry::Stream()
425 __ASSERT(Type()==EDbsStream);
426 return *STATIC_CAST(HDbsStream*,iObject);
429 inline CDbsObserver::HObserver& CDbsSession::TEntry::Observer()
431 __ASSERT(Type()==EDbsObserver);
432 return *STATIC_CAST(CDbsObserver::HObserver*,iObject);
436 inline TInt CDbsSession::Add(CDbIncremental* aIncremental, const MPolicy* aPolicy)
438 return DoAdd(aIncremental,EDbsIncremental, aPolicy);
441 inline TInt CDbsSession::Add(CDbCursor* aCursor, const MPolicy* aPolicy)
443 return DoAdd(aCursor,EDbsCursor, aPolicy);
446 inline TInt CDbsSession::Add(CDbRowConstraint* aConstraint, const MPolicy* aPolicy)
448 return DoAdd(aConstraint,EDbsConstraint, aPolicy);
451 inline TInt CDbsSession::Add(HDbsStream* aStream, const MPolicy* aPolicy)
453 return DoAdd(aStream,EDbsStream, aPolicy);
456 inline TInt CDbsSession::Add(CDbsObserver::HObserver* aObserver, const MPolicy* aPolicy)
458 return DoAdd(aObserver,EDbsObserver, aPolicy);
461 inline CDbsServer& CDbsSession::Server() const
463 return *static_cast<CDbsServer*>(const_cast<CServer2*>(CSession2::Server()));
466 inline RDbsSources& CDbsSession::Sources()
468 return Server().Sources();
472 inline HDbsStream::HDbsStream(MStreamBuf* aHost,TInt aReadPos):
480 inline HDbsStream::~HDbsStream()
485 inline TInt HDbsStream::SizeL()
487 return iHost.SizeL();
490 inline void HDbsStream::SynchL()
496 inline HBufBuf::HBufBuf():
501 inline HBufBuf::~HBufBuf()
506 // Class CDbsSecureDatabase
507 inline CDbsSecureDatabase::CDbsSecureDatabase()