本文整理汇总了C++中CContactDatabase::FileSize方法的典型用法代码示例。如果您正苦于以下问题:C++ CContactDatabase::FileSize方法的具体用法?C++ CContactDatabase::FileSize怎么用?C++ CContactDatabase::FileSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CContactDatabase
的用法示例。
在下文中一共展示了CContactDatabase::FileSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConstructL
void CTestResources::ConstructL(TInt aNumberOfContactsToAddToExistingDatabase, TBool aCreateNewDatabase)
{
if (aCreateNewDatabase)
iDb = CContactDatabase::ReplaceL(KTestDbName);
else
iDb = CContactDatabase::OpenL(KTestDbName);
if(!iRandomGenerator)
{
iRandomGenerator=CRandomContactGenerator::NewL();
}
iRandomGenerator->SetDbL(*iDb);
CreateContactsL(aNumberOfContactsToAddToExistingDatabase);
// done adding everything to the database
TCntProfile profile[1];
CCntTest::ProfileReset(0,1);
CCntTest::ProfileStart(0);
iDb->CompactL();
CCntTest::ProfileEnd(0);
CCntTest::ProfileResult(&profile[0],0,1);
TInt timeToCompact = profile[0].iTime/1000;
CCntTest::ProfileReset(0,1);
CCntTest::ProfileStart(0);
delete iDb;
iDb=NULL;
CCntTest::ProfileEnd(0);
CCntTest::ProfileResult(&profile[0],0,1);
TInt timeToClose = profile[0].iTime; // in microseconds
CCntTest::ProfileReset(0,1);
CCntTest::ProfileStart(0);
iDb = CContactDatabase::OpenL(KTestDbName);
CCntTest::ProfileEnd(0);
CCntTest::ProfileResult(&profile[0],0,1);
iRandomGenerator->SetDbL(*iDb);
TInt timeToOpen = profile[0].iTime/1000;
TInt numberOfContactsInDb=iDb->CountL();
iViewEventQueue = CContactViewEventQueue::NewL(NULL, numberOfContactsInDb*2);
TInt i;
for(i = 0; i< GNumberOfFieldsToSort; i++)
{
iViewSortOrder.AppendL(TUid::Uid(GFieldsToSort[i]));
}
iLocalView = CContactLocalView::NewL(*iViewEventQueue, *iDb, iViewSortOrder, EContactsOnly);
// Wait 100 seconds for the view to get ready
TContactViewEvent event;
CCntTest::ProfileReset(0,1);
CCntTest::ProfileStart(0);
test(iViewEventQueue->ListenForEvent(100,event));
CCntTest::ProfileEnd(0);
CCntTest::ProfileResult(&profile[0],0,1);
test(event.iEventType == TContactViewEvent::EReady);
TBuf<128> result;
result.Format(_L("*%C Contacts: %d\t"),static_cast<TUint>(GChar),numberOfContactsInDb);
RDebug::Print(result);
result.Format(_L("\tView ready: %d ms\t\tOpen: %d ms\t\tClose: %d us\t\tCompact: %d ms\t"),
profile[0].iTime/1000, timeToOpen, timeToClose, timeToCompact);
RDebug::Print(result);
result.Format(_L("\tSize: %d bytes\n"),iDb->FileSize());
RDebug::Print(result);
iFindFields = new(ELeave)CContactItemFieldDef;
}