本文整理汇总了C++中TBuf8::AllocLC方法的典型用法代码示例。如果您正苦于以下问题:C++ TBuf8::AllocLC方法的具体用法?C++ TBuf8::AllocLC怎么用?C++ TBuf8::AllocLC使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBuf8
的用法示例。
在下文中一共展示了TBuf8::AllocLC方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddEntryL
void CDummyCalendarApp::AddEntryL(TInt aNumToAdd, TBool isParent, TBool isRepeat)
{
test.Next(_L("Adding entries"));
TBuf<50> summary;
TBuf<50> location;
TBuf<50> description;
iEntries.ResetAndDestroy();
for (TInt index=0; index<aNumToAdd; index++)
{
TBuf8<255> buf;
buf.Append(_L("GuidId"));
buf.AppendNum(index);
HBufC8* guid = buf.AllocLC(); // need to be pushed to ...
CCalEntry::TType entryType=(index%2==0)?CCalEntry::ETodo:CCalEntry::EAppt;
CCalEntry* entry = NULL;
if(isParent)
{
entry = CreateCalEntryL(entryType, guid);
}
else
{
TTime localTime(KRecurrIdLocalTime);
TCalTime recurrenceId;
recurrenceId.SetTimeLocalL(localTime);
entry = CCalEntry::NewL(entryType, guid, CCalEntry::EMethodAdd, 1, recurrenceId, CalCommon::EThisAndFuture);
}
CleanupStack::Pop(guid);
iEntries.AppendL(entry);
TInt year = -1;
TInt month = -1;
TInt day = -1;
if (isParent)
{
year = index % 5 + 2001; // Any year in the range: 2001 - 2005
month = index % 12;
day = index % 28;
}
else
{
// if this is a child entry, use the recurrence local time as the entry start time
// so it won't be out of range
TCalTime recurrId = entry->RecurrenceIdL();
TDateTime localTime = recurrId.TimeLocalL().DateTime();
year = localTime.Year();
month = localTime.Month();
day = localTime.Day();
}
TTime start(TDateTime(year, (TMonth)month, day, 0, 0, 0, 0));
TTime end(TDateTime(year, (TMonth)month, day, 0, 0, 0, 0));
end += TTimeIntervalDays(1);
SetEntryStartAndEndTimeL(entry,start,end);
RandomText(summary);
entry->SetSummaryL(summary);
RandomText(location);
entry->SetLocationL(location);
RandomText(description);
entry->SetDescriptionL(description);
if(isRepeat)
{
//create a daily repeat rule and make sure its repeat start\end date is within the deleting time range
TCalRRule rpt(TCalRRule::EDaily);
rpt.SetInterval(1);
TCalTime repeatStart;
TCalTime repeatend;
if(isParent)
{
//make sure the repeat time is within the delete time range
repeatStart.SetTimeLocalL(TDateTime(2000, EJune, 0, 0, 0, 0, 0));
repeatend.SetTimeLocalL(TDateTime(2006, EJune, 0, 0, 0, 0, 0));
}
else if (index<aNumToAdd/2)
{
// if this is a child entry, use the entry's recurrance time as repeating rule
// start time
TCalTime recurrId = entry->RecurrenceIdL();
// make sure the repeat time is within the delete time range for the first half entries
repeatStart.SetTimeLocalL(recurrId.TimeLocalL()); // June 1, 2003 00:00:00
repeatend.SetTimeLocalL(recurrId.TimeLocalL() + TTimeIntervalMonths(1)); // July 1, 2003 00:00:00
}
else
{
//make sure the repeat time is out of the delete time range for the second half entries
repeatStart.SetTimeLocalL(TDateTime(2003, EJune, 0, 0, 0, 0, 0));
repeatend.SetTimeLocalL(TDateTime(2007, EJune, 0, 0, 0, 0, 0));
}
//.........这里部分代码省略.........
示例2: endtimetime
void CDummyCalendarApp::Add3ReminderAnd1ApptL()
{
test.Next(_L("Create some entries including day note and delete them"));
//Create entries
iEntries.ResetAndDestroy();
//create reminder 1
TBuf8<255> buf;
buf.Append(_L("GuidId_Reminder_1"));
HBufC8* guid = buf.AllocLC();
CCalEntry* reminder1 = CCalEntry::NewL(CCalEntry::EReminder, guid, CCalEntry::EMethodAdd, 0);
CleanupStack::Pop(guid);
iEntries.AppendL(reminder1);
TCalTime starttime;
starttime.SetTimeLocalL(TDateTime(2006, EMarch, 5, 0, 0, 0, 0));
reminder1->SetStartAndEndTimeL(starttime, starttime);
TBuf<50> summary;
RandomText(summary);
reminder1->SetSummaryL(summary);
//create reminder 2
buf.Delete(buf.Length()-1,1);
buf.Append(2);
guid = buf.AllocLC();
CCalEntry* reminder2 = CCalEntry::NewL(CCalEntry::EReminder, guid, CCalEntry::EMethodAdd, 0);
CleanupStack::Pop(guid);
iEntries.AppendL(reminder2);
starttime.SetTimeLocalL(TDateTime(2006, EMarch, 6, 0, 0, 0, 0));
reminder2->SetStartAndEndTimeL(starttime, starttime);
RandomText(summary);
reminder2->SetSummaryL(summary);
//create reminder 3
buf.Delete(buf.Length()-1,1);
buf.Append(3);
guid = buf.AllocLC();
CCalEntry* reminder3 = CCalEntry::NewL(CCalEntry::EReminder, guid, CCalEntry::EMethodAdd, 0);
CleanupStack::Pop(guid);
iEntries.AppendL(reminder3);
starttime.SetTimeLocalL(TDateTime(2006, EMarch, 7, 0, 0, 0, 0));
reminder3->SetStartAndEndTimeL(starttime, starttime);
RandomText(summary);
reminder3->SetSummaryL(summary);
//Create appt
buf.Zero();
buf.Append(_L("GuidId_Appt"));
guid = buf.AllocLC();
CCalEntry* appt = CCalEntry::NewL(CCalEntry::EAppt, guid, CCalEntry::EMethodAdd, 0);
CleanupStack::Pop(guid);
iEntries.AppendL(appt);
starttime.SetTimeLocalL(TDateTime(2006, EMarch, 7, 14, 0, 0, 0));
TTime endtimetime(TDateTime(2006, EMarch, 7, 14, 0, 0, 0));
endtimetime +=TTimeIntervalHours(1);
TCalTime endtime;
endtime.SetTimeLocalL(endtimetime);
appt->SetStartAndEndTimeL(starttime, endtime);
RandomText(summary);
appt->SetSummaryL(summary);
//store 4 entries
TInt entriesStored(0);
SynCGetEntryViewL().StoreL(iEntries, entriesStored);
test(entriesStored == 4);
iEntries.ResetAndDestroy();
}
示例3: if
//.........这里部分代码省略.........
{
TInt32 seqNum = aStream.ReadInt32L();
CCalEntry::TMethod method = static_cast<CCalEntry::TMethod> (aStream.ReadInt8L());
TCalLocalUid parentId = aStream.ReadUint32L();
entry = CAgnEntry::NewL(entryType, NULL, method, seqNum, TAgnCalendarTime(), CalCommon::EThisOnly);
CleanupStack::PushL(entry);
entry->SetParentId(parentId);
}
break;
case EGsParent: // fall through
case ENonGsEntry:
// this is a non-GS entry, get the GUID from the unique ID, entry == NULL
break;
default:
{
User::Leave(KErrCorrupt);
}
}
// Read in entry's unique Id
//
TCalLocalUid localUid;
aStream >> localUid;
// create entry now we have all the information
if (!entry) // create non-GS entry from unique ID
{
TBuf8<32> uniqueIdBuf;
uniqueIdBuf.AppendNum(localUid);
HBufC8* guid = uniqueIdBuf.AllocLC();
entry = CAgnEntry::NewL(entryType, guid, CCalEntry::EMethodNone, 0);
CleanupStack::Pop(guid);
CleanupStack::PushL(entry);
}
entry->SetStatus(status);
entry->SetLocalUid(localUid);
// TReplicationData was next in 9.1/9.2, with the following data:
// TStatus iStatus;
// TBool iHasBeenDeleted;
// TUint iCount;
// TAgnCalendarTime iLastChangedDateUtc
//
entry->SetReplicationStatusL(static_cast<CCalEntry::TReplicationStatus>(aStream.ReadInt8L()));
TBool hasBeenDeleted = aStream.ReadUint8L();// Not used in 9.3 but checked later
aStream.ReadUint8L();//skip iCount
TAgnCalendarTime lastChangedDate;
aStream >> lastChangedDate;
entry->SetLastModifiedDateUtc(lastChangedDate.UtcL());
// CAgnRptDef
//
// In 9.1/9.2, the second bit of the 'attributes'
// indicates presence/absence of a repeat definition
//
CArrayFixFlat<TAgnCalendarTime>* exceptions = NULL;
if (attributes & EBit2)
{
exceptions = InternalizeRptDefL(aStream, *entry);
}