os/persistentdata/persistentstorage/dbms/sdbms/SD_STD.INL
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
sl@0
    17
inline TInt DbsMessage(TInt aFunction,TInt aHandle)
sl@0
    18
	{
sl@0
    19
	return (aFunction<<KDbsHandleBits)|aHandle;
sl@0
    20
	}
sl@0
    21
sl@0
    22
inline TDbsFunction DbsFunction(TInt aMessage)
sl@0
    23
	{
sl@0
    24
	return TDbsFunction(aMessage>>KDbsHandleBits);
sl@0
    25
	}
sl@0
    26
sl@0
    27
inline TInt DbsHandle(TInt aMessage)
sl@0
    28
	{
sl@0
    29
	return aMessage&KDbsHandleMask;
sl@0
    30
	}
sl@0
    31
sl@0
    32
inline TDbsType DbsType(TInt aHandle)
sl@0
    33
	{
sl@0
    34
	return TDbsType(aHandle&KDbsTypeMask);
sl@0
    35
	}
sl@0
    36
sl@0
    37
inline TInt DbsMagic(TInt aHandle)
sl@0
    38
	{
sl@0
    39
	return (aHandle>>KDbsTypeBits)&KDbsMagicMask;
sl@0
    40
	}
sl@0
    41
sl@0
    42
inline TInt DbsObjectIndex(TInt aHandle)
sl@0
    43
	{
sl@0
    44
	return aHandle>>(KDbsTypeBits+KDbsMagicBits);
sl@0
    45
	}
sl@0
    46
sl@0
    47
inline TInt DbsMakeHandle(TInt aIndex,TInt aMagic,TDbsType aType)
sl@0
    48
	{
sl@0
    49
	return (((aIndex<<KDbsMagicBits)|aMagic)<<KDbsTypeBits)|aType;
sl@0
    50
	}
sl@0
    51
sl@0
    52
inline TInt DbsSessionHandle()
sl@0
    53
	{
sl@0
    54
	return DbsMakeHandle(1<<(KDbsIndexBits-1),0,EDbsSession);
sl@0
    55
	}
sl@0
    56
sl@0
    57
// streaming functions
sl@0
    58
inline RWriteStream& operator<<(RWriteStream& aStream,const TDbCol& aCol)
sl@0
    59
	{
sl@0
    60
	ExternalizeL(aCol,aStream);
sl@0
    61
	return aStream;
sl@0
    62
	}
sl@0
    63
sl@0
    64
inline RWriteStream& operator<<(RWriteStream& aStream,const CDbColSet& aColSet)
sl@0
    65
	{
sl@0
    66
	ExternalizeL(aColSet,aStream);
sl@0
    67
	return aStream;
sl@0
    68
	}
sl@0
    69
sl@0
    70
inline RReadStream& operator>>(RReadStream& aStream,CDbColSet& aColSet)
sl@0
    71
	{
sl@0
    72
	InternalizeL(aColSet,aStream);
sl@0
    73
	return aStream;
sl@0
    74
	}
sl@0
    75
sl@0
    76
inline RWriteStream& operator<<(RWriteStream& aStream,const CDbKey& aKey)
sl@0
    77
	{
sl@0
    78
	ExternalizeL(aKey,aStream);
sl@0
    79
	return aStream;
sl@0
    80
	}
sl@0
    81
sl@0
    82
inline RReadStream& operator>>(RReadStream& aStream,CDbKey& aKey)
sl@0
    83
	{
sl@0
    84
	InternalizeL(aKey,aStream);
sl@0
    85
	return aStream;
sl@0
    86
	}
sl@0
    87
sl@0
    88
inline RWriteStream& operator<<(RWriteStream& aStream,const CDbNames& aNames)
sl@0
    89
	{
sl@0
    90
	ExternalizeL(aNames,aStream);
sl@0
    91
	return aStream;
sl@0
    92
	}
sl@0
    93
sl@0
    94
inline RReadStream& operator>>(RReadStream& aStream,CDbNames& aNames)
sl@0
    95
	{
sl@0
    96
	InternalizeL(aNames,aStream);
sl@0
    97
	return aStream;
sl@0
    98
	}
sl@0
    99
sl@0
   100
/**
sl@0
   101
This operator is used for externalizing CDbStrings array to a stream.
sl@0
   102
@internalComponent
sl@0
   103
*/	
sl@0
   104
inline RWriteStream& operator<<(RWriteStream& aStream,const CDbStrings& aStrings)
sl@0
   105
	{
sl@0
   106
	ExternalizeL(aStrings,aStream);
sl@0
   107
	return aStream;
sl@0
   108
	}
sl@0
   109
sl@0
   110
/**
sl@0
   111
This operator is used for internalizing CDbStrings array from a stream.
sl@0
   112
@internalComponent
sl@0
   113
*/	
sl@0
   114
inline RReadStream& operator>>(RReadStream& aStream,CDbStrings& aStrings)
sl@0
   115
	{
sl@0
   116
	InternalizeL(aStrings,aStream);
sl@0
   117
	return aStream;
sl@0
   118
	}
sl@0
   119
sl@0
   120
template <class T>
sl@0
   121
inline TExternalizeFunction Externalizer(const T*)
sl@0
   122
	{
sl@0
   123
	return TExternalizer<T>::Function();
sl@0
   124
	}
sl@0
   125
sl@0
   126
// Class TDbsParam
sl@0
   127
inline void TDbsParam::operator=(const TDesC8& aDes)
sl@0
   128
	{
sl@0
   129
	iPtr=&aDes;
sl@0
   130
	}
sl@0
   131
sl@0
   132
inline void TDbsParam::operator=(const TDesC16& aDes)
sl@0
   133
	{
sl@0
   134
	iPtr=&aDes;
sl@0
   135
	}
sl@0
   136
sl@0
   137
inline void TDbsParam::operator=(TInt aVal)
sl@0
   138
	{
sl@0
   139
	iInt=aVal;
sl@0
   140
	}
sl@0
   141
sl@0
   142
// Class RDbsObject
sl@0
   143
inline RDbsObject::RDbsObject():
sl@0
   144
	iHandle(0)
sl@0
   145
	{
sl@0
   146
	}
sl@0
   147
sl@0
   148
inline RDbsObject::RDbsObject(const RDbs& aDbs):
sl@0
   149
	RDbs(aDbs),
sl@0
   150
	iHandle(KDbsSessionHandle)
sl@0
   151
	{
sl@0
   152
	}
sl@0
   153
sl@0
   154
inline TInt RDbsObject::Handle() const
sl@0
   155
	{
sl@0
   156
	return iHandle;
sl@0
   157
	}
sl@0
   158
sl@0
   159
inline void RDbsObject::OpenL(const RDbsObject& aDbs,TDbsFunction aFunction)
sl@0
   160
	{
sl@0
   161
	OpenL(aDbs,aFunction,0);
sl@0
   162
	}
sl@0
   163
sl@0
   164
inline void RDbsObject::OpenL(const RDbsObject& aDbs,TDbsFunction aFunction,const TIpcArgs& aArgs)
sl@0
   165
	{
sl@0
   166
	OpenL(aDbs,aFunction,&aArgs);
sl@0
   167
	}
sl@0
   168
sl@0
   169
inline void RDbsObject::OpenL(const RDbs& aDbs,TDbsFunction aFunction,const TIpcArgs& aArgs)
sl@0
   170
	{
sl@0
   171
	OpenL(RDbsObject(aDbs),aFunction,&aArgs);
sl@0
   172
	}
sl@0
   173
sl@0
   174
inline void RDbsObject::SendReceive(TDbsFunction aFunction,TRequestStatus& aStatus) const
sl@0
   175
	{
sl@0
   176
	SendReceive(aFunction,0,aStatus);
sl@0
   177
	}
sl@0
   178
sl@0
   179
inline TInt RDbsObject::SendReceive(TDbsFunction aFunction,const TIpcArgs& aArgs) const
sl@0
   180
	{
sl@0
   181
	return SendReceive(aFunction,&aArgs);
sl@0
   182
	}
sl@0
   183
sl@0
   184
inline TInt RDbsObject::SendReceiveL(TDbsFunction aFunction,const TIpcArgs& aArgs) const
sl@0
   185
	{
sl@0
   186
	return SendReceiveL(aFunction,&aArgs);
sl@0
   187
	}
sl@0
   188
sl@0
   189
inline void RDbsObject::SendReceive(TDbsFunction aFunction,const TIpcArgs& aArgs,TRequestStatus& aStatus) const
sl@0
   190
	{
sl@0
   191
	SendReceive(aFunction,&aArgs,aStatus);
sl@0
   192
	}
sl@0
   193
sl@0
   194
// Class CDbsDatabase
sl@0
   195
inline CDbsDatabase::CDbsDatabase()
sl@0
   196
	{
sl@0
   197
	}
sl@0
   198
sl@0
   199
// Class CDbsNotifier
sl@0
   200
inline CDbsNotifier::CDbsNotifier()
sl@0
   201
	{
sl@0
   202
	}
sl@0
   203
sl@0
   204
// Class CDbsIncrmental
sl@0
   205
inline CDbsIncremental::CDbsIncremental()
sl@0
   206
	{
sl@0
   207
	}
sl@0
   208
sl@0
   209
// Class CDbsConstraint
sl@0
   210
inline CDbsConstraint::CDbsConstraint()
sl@0
   211
	{
sl@0
   212
	}
sl@0
   213
sl@0
   214
// Class HDbsBuf
sl@0
   215
inline HDbsBuf::HDbsBuf()
sl@0
   216
	{
sl@0
   217
	iBuf.iExt=-1;
sl@0
   218
	}
sl@0
   219
sl@0
   220
inline HDbsBuf::~HDbsBuf()
sl@0
   221
	{
sl@0
   222
	iIpc.Close();
sl@0
   223
	}
sl@0
   224
sl@0
   225
inline void HDbsBuf::SetPos(TRead,TInt aPos)
sl@0
   226
	{
sl@0
   227
	iRPos=aPos;
sl@0
   228
	}
sl@0
   229
sl@0
   230
inline void HDbsBuf::SetPos(TWrite,TInt aPos)
sl@0
   231
	{
sl@0
   232
	iWPos=aPos;
sl@0
   233
	}
sl@0
   234
sl@0
   235
inline TInt HDbsBuf::Pos(TRead) const
sl@0
   236
	{
sl@0
   237
	return iRPos;
sl@0
   238
	}
sl@0
   239
sl@0
   240
inline TInt HDbsBuf::Pos(TWrite) const
sl@0
   241
	{
sl@0
   242
	return iWPos;
sl@0
   243
	}
sl@0
   244
sl@0
   245
inline TInt HDbsBuf::MovePos(TRead,TInt anOffset)
sl@0
   246
	{
sl@0
   247
	return iRPos+=anOffset;
sl@0
   248
	}
sl@0
   249
sl@0
   250
inline TInt HDbsBuf::MovePos(TWrite,TInt anOffset)
sl@0
   251
	{
sl@0
   252
	return iWPos+=anOffset;
sl@0
   253
	}
sl@0
   254
sl@0
   255
inline TInt HDbsBuf::Lag(TRead) const
sl@0
   256
	{
sl@0
   257
	return Ptr(ERead)-End(ERead);
sl@0
   258
	}
sl@0
   259
sl@0
   260
inline TInt HDbsBuf::Lag(TWrite) const
sl@0
   261
	{
sl@0
   262
	return Ptr(EWrite)-iBuf.iData;
sl@0
   263
	}
sl@0
   264
sl@0
   265
inline TInt HDbsBuf::Mark(TRead) const
sl@0
   266
	{
sl@0
   267
	return Pos(ERead)+Lag(ERead);
sl@0
   268
	}
sl@0
   269
sl@0
   270
inline TInt HDbsBuf::Mark(TWrite) const
sl@0
   271
	{
sl@0
   272
	return Pos(EWrite)+Lag(EWrite);
sl@0
   273
	}
sl@0
   274
sl@0
   275
// Class CDbsSource
sl@0
   276
inline TInt CDbsSource::LinkOffset()
sl@0
   277
	{
sl@0
   278
	return _FOFF(CDbsSource,iLink);
sl@0
   279
	}
sl@0
   280
sl@0
   281
inline CDbsSource::CDbsSource(const TDbFormat& aFormat):
sl@0
   282
	iFormat(aFormat)
sl@0
   283
	{
sl@0
   284
	}
sl@0
   285
sl@0
   286
inline void CDbsSource::Open()
sl@0
   287
	{
sl@0
   288
	++iConnections;
sl@0
   289
	}
sl@0
   290
sl@0
   291
inline CDbSource& CDbsSource::Source()
sl@0
   292
	{
sl@0
   293
	__ASSERT(iSource);
sl@0
   294
	return *iSource;
sl@0
   295
	}
sl@0
   296
sl@0
   297
// Class CDbsDatabaseStub
sl@0
   298
inline CDbsDatabaseStub::CDbsDatabaseStub()
sl@0
   299
	{
sl@0
   300
	}
sl@0
   301
sl@0
   302
// Class CDbsConnection
sl@0
   303
inline void CDbsConnection::Set(CDbsSource& aSource)
sl@0
   304
	{
sl@0
   305
	__ASSERT(!iSource);
sl@0
   306
	iSource=&aSource;
sl@0
   307
	aSource.Open();
sl@0
   308
	}
sl@0
   309
sl@0
   310
inline CDbsSource& CDbsConnection::Source() const
sl@0
   311
	{
sl@0
   312
	__ASSERT(iSource);
sl@0
   313
	return *iSource;
sl@0
   314
	}
sl@0
   315
sl@0
   316
inline const CDbsConnection& CDbsConnection::Connection(const CDbObject& aObject)
sl@0
   317
	{
sl@0
   318
	__ASSERT(aObject.Context());
sl@0
   319
	return *STATIC_CAST(const CDbsConnection*,aObject.Context());
sl@0
   320
	}
sl@0
   321
sl@0
   322
inline CDbsSource& CDbsConnection::Source(const CDbObject& aObject)
sl@0
   323
	{
sl@0
   324
	return Connection(aObject).Source();
sl@0
   325
	}
sl@0
   326
sl@0
   327
// Class RDbsSources
sl@0
   328
inline RDbsSources::RDbsSources(RDbCache& aCache):
sl@0
   329
  	iSources(CDbsSource::LinkOffset()),
sl@0
   330
  	iDrivers(aCache)
sl@0
   331
  	{
sl@0
   332
  	}
sl@0
   333
  
sl@0
   334
inline void RDbsSources::Close()
sl@0
   335
  	{
sl@0
   336
  	__ASSERT(iSources.IsEmpty());
sl@0
   337
  	iDrivers.Close();
sl@0
   338
  	}
sl@0
   339
  
sl@0
   340
// Class CDbsServer
sl@0
   341
inline TDes& CDbsServer::Name0()
sl@0
   342
	{
sl@0
   343
	return iName0;
sl@0
   344
	}
sl@0
   345
sl@0
   346
inline TDes& CDbsServer::Name1()
sl@0
   347
	{
sl@0
   348
	return iName1;
sl@0
   349
	}
sl@0
   350
sl@0
   351
inline TDes& CDbsServer::FileName()
sl@0
   352
	{
sl@0
   353
	return iFileName;
sl@0
   354
	}
sl@0
   355
sl@0
   356
inline RDbsSources& CDbsServer::Sources()
sl@0
   357
	{
sl@0
   358
	return iSources;
sl@0
   359
	}
sl@0
   360
sl@0
   361
inline RFs& CDbsServer::Fs()
sl@0
   362
	{
sl@0
   363
	return iFs;
sl@0
   364
	}
sl@0
   365
sl@0
   366
inline RDriveSpaceCol& CDbsServer::DriveSpaceCol()
sl@0
   367
	{
sl@0
   368
	return iDriveSpaceCol;
sl@0
   369
	}
sl@0
   370
sl@0
   371
inline void CDbsServer::Panic(const TDesC& aCategory,TInt aPanic)
sl@0
   372
	{
sl@0
   373
	Message().Panic(aCategory,aPanic);
sl@0
   374
	}
sl@0
   375
sl@0
   376
inline CPolicyProxy& CDbsServer::PolicyProxy() const
sl@0
   377
	{
sl@0
   378
	__ASSERT(iPolicyProxy);
sl@0
   379
	return *iPolicyProxy;
sl@0
   380
	}
sl@0
   381
sl@0
   382
inline RDbPropsFactory& CDbsServer::DbPropsFactory()
sl@0
   383
	{
sl@0
   384
	return iDbPropsFactory;
sl@0
   385
	}
sl@0
   386
sl@0
   387
// Class CDbsSession::TEntry
sl@0
   388
inline TDbsType CDbsSession::TEntry::Type() const
sl@0
   389
	{
sl@0
   390
	return TDbsType(iType);
sl@0
   391
	}
sl@0
   392
sl@0
   393
inline CDbsDatabaseStub& CDbsSession::TEntry::DatabaseStub()
sl@0
   394
	{
sl@0
   395
	__ASSERT(Type()==EDbsDatabase);
sl@0
   396
	return *STATIC_CAST(CDbsDatabaseStub*,iObject);
sl@0
   397
	}
sl@0
   398
sl@0
   399
inline CDbDatabase& CDbsSession::TEntry::Database()
sl@0
   400
	{
sl@0
   401
	__ASSERT(Type()==EDbsDatabase);
sl@0
   402
	return *STATIC_CAST(CDbDatabase*,iObject);
sl@0
   403
	}
sl@0
   404
sl@0
   405
inline CDbIncremental& CDbsSession::TEntry::Incremental()
sl@0
   406
	{
sl@0
   407
	__ASSERT(Type()==EDbsIncremental);
sl@0
   408
	return *STATIC_CAST(CDbIncremental*,iObject);
sl@0
   409
	}
sl@0
   410
sl@0
   411
inline CDbCursor& CDbsSession::TEntry::Cursor()
sl@0
   412
	{
sl@0
   413
	__ASSERT(Type()==EDbsCursor);
sl@0
   414
	return *STATIC_CAST(CDbCursor*,iObject);
sl@0
   415
	}
sl@0
   416
sl@0
   417
inline CDbRowConstraint& CDbsSession::TEntry::Constraint()
sl@0
   418
	{
sl@0
   419
	__ASSERT(Type()==EDbsConstraint);
sl@0
   420
	return *STATIC_CAST(CDbRowConstraint*,iObject);
sl@0
   421
	}
sl@0
   422
sl@0
   423
inline HDbsStream& CDbsSession::TEntry::Stream()
sl@0
   424
	{
sl@0
   425
	__ASSERT(Type()==EDbsStream);
sl@0
   426
	return *STATIC_CAST(HDbsStream*,iObject);
sl@0
   427
	}
sl@0
   428
sl@0
   429
inline CDbsObserver::HObserver& CDbsSession::TEntry::Observer()
sl@0
   430
	{
sl@0
   431
	__ASSERT(Type()==EDbsObserver);
sl@0
   432
	return *STATIC_CAST(CDbsObserver::HObserver*,iObject);
sl@0
   433
	}
sl@0
   434
sl@0
   435
// Class CDbsSession
sl@0
   436
inline TInt CDbsSession::Add(CDbIncremental* aIncremental, const MPolicy* aPolicy)
sl@0
   437
	{
sl@0
   438
	return DoAdd(aIncremental,EDbsIncremental, aPolicy);
sl@0
   439
	}
sl@0
   440
sl@0
   441
inline TInt CDbsSession::Add(CDbCursor* aCursor, const MPolicy* aPolicy)
sl@0
   442
	{
sl@0
   443
	return DoAdd(aCursor,EDbsCursor, aPolicy);
sl@0
   444
	}
sl@0
   445
sl@0
   446
inline TInt CDbsSession::Add(CDbRowConstraint* aConstraint, const MPolicy* aPolicy)
sl@0
   447
	{
sl@0
   448
	return DoAdd(aConstraint,EDbsConstraint, aPolicy);
sl@0
   449
	}
sl@0
   450
sl@0
   451
inline TInt CDbsSession::Add(HDbsStream* aStream, const MPolicy* aPolicy)
sl@0
   452
	{
sl@0
   453
	return DoAdd(aStream,EDbsStream, aPolicy);
sl@0
   454
	}
sl@0
   455
sl@0
   456
inline TInt CDbsSession::Add(CDbsObserver::HObserver* aObserver, const MPolicy* aPolicy)
sl@0
   457
	{
sl@0
   458
	return DoAdd(aObserver,EDbsObserver, aPolicy);
sl@0
   459
	}
sl@0
   460
sl@0
   461
inline CDbsServer& CDbsSession::Server() const
sl@0
   462
	{
sl@0
   463
	return *static_cast<CDbsServer*>(const_cast<CServer2*>(CSession2::Server()));
sl@0
   464
	}
sl@0
   465
sl@0
   466
inline RDbsSources& CDbsSession::Sources()
sl@0
   467
	{
sl@0
   468
	return Server().Sources();
sl@0
   469
	}
sl@0
   470
sl@0
   471
// Class HDbsStream
sl@0
   472
inline HDbsStream::HDbsStream(MStreamBuf* aHost,TInt aReadPos):
sl@0
   473
	iHost(*aHost),
sl@0
   474
	iRPos(aReadPos),
sl@0
   475
	iWPos(0)
sl@0
   476
	{
sl@0
   477
	__ASSERT(aHost);
sl@0
   478
	}
sl@0
   479
sl@0
   480
inline HDbsStream::~HDbsStream()
sl@0
   481
	{
sl@0
   482
	iHost.Release();
sl@0
   483
	}
sl@0
   484
sl@0
   485
inline TInt HDbsStream::SizeL()
sl@0
   486
	{
sl@0
   487
	return iHost.SizeL();
sl@0
   488
	}
sl@0
   489
sl@0
   490
inline void HDbsStream::SynchL()
sl@0
   491
	{
sl@0
   492
	iHost.SynchL();
sl@0
   493
	}
sl@0
   494
sl@0
   495
// Class HBufBuf
sl@0
   496
inline HBufBuf::HBufBuf():
sl@0
   497
	iBuf(0)
sl@0
   498
	{
sl@0
   499
	}
sl@0
   500
sl@0
   501
inline HBufBuf::~HBufBuf()
sl@0
   502
	{
sl@0
   503
	delete iBuf;
sl@0
   504
	}
sl@0
   505
sl@0
   506
// Class CDbsSecureDatabase
sl@0
   507
inline CDbsSecureDatabase::CDbsSecureDatabase()
sl@0
   508
	{
sl@0
   509
	}
sl@0
   510