本文整理汇总了C++中TMsvEntry::SetParent方法的典型用法代码示例。如果您正苦于以下问题:C++ TMsvEntry::SetParent方法的具体用法?C++ TMsvEntry::SetParent怎么用?C++ TMsvEntry::SetParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TMsvEntry
的用法示例。
在下文中一共展示了TMsvEntry::SetParent方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateEntry
/**
Creates a new entry as a child of the current context.
Ownership of the created entry is given to the process with the specified SID.
The parent ID and entry ID are set by the Message Server.
@param aEntry
Index entry value for the new entry
@param aOwnerId
The SID of the process that will own the create entry.
@param aBulk
A boolean value to indicate whether this is part of a bulk operation. (ETrue = bulk)
@return
KErrNone - success; KErrNoMemory - a memory allocation failed;
KErrNotSupported - aEntry is invalid
*/
EXPORT_C TInt CMsvServerEntry::CreateEntry(TMsvEntry& aEntry, TSecureId aOwnerId, TBool aBulk)
{
__ASSERT_DEBUG(iEntry.Id()!=KMsvNullIndexEntryId, PanicServer(EMsvEntryWithNoContext2));
aEntry.SetParent(iEntry.Id());
__ASSERT_DEBUG(MsvUtils::ValidEntry(aEntry, ETrue), PanicServer(EMsvBadEntryContents));
// if valid - try to create the new child
TInt error;
if (iEntry.Id()==KMsvNullIndexEntryId || !MsvUtils::ValidEntry(aEntry, ETrue))
error = KErrNotSupported;
else
{
error = iServer.AddEntry(aEntry, aOwnerId, ETrue, aBulk);
// if the child was created,then notify everyone, otherwise reset the parent
if (error)
aEntry.SetParent(KMsvNullIndexEntryId);
else
{
if (!aBulk)
{
iServer.NotifyChanged(EMsvEntriesCreated, aEntry.Id(), aEntry.Parent());
}
iEntry.SetOwner(ETrue);
}
}
return error;
}
示例2: AddEntry
void CTestSearchSortDeltaCache::AddEntry()
{
_LIT(KFunction, "AddEntry");
INFO_PRINTF1(KFunction);
TSecureId aOwnerId = 0x999;
sampleTMsvEntry.iDate.UniversalTime();
sampleTMsvEntry.SetParent(4096);
sampleTMsvEntry.iType = KUidMsvMessageEntry;
sampleTMsvEntry.SetId(10);
iIndexAdapter->AddEntry(sampleTMsvEntry, aOwnerId, ETrue);
ASSERT_TRUE(iSearchSortDeltaCache->iNewEntry.Count() == 1 );
}
示例3: TestChangeEntry
void CTestSearchSortDeltaCache::TestChangeEntry()
{
_LIT(KFunction, "TestChangeEntry");
INFO_PRINTF1(KFunction);
TSecureId aOwnerId = 0x999;
sampleTMsvEntry.iDate.UniversalTime();
sampleTMsvEntry.SetParent(4096);
sampleTMsvEntry.iType = KUidMsvMessageEntry;
sampleTMsvEntry.SetId(10);
iIndexAdapter->AddEntry(sampleTMsvEntry, aOwnerId, ETrue);
TInt32 mtm1 = 35;
TInt32 mtm2 = 45;
sampleTMsvEntry.SetMtmData1(mtm1);
sampleTMsvEntry.SetMtmData2(mtm2);
iIndexAdapter->ChangeEntry(sampleTMsvEntry, 0x999, ETrue);
ASSERT_TRUE(iSearchSortDeltaCache->iUpdateEntry.Count() == 0 );
}
示例4: TestMoveMultipleEntry
void CTestPerformanceM::TestMoveMultipleEntry()
{
_LIT(KFunction, "TestMoveMultipleEntry");
INFO_PRINTF1(KFunction);
TSecureId owner = 0x999;
TUint32 start, stop;
TMsvEntry entry;
CMsvEntry* parent = NULL;
TMsvLocalOperationProgress progress = TMsvLocalOperationProgress();
CMsvEntrySelection* entries = new(ELeave) CMsvEntrySelection;
TReal64 diff = 0;
iServerSide = EFalse;
INFO_PRINTF1(_L("<b>CLIENT SIDE</b>"));
TInt frequency;
HAL::Get(HALData::EFastCounterFrequency, frequency);
INFO_PRINTF2(_L("<b>FastCounter frequency: %d</b>"), frequency);
parent = iTestUtils->iMsvSession->GetEntryL(KMsvDraftEntryId);
//[1]. Move entries from Drafts to Outbox, and back again, and so on.
for(TInt index = 0; index < 10; ++index)
{
TMsvEntry entry;
entry.SetId((TMsvId)20000+index);
entry.SetParent(KMsvDraftEntryId);
entry.iType = KUidMsvMessageEntry;
entry.iMtm = KUidMsvMessageEntry;
entry.iServiceId = KMsvLocalServiceIndexEntryId;
parent->CreateL(entry);
entries->AppendL(entry.iId);
}
parent->SetEntryNoCheckL(KMsvDraftEntryId); //bring to cache
start = User::FastCounter();
parent->MoveL(*entries, KMsvGlobalOutBoxIndexEntryId, progress); //iTestActive->iStatus);
stop = User::FastCounter();
diff = (TReal64)(stop-start)/frequency;
INFO_PRINTF3(_L("---Time taken to MOVE %d entries from Drafts which has 10 entries: <b>%f sec</b>"), 10, diff);
MY_ASSERT_EQUALS(entries->Count(), 10);
parent->SetEntryL(KMsvGlobalOutBoxIndexEntryId);
for(TInt index = 0; index < 90; ++index)
{
TMsvEntry entry;
entry.SetId((TMsvId)21000+index);
entry.SetParent(KMsvGlobalOutBoxIndexEntryId);
entry.iType = KUidMsvMessageEntry;
entry.iMtm = KUidMsvMessageEntry;
entry.iServiceId = KMsvLocalServiceIndexEntryId;
parent->CreateL(entry);
entries->AppendL(entry.iId);
}
parent->SetEntryNoCheckL(KMsvGlobalOutBoxIndexEntryId); //bring to cache
start = User::FastCounter();
parent->MoveL(*entries, KMsvDraftEntryId, progress);
stop = User::FastCounter();
diff = (TReal64)(stop-start)/frequency;
INFO_PRINTF3(_L("---Time taken to MOVE %d entries from Outbox which has 100 entries: <b>%f sec</b>"), 100, diff);
MY_ASSERT_EQUALS(entries->Count(), 100);
parent->SetEntryL(KMsvDraftEntryId);
for(TInt index = 0; index < 400; ++index)
{
TMsvEntry entry;
entry.SetId((TMsvId)22000+index);
entry.SetParent(KMsvDraftEntryId);
entry.iType = KUidMsvMessageEntry;
entry.iMtm = KUidMsvMessageEntry;
entry.iServiceId = KMsvLocalServiceIndexEntryId;
parent->CreateL(entry);
entries->AppendL(entry.iId);
}
start = User::FastCounter();
parent->MoveL(*entries, KMsvGlobalOutBoxIndexEntryId, progress);
stop = User::FastCounter();
diff = (TReal64)(stop-start)/frequency;
INFO_PRINTF3(_L("---Time taken to MOVE %d entries from Drafts which has 500 entries: <b>%f sec</b>"), 500, diff);
MY_ASSERT_EQUALS(entries->Count(), 500);
parent->SetEntryL(KMsvGlobalOutBoxIndexEntryId);
for(TInt index = 0; index < 500; ++index)
{
TMsvEntry entry;
entry.SetId((TMsvId)22000+index);
entry.SetParent(KMsvGlobalOutBoxIndexEntryId);
entry.iType = KUidMsvMessageEntry;
entry.iMtm = KUidMsvMessageEntry;
entry.iServiceId = KMsvLocalServiceIndexEntryId;
parent->CreateL(entry);
entries->AppendL(entry.iId);
}
start = User::FastCounter();
parent->MoveL(*entries, KMsvDraftEntryId, progress);
stop = User::FastCounter();
diff = (TReal64)(stop-start)/frequency;
INFO_PRINTF3(_L("---Time taken to MOVE %d entries from Outbox which has 1000 entries: <b>%f sec</b>"), 1000, diff);
MY_ASSERT_EQUALS(entries->Count(), 1000);
//.........这里部分代码省略.........
示例5: LocalizeStandardFoldersL
void CMsvIndexContext::LocalizeStandardFoldersL()
{
// Get ready to read resource
TResourceReader reader;
reader.SetBuffer(iBuf);
// Read initial entries from resources
const TInt numberOfEntries = reader.ReadInt16();
for (TInt ii=0; ii<numberOfEntries; ii++)
{
TMsvEntry resourceEntry;
// Values from resource file
resourceEntry.iId = reader.ReadInt32();
resourceEntry.iParentId = reader.ReadInt32();
resourceEntry.iServiceId = reader.ReadInt32();
resourceEntry.iType.iUid = reader.ReadInt32();
resourceEntry.iMtm.iUid = reader.ReadInt32();
resourceEntry.iData = reader.ReadInt32();
resourceEntry.iDescription.Set(reader.ReadTPtrC());
resourceEntry.iDetails.Set(reader.ReadTPtrC());
// Add Universal time and initialise size
resourceEntry.iDate.UniversalTime();
resourceEntry.iSize=0;
TMsvEntry *entry;
// 557. Will by default pick entries from current drive.
TInt error = iIndexAdapter->GetEntry(resourceEntry.Id(),entry);
if(error ==KErrNone)
{
TMsvEntry newEntry= *entry;
TBool changed=EFalse;
if(newEntry.iDescription.Compare(resourceEntry.iDescription)!=0)
{
newEntry.iDescription.Set(resourceEntry.iDescription);
changed=ETrue;
}
if(newEntry.iDetails.Compare(resourceEntry.iDetails)!=0)
{
newEntry.iDetails.Set(resourceEntry.iDetails);
changed=ETrue;
}
// ignore the error we don't want to fail just because the
// inbox isn't in the right language, we will try again next
// time the server starts.
if(changed!=EFalse)
{
iIndexAdapter->LockEntry(newEntry.Id());
iIndexAdapter->ChangeEntryInternal(newEntry, KMsvServerId);
iIndexAdapter->ReleaseEntry(newEntry.Id());
}
}
else if( error == KErrNotFound )
{
#if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT)
resourceEntry.SetParent(MaskTMsvId(KCurrentDriveId, resourceEntry.iParentId));
resourceEntry.SetId(MaskTMsvId(KCurrentDriveId, resourceEntry.iId));
#endif
// Create the new entry
iServer.AddEntry(this, resourceEntry, KMsvServerId, EFalse);
}
}
}