本文整理汇总了C++中TPtr类的典型用法代码示例。如果您正苦于以下问题:C++ TPtr类的具体用法?C++ TPtr怎么用?C++ TPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RDEBUG
void CAMPreInstallApp::ListPreInstalledAppL(const TDesC& installDocPath)
{
RDEBUG("Clist_PreInstallAppUi: ListPreInstalledApp: <<<<");
CDir* dir= NULL;
TInt err = iFs.GetDir(installDocPath, KEntryAttNormal, ESortByName, dir);
// _LIT(KInstallpath,"C:\\private\\10202dce\\");
//TInt err = iFs.GetDir(KInstallpath, KEntryAttNormal, ESortByName, dir);
RDEBUG_2("Clist_PreInstallAppUi: ListPreInstalledApp: err in getting dir list : %d",err);
if (err==KErrNone)
{
CleanupStack::PushL(dir);
RDEBUG_2("Clist_PreInstallAppUi: ListPreInstalledApp: no of dir's : %d",dir->Count());
for (TInt i(0); i < dir->Count(); i++)
{
RDEBUG_2("Clist_PreInstallAppUi: ListPreInstalledApp: <<<< dir entry %d", i);
TEntry entry;
entry = (*dir)[i];
HBufC* pathAndName = HBufC::NewLC(installDocPath.Length()
+ entry.iName.Length() );
TPtr ptrPathAndName = pathAndName->Des();
ptrPathAndName.Append(installDocPath);
ptrPathAndName.Append(entry.iName);
HBufC* mimeType = HBufC::NewLC(KMaxDataTypeLength);
//Recognize
if (!RecognizeL(*pathAndName, mimeType))
{
CleanupStack::PopAndDestroy(mimeType);
CleanupStack::PopAndDestroy(pathAndName);
continue;
}
#ifdef RD_MULTIPLE_DRIVE
if (TParsePtrC(installDocPath).Path().CompareF(KPreInstallPath)
== 0)
#else
if (installDocPath.CompareF(iPreInstallPath) == 0)
#endif
{
RDEBUG("Clist_PreInstallAppUi: ListPreInstalledApp: <<<< Entered installDocPath.CompareF(iPreInstallPath)");
Swi::RSisRegistrySession regSession;
CleanupClosePushL(regSession);
User::LeaveIfError(regSession.Connect() );
RArray<TUid> uids;
CleanupClosePushL(uids);
regSession.InstalledUidsL(uids);
RFile temp;
User::LeaveIfError(temp.Open(iFs, *pathAndName,
EFileShareReadersOnly | EFileRead) );
CleanupClosePushL(temp);
TUid appUid;
TInt uidLen = sizeof(TInt32);
TInt seekLen = sizeof(TInt32) + sizeof(TInt32);
User::LeaveIfError(temp.Seek(ESeekStart, seekLen));
TPckg<TInt32> uid1(appUid.iUid);
User::LeaveIfError(temp.Read(uid1, uidLen));
if (uid1.Length() != uidLen)
{
User::Leave(KErrUnderflow);
}
//checking whether this is installed or not
TBool installed = regSession.IsInstalledL(appUid);
Swi::RSisRegistryEntry registryEntry;
TInt regEntryError = registryEntry.Open(regSession, appUid);
RDEBUG_2("Clist_PreInstallAppUi: ListPreInstalledApp: RegEntryError : %d",regEntryError);
//User::LeaveIfError(regEntryError);
if (regEntryError == KErrNone)
{
CleanupClosePushL(registryEntry);
TBool isPreInstalled = registryEntry.PreInstalledL();
// TBool isPreInstalled = ETrue;
RDEBUG_4("Clist_PreInstallAppUi: ListPreInstalledApp: UID is : '0x%X', installed:, preinstalled %d %d",appUid,installed,isPreInstalled);
for (TInt i(0); isPreInstalled && i < uids.Count(); i++)
{
if (appUid == uids[i])
{
RDEBUG("Clist_PreInstallAppUi: appUid == uids[i]");
Swi::CSisRegistryPackage* sisRegistry = NULL;
TRAPD( err, sisRegistry = regSession.SidToPackageL( uids[i] ) ) ;
//User::LeaveIfError(err);
if(err == KErrNone)
{
RDEBUG("Clist_PreInstallAppUi: err == KErrNone");
TPreInstalledAppParams *params =
//.........这里部分代码省略.........
示例2: _AKNTRACE
EXPORT_C void CSettingsListBoxItemDrawer::DrawItemText( TInt aItemIndex,
const TRect& aItemTextRect,
TBool aItemIsCurrent,
TBool /*aViewIsEmphasized*/,
TBool /*aItemIsSelected*/) const
{
_AKNTRACE_FUNC_ENTER;
_AKNTRACE("DrawItemText: aItemIndex=%d, aItemTextRect=(%d,%d,%d,%d), aItemIsCurrent=%d",
aItemIndex, aItemTextRect.iTl.iX, aItemTextRect.iTl.iY, aItemTextRect.iBr.iX,
aItemTextRect.iBr.iY, aItemIsCurrent);
#ifdef RD_UI_TRANSITION_EFFECTS_LIST
MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( iGc );
if ( transApi )
{
transApi->StartDrawing( MAknListBoxTfxInternal::EListNotSpecified );
}
#endif //RD_UI_TRANSITION_EFFECTS_LIST
iGc->SetBrushColor( AKN_LAF_COLOR( 0 ) );
#ifdef RD_UI_TRANSITION_EFFECTS_LIST
if ( transApi )
{
transApi->StopDrawing();
}
#endif //RD_UI_TRANSITION_EFFECTS_LIST
DrawBackgroundAndSeparatorLines( aItemTextRect );
if ( aItemIsCurrent )
{
FormattedCellData()->SetCurrentItemIndex( aItemIndex );
}
FormattedCellData()->SetCurrentlyDrawnItemIndex( aItemIndex );
FormattedCellData()->DrawSettingHighlight( *iGc, aItemTextRect, aItemIsCurrent );
TBool drawBackground = ETrue;
TPtrC temp = iModel->ItemText( aItemIndex );
TPtrC columnText;
TextUtils::ColumnText( columnText, 3, &temp );
if ( columnText == KNullDesC )
{
drawBackground = EFalse;
}
#ifdef RD_UI_TRANSITION_EFFECTS_LIST
if ( transApi )
{
transApi->StartDrawing( MAknListBoxTfxInternal::EListItem );
iGc->SetClippingRect( iViewRect );
}
#endif // RD_UI_TRANSITION_EFFECTS_LIST
// draw setting item's background
if ( drawBackground )
{
TAknLayoutRect outerRect;
TAknWindowComponentLayout valuePane;
#ifdef RD_LIST_STRETCH
if ( Layout_Meta_Data::IsLandscapeOrientation() &&
Layout_Meta_Data::IsListStretchingEnabled() &&
FormattedCellData()->StretchingEnabled() )
{
valuePane = AknLayoutScalable_Avkon::set_value_pane_cp_vc( 0 );
}
else
#endif // RD_LIST_STRETCH
{
valuePane = AknLayoutScalable_Avkon::set_value_pane_cp( 0 );
}
outerRect.LayoutRect( aItemTextRect, TAknWindowComponentLayout::Compose(
valuePane,
AknLayoutScalable_Avkon::bg_set_opt_pane( 0 ) ).LayoutLine() );
TBool frameDrawn = EFalse;
MAknsControlContext *cc = AknsDrawUtils::ControlContext( FormattedCellData()->Control() );
if ( !cc )
{
cc = FormattedCellData()->SkinBackgroundContext();
}
if ( cc )
{
TAknLayoutRect innerRect;
innerRect.LayoutRect( aItemTextRect, TAknWindowComponentLayout::Compose(
valuePane,
AknLayoutScalable_Avkon::bg_set_opt_pane_g1() ).LayoutLine() );
frameDrawn = AknsDrawUtils::DrawFrame( AknsUtils::SkinInstance(),
*iGc,
outerRect.Rect(),
innerRect.Rect(),
KAknsIIDQsnFrSetOptFoc,
KAknsIIDQsnFrSetOptFocCenter );
}
//.........这里部分代码省略.........
示例3: ShowSingleValueL
void CPixelMetricsMapperAppUi::ShowSingleValueL(TInt& aPixelMetric, TInt& aValue, TBool& aLast )
{
HBufC* buffer = HBufC::NewLC( 100 );
TPtr bufferPtr = buffer->Des();
switch (aPixelMetric)
{
case QStyle::PM_DockWidgetTitleMargin:
bufferPtr.Append(_L("DockTitleMargin: "));
break;
case QStyle::PM_DockWidgetTitleBarButtonMargin:
bufferPtr.Append(_L("DockTitleBtnMargin: "));
break;
case QStyle::PM_ButtonMargin:
bufferPtr.Append(_L("ButtonMargin: "));
break;
case QStyle::PM_ButtonDefaultIndicator:
bufferPtr.Append(_L("ButtonDefaultIndicator: "));
break;
case QStyle::PM_MdiSubWindowFrameWidth:
bufferPtr.Append(_L("MdiSubWndFrameW: "));
break;
case QStyle::PM_ComboBoxFrameWidth:
bufferPtr.Append(_L("ComboBoxFrameWidth: "));
break;
case QStyle::PM_SpinBoxFrameWidth:
bufferPtr.Append(_L("SpinBoxFrameWidth: "));
break;
case QStyle::PM_DefaultFrameWidth:
bufferPtr.Append(_L("DefaultFrameWidth: "));
break;
case QStyle::PM_RadioButtonLabelSpacing:
bufferPtr.Append(_L("RadioButtonLabelSpc: "));
break;
case QStyle::PM_CheckBoxLabelSpacing:
bufferPtr.Append(_L("CheckBoxLabelSpacing: "));
break;
case QStyle::PM_ToolTipLabelFrameWidth:
bufferPtr.Append(_L("ToolTipLabelFrameW: "));
break;
case QStyle::PM_ListViewIconSize:
bufferPtr.Append(_L("ListViewIconSize: "));
break;
case QStyle::PM_LargeIconSize:
bufferPtr.Append(_L("LargeIconSize: "));
break;
case QStyle::PM_IconViewIconSize:
bufferPtr.Append(_L("IconViewIconSize: "));
break;
case QStyle::PM_TabBarIconSize:
bufferPtr.Append(_L("TabBarIconSize: "));
break;
case QStyle::PM_MessageBoxIconSize:
bufferPtr.Append(_L("MessageBoxIconSize: "));
break;
case QStyle::PM_ButtonIconSize:
bufferPtr.Append(_L("ButtonIconSize: "));
break;
case QStyle::PM_TextCursorWidth:
bufferPtr.Append(_L("TextCursorWidth: "));
break;
case QStyle::PM_SliderLength:
bufferPtr.Append(_L("SliderLength: "));
break;
case QStyle::PM_SliderThickness:
bufferPtr.Append(_L("SliderThickness: "));
break;
case QStyle::PM_SliderTickmarkOffset:
bufferPtr.Append(_L("SliderTickmarkOffset: "));
break;
case QStyle::PM_SliderControlThickness:
bufferPtr.Append(_L("SliderCntrlThickness: "));
break;
case QStyle::PM_SliderSpaceAvailable:
bufferPtr.Append(_L("SliderSpaceAvailable: "));
break;
case QStyle::PM_MenuBarItemSpacing:
bufferPtr.Append(_L("MenuBarItemSpacing: "));
break;
case QStyle::PM_MenuBarHMargin:
bufferPtr.Append(_L("MenuBarHMargin: "));
break;
case QStyle::PM_MenuBarVMargin:
bufferPtr.Append(_L("MenuBarVMargin: "));
break;
case QStyle::PM_ToolBarItemSpacing:
bufferPtr.Append(_L("ToolBarItemSpacing: "));
break;
case QStyle::PM_ToolBarFrameWidth:
bufferPtr.Append(_L("ToolBarFrameWidth: "));
break;
case QStyle::PM_ToolBarItemMargin:
bufferPtr.Append(_L("ToolBarItemMargin: "));
break;
case QStyle::PM_LayoutLeftMargin:
bufferPtr.Append(_L("LayoutLeftMargin: "));
break;
case QStyle::PM_LayoutRightMargin:
bufferPtr.Append(_L("LayoutRightMargin: "));
break;
//.........这里部分代码省略.........
示例4: switch
// ----------------------------------------------------
// CSymellaAppUi::HandleCommandL(TInt aCommand)
// ?implementation_description
// ----------------------------------------------------
//
void CSymellaAppUi::HandleCommandL(TInt aCommand)
{
switch ( aCommand )
{
case ESymellaCmdConnect:
{
CTR->ConnectL();
}
break;
case ESymellaCmdSelectGenre:
{
TInt index = 0;
CAknListQueryDialog* queryDialog = new(ELeave) CAknListQueryDialog(&index);
if(queryDialog->ExecuteLD(R_SYMELLA_GENRE_SELECTION_LIST))
{
CTR->SetGenre(index);
}
}
break;
case ESymellaCmdResetHostCache:
{
// ask to quit
CAknQueryDialog* query = CAknQueryDialog::NewL();
CleanupStack::PushL(query);
_LIT(KPrompt, "Are you sure you want to reset the hostcache?");
query->SetPromptL(KPrompt);
CleanupStack::Pop(); // query
if (query->ExecuteLD(R_GENERAL_QUERY))
{
CTR->HostCache().Reset();
}
}
break;
case ESymellaCmdDisconnect:
{
CTR->DisconnectL();
}
break;
case ESymellaCmdConnectInfo:
{
HBufC* info = CTR->CreateConnectInfoL();
CleanupStack::PushL(info);
/*CAknNoteDialog* note = new (ELeave) CAknNoteDialog;
CleanupStack::PushL(note);
note->SetTextL(*info);
CleanupStack::Pop();
note->PrepareLC(R_CONNECTION_INFO_NOTE);
note->RunLD();*/
CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog();
dlg->PrepareLC( R_MESSAGE_QUERY );
dlg->SetMessageTextL(info->Des());
dlg->QueryHeading()->SetTextL(_L("Connect info"));
dlg->RunLD();
CleanupStack::PopAndDestroy(); //info
}
break;
case ESymellaCmdAbout:
{
TBuf<30> time;
TBuf<50> date;
date.Copy(_L8(__DATE__));
time.Copy(_L8(__TIME__));
_LIT(KBuild, "Built on ");
HBufC* info = HBufC::NewLC(TPtrC(KAbout).Length() + 64 /*+ TPtrC(KEngineVersion).Length() */+
TPtrC(KBuild).Length() + date.Length() + 4);
TPtr des = info->Des();
des.Append(_L("Version "));
des.Append(SYMELLA_VERSION_LIT);
des.Append(KAbout);
//des.Append(KEngineVersion);
des.Append(KBuild);
des.Append(date);
CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog();
CleanupStack::PushL(dlg);
dlg->PrepareLC( R_MESSAGE_QUERY );
dlg->SetMessageTextL(des);
dlg->QueryHeading()->SetTextL(_L("Symella S60"));
CleanupStack::Pop(); //dlg
dlg->RunLD();
CleanupStack::PopAndDestroy(); //info
}
break;
case ESymellaCmdAddNode:
//.........这里部分代码省略.........
示例5: SetBIOServiceIdL
TMsvId TestUniDataModelVCalPlugin::CreateBIOEntryL(TDesC& aText,
TBIOMessageType aMessageType)
{
// Ensure that we have a valid service ID to work with:
TMsvId iBioServiceId;
iBioServiceId = SetBIOServiceIdL();
HBufC* localBuffer = aText.AllocL();
CleanupStack::PushL(localBuffer);
TPtr messDes = localBuffer->Des();
if (aMessageType != EBiovCardMessage && aMessageType
!= EBiovCalenderMessage)
{
// convert \r\n to \n since this is what is expected from SMS when not vCard data
for (TInt i = 0; i < messDes.Length(); i++)
{
if (messDes[i] == (TText) '\r' && i < messDes.Length() - 1
&& messDes[i + 1] == (TText) '\n')
messDes.Delete(i, 1);
}
}
// Create and fill a CRichText object for the jobbie:
CParaFormatLayer* paraFormatLayer = CParaFormatLayer::NewL();
CleanupStack::PushL(paraFormatLayer);
CCharFormatLayer* charFormatLayer = CCharFormatLayer::NewL();
CleanupStack::PushL(charFormatLayer);
CRichText* richText = CRichText::NewL(paraFormatLayer, charFormatLayer);
CleanupStack::PushL(richText);
TInt pos = richText->DocumentLength();
richText->InsertL(pos, messDes);
TMsvEntry newBioEntry;
newBioEntry.SetNew(ETrue);
newBioEntry.SetComplete(EFalse);
newBioEntry.SetUnread(ETrue);
newBioEntry.SetVisible(ETrue);
newBioEntry.SetReadOnly(EFalse);
newBioEntry.SetFailed(EFalse);
newBioEntry.SetOperation(EFalse);
newBioEntry.SetMultipleRecipients(EFalse);
newBioEntry.SetAttachment(EFalse);
newBioEntry.iMtm = KUidBIOMessageTypeMtm;
newBioEntry.iType = KUidMsvMessageEntry;
newBioEntry.iServiceId = iBioServiceId;
TTime now;
now.UniversalTime();
newBioEntry.iDate = now;
TTime unixEpoch(KUnixEpoch);
TTimeIntervalSeconds seconds;
TTime timeStamp = newBioEntry.iDate;
timeStamp.SecondsFrom(unixEpoch, seconds);
retTimeStamp.setTime_t(seconds.Int());
newBioEntry.iDescription.Set(richText->Read(0, richText->DocumentLength()));
TBufC<KTelephoneNumberMaxLength> telNumber;
QString recepient(TEST_MSG_FROM1);
tempNumber = XQConversions::qStringToS60Desc(recepient);
telNumber = tempNumber->Des();
newBioEntry.iDetails.Set(telNumber);
SetForMtmTypeL(newBioEntry, aMessageType);
newBioEntry.iSize = richText->DocumentLength();// msgSize;
CreateBioEntryClientSideL(newBioEntry, *richText);
CleanupStack::PopAndDestroy(4); // richText, charFormatLayer, paraFormatLayer, localBuffer
return newBioEntry.Id();
}
示例6: file
// ---------------------------------------------------------
// CPosTp149::PrintParsedDataFromEncoderL
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CPosTp149::PrintParsedDataFromEncoderL(
const TDesC& aFile,
const TDesC8& aBuffer,
TInt aExpectedStatusCode,
const TDesC8& aMimeType)
{
iLog->Log(_L("===== PrintParsedDataFromEncoderL ======="));
iLandmarkParser = CPosLandmarkParser::NewL(aMimeType);
if (aFile != KNullDesC)
{
TFileName file( aFile );
iLog->Log(_L("FILE (%S)"), &file );
TraceL(_L("----->Using FILE<-------"));
TraceL(file);
iLandmarkParser->SetInputFileL(file);
}
else
{
iLog->Log(_L("BUFFER (size %d)"), aBuffer.Size() );
TraceL(_L("----->Using BUFFER<-------"));
iLandmarkParser->SetInputBuffer(aBuffer);
}
iOperation = iLandmarkParser->ParseContentL();
TRequestStatus status = KPosLmOperationNotComplete;
TReal32 progress;
TInt number = 0;
RArray<TPosLmItemId> array;
CleanupClosePushL(array);
while (status == KPosLmOperationNotComplete)
{
iLog->Log(_L("--- Parsing ---------------------------"));
TraceL(_L("------------------------------"));
iOperation->NextStep(status, progress);
// Wait for NextStep to complete
User::WaitForRequest(status);
if (status != KPosLmOperationNotComplete && status != KErrNone)
{
HBufC* buffer = HBufC::NewLC( 128);
TPtr buf = buffer->Des();
buf.Format(_L("\tStatus %d"), status.Int());
iLog->Log(buf);
TraceL(buf);
CleanupStack::PopAndDestroy( buffer );
buffer = NULL;
}
else
{
iLog->Log(_L("Parsing element"));
if ( iLandmarkParser->NumOfParsedLandmarks() )
{
// Get last parsed landmark
CPosLandmark* lm = iLandmarkParser->LandmarkLC();
TPtrC lmName;
TPtrC catName;
lm->GetLandmarkName(lmName);
lm->GetCategoriesL(array);
//iLog->Log(lmName);
for (TInt i=0;i<array.Count();i++)
{
CPosLandmarkCategory* category = iLandmarkParser->LandmarkCategoryLC( array[i] );
category->GetCategoryName( catName );
HBufC* buffer = HBufC::NewLC( 128 + catName.Length());
TPtr buf = buffer->Des();
if ( category->GlobalCategory())
{
buf.Append(_L("\tGlobal category: "));
}
else
{
buf.Append(_L("\tLocal category: "));
}
buf.Append(catName);
iLog->Log(buf);
TraceL(buf);
CleanupStack::PopAndDestroy( buffer );
buffer = NULL;
CleanupStack::PopAndDestroy(category);
}
PrintLandmarkFieldsWithDescriptionL(*lm, ETrue);
number++;
CleanupStack::PopAndDestroy(lm);
//.........这里部分代码省略.........
示例7: DeleteFileL
// ---------------------------------------------------------
// CPosTp149::StartL
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CPosTp149::StartL()
{
BaflUtils::EnsurePathExistsL( iFileSession, KKMZFile );
// Delete the trace file
DeleteFileL(KFileTrace);
HBufC8* emptyBuffer=NULL;
iLog->Log(_L("Test with Tp149KMZFile.kmz"));
PrintParsedDataFromEncoderL(KKMZFile, *emptyBuffer, KErrNone, KKmzMimeType );
// Now compare tha trace file against the correct one
RFile correctFile;
RFile file;
iLog->Log(_L(">>>>>>>Comparing files<<<<<"));
TFileName filename;
CreateCorrectXmlFileL( KCorrectFile, filename );
User::LeaveIfError(correctFile.Open(iFileSession, filename, EFileRead));
CleanupClosePushL(correctFile);
User::LeaveIfError(file.Open(iFileSession, KFileTrace, EFileRead));
CleanupClosePushL(file);
HBufC* correctLinebuffer = HBufC::NewLC( KBufSize );
TPtr correctLine = correctLinebuffer->Des();
HBufC* linebuffer = HBufC::NewLC( KBufSize );
TPtr line = linebuffer->Des();
TInt err = KErrNone;
TBool done = EFalse;
TInt lineNr = 0;
while (ReadLn(correctFile, correctLine) != KErrEof && !done)
{
lineNr++;
err = ReadLn(file, line);
if ( err == KErrEof )
{
done = ETrue;
}
correctLine.Trim();
line.Trim();
if (correctLine.Compare(line) != KErrNone)
{
HBufC* buf = HBufC::NewLC( 128 );
TPtr buffer = buf->Des();
buffer.Format(_L("ERROR in TraceFile on line %d: "), lineNr);
iLog->Log( buffer );
iLog->Log( correctLine );
iLog->Log( line );
iErrorsFound++;
CleanupStack::PopAndDestroy( buf );
}
}
CleanupStack::PopAndDestroy(linebuffer);
CleanupStack::PopAndDestroy(correctLinebuffer);
CleanupStack::PopAndDestroy(&file);
CleanupStack::PopAndDestroy(&correctFile);
// EOF for trace file was reach before EOF in the correct file
if (done)
{
iLog->Log(_L("ERROR: EOF for Trace file was reached to early"));
iErrorsFound++;
}
DoCancelTestL();
if (iErrorsFound != KErrNone)
{
iLog->Log(_L("Errors found in TP149"));
User::Leave(-1);
}
}
示例8: insertType
/**
Set up the CCntSqlStatement objects held by the class.
*/
void CPplGroupsTable::ConstructL()
{
// Statement types
TCntSqlStatementType insertType(EInsert, KSqlContactGroupTableName);
TCntSqlStatementType selectType(ESelect, KSqlContactGroupTableName);
TCntSqlStatementType updateType(EUpdate, KSqlContactGroupTableName);
TCntSqlStatementType deleteType(EDelete, KSqlContactGroupTableName);
TCntSqlStatementType countContactsType(ESelect, KSqlContactTableName);
// Where clauses
// sizes of the clauses
const TInt KWhereGroupClauseBufSize(KGroupContactGroupId().Size() +
KWhereStringEqualsStringFormatText().Size() + KGroupContactGroupIdParam().Size() );
const TInt KWhereMemberClauseBufSize(KGroupContactGroupMemberId().Size() +
KWhereStringEqualsStringFormatText().Size() + KGroupContactGroupMemberIdParam().Size() );
const TInt KWhereOrClauseBufSize(KWhereGroupClauseBufSize + KSqlOr().Size() + KWhereMemberClauseBufSize);
// for WHERE contact_group_id = [contact id value]
HBufC* whereGroupIdClause = HBufC::NewLC(KWhereGroupClauseBufSize);
whereGroupIdClause->Des().AppendFormat(KWhereStringEqualsStringFormatText,
&KGroupContactGroupId, &KGroupContactGroupIdParam );
// for WHERE contact_group_member_id = [contact id value]
HBufC* whereMemberIdClause = HBufC::NewLC(KWhereMemberClauseBufSize);
whereMemberIdClause->Des().AppendFormat(KWhereStringEqualsStringFormatText,
&KGroupContactGroupMemberId, &KGroupContactGroupMemberIdParam );
// for WHERE contact_group_id = [contact id value]
// OR contact_group_member_id = [contact id value]
HBufC* whereGroupOrMemberIdClause = HBufC::NewLC(KWhereOrClauseBufSize);
TPtr whereGroupOrMemberIdClausePtr = whereGroupOrMemberIdClause->Des();
whereGroupOrMemberIdClausePtr.AppendFormat(KWhereStringEqualsStringFormatText,
&KGroupContactGroupId, &KGroupContactGroupIdParam);
whereGroupOrMemberIdClausePtr.Append(KSqlOr);
whereGroupOrMemberIdClausePtr.AppendFormat(KWhereStringEqualsStringFormatText,
&KGroupContactGroupMemberId, &KGroupContactGroupMemberIdParam);
// for WHERE contact_id = [contact_id]
HBufC* whereContactIdClause = HBufC::NewLC(KWhereGroupClauseBufSize);
whereContactIdClause->Des().AppendFormat(KWhereStringEqualsStringFormatText,
&KContactId, &KContactIdParam );
// INSERT
// insert group-member relationships
// For a statement in the following format:
// INSERT INTO groups
// (group_id, contact_group_id, contact_group_member_id)
// VALUES (NULL, [contact group id value], [contact group member id value]);
//
iInsertStmnt = TSqlProvider::GetSqlStatementL(insertType);
iInsertStmnt->SetParamL(KGroupContactGroupId(), KGroupContactGroupIdParam());
iInsertStmnt->SetParamL(KGroupContactGroupMemberId(), KGroupContactGroupMemberIdParam());
// SELECT
// select group id
// For a statement in the following format:
// SELECT contact_group_id FROM groups
// WHERE contact_group_member_id = [contact id value];
//
iSelectGroupsStmnt = TSqlProvider::GetSqlStatementL(selectType);
iSelectGroupsStmnt->SetParamL(KGroupContactGroupId(), KNullDesC() );
iSelectGroupsStmnt->SetConditionL(*whereMemberIdClause);
// select member id
// For a statement in the following format:
// SELECT contact_group_member_id FROM groups
// WHERE contact_group_id = [contact id value];
//
iSelectMembersStmnt = TSqlProvider::GetSqlStatementL(selectType);
iSelectMembersStmnt->SetParamL(KGroupContactGroupMemberId(), KNullDesC() );
iSelectMembersStmnt->SetConditionL(*whereGroupIdClause);
// DELETE
// delete all where group or member equals id
// For a statement in the following format:
// DELETE FROM groups WHERE contact_group_id = [contact id value]
// OR contact_group_member_id = [contact id value];
//
iDeleteStmnt = TSqlProvider::GetSqlStatementL(deleteType);
iDeleteStmnt->SetConditionL(*whereGroupOrMemberIdClause);
// SELECT
// SELECt count(*) FROM contact WHERE contact_id = [contact_id]
iCountContactsStmnt = TSqlProvider::GetSqlStatementL(countContactsType);
iCountContactsStmnt->SetParamL(KSqlCount, KSpace);
iCountContactsStmnt->SetConditionL(*whereContactIdClause);
CleanupStack::PopAndDestroy(4, whereGroupIdClause); // and whereContactIdClause, whereMemberIdClause, whereGroupOrMemberIdClause
}
示例9: ConstructFromResourceL
void CStartupProperties::ConstructFromResourceL(TResourceReader& aSource)
{
const TStartupCommandType commandType = static_cast<TStartupCommandType>(aSource.ReadUint16());
iStartupType = ((commandType==EStartupApp)||(commandType==EStartupApp2)) ? EStartApp : EStartProcess;
iFileName = aSource.ReadHBufCL();
if(iFileName)
{
TPtr writeableFilename = iFileName->Des();
writeableFilename.TrimAll();
}
iArgs = aSource.ReadHBufCL();
if(iArgs)
{
TPtr writeableArgs = iArgs->Des();
writeableArgs.TrimAll();
}
iStartMethod = static_cast<TStartMethod>(aSource.ReadUint16());
switch(commandType)
{
case EStartupApp:
delete iArgs; // deleted for backwards compatibility
iArgs = NULL;
iViewless = static_cast<TUint16>(aSource.ReadUint16());
iStartInBackground = static_cast<TUint16>(aSource.ReadUint16());
iTimeout = aSource.ReadInt32();
iRecoveryMethod.iActionOnCommandFailure = static_cast<TActionOnCommandFailure> (aSource.ReadUint16());
iNoOfRetries = static_cast<TUint16> (aSource.ReadUint16());
break;
case EStartupApp2:
iViewless = static_cast<TUint16>(aSource.ReadUint16());
iStartInBackground = static_cast<TUint16>(aSource.ReadUint16());
iTimeout = aSource.ReadInt32();
iRecoveryMethod.iRecoveryMethod = static_cast<TRecoveryMethod> (aSource.ReadUint16());
iNoOfRetries = static_cast<TUint16> (aSource.ReadUint16());
iMonitored = static_cast<TUint16>(aSource.ReadUint16());
iRestartMode = aSource.ReadInt16();
break;
case EStartupProcess:
iTimeout = aSource.ReadInt32();
iRecoveryMethod.iActionOnCommandFailure = static_cast<TActionOnCommandFailure>(aSource.ReadUint16());
iNoOfRetries = static_cast<TUint16> (aSource.ReadUint16());
break;
case EStartupProcess2:
iTimeout = aSource.ReadInt32();
iRecoveryMethod.iRecoveryMethod = static_cast<TRecoveryMethod>(aSource.ReadUint16());
iNoOfRetries = static_cast<TUint16> (aSource.ReadUint16());
iMonitored = static_cast<TUint16>(aSource.ReadUint16());
iRestartMode = aSource.ReadInt16();
break;
default:
PanicNow(KPanicStartupProperties, EInvalidCommandType);
break;
}
DoSanityCheck(commandType);
}
示例10: diff
void CMontgomeryPerformance::PerformAction(TRequestStatus& aStatus)
{
TRequestStatus* status = &aStatus;
iResult = ETrue;
CMontgomeryStructure* montConst;
TUint iterations = 0;
TTime start, end;
TTimeIntervalSeconds diff(0);
const TTimeIntervalSeconds iterationTime(iIterations);
start.UniversalTime();
while (diff < iterationTime)
{
montConst = CMontgomeryStructure::NewL(iModulus);
delete montConst;
iterations++;
end.UniversalTime();
end.SecondsFrom(start, diff);
}
end.UniversalTime();
TTimeIntervalMicroSeconds time = end.MicroSecondsFrom(start);
TReal rate = I64REAL(time.Int64()) / (iterations);
TReal rtime = I64REAL(time.Int64());
HBufC* realbuf = HBufC::NewLC(128);
TPtr buf = realbuf->Des();
buf.Format(KPerfConstFormat, rate, iterations, rtime);
iOut.writeString(buf);
iConsole.Printf(_L("."));
CMontgomeryStructure* mont = CMontgomeryStructure::NewLC(iModulus);
//Multiply
diff = 0;
iterations = 0;
start.UniversalTime();
while (diff < iterationTime)
{
mont->MultiplyL(iA, iB);
iterations++;
end.UniversalTime();
end.SecondsFrom(start, diff);
}
end.UniversalTime();
time = end.MicroSecondsFrom(start);
rate = I64REAL(time.Int64()) / iterations;
rtime = I64REAL(time.Int64());
buf.Zero();
buf.Format(KPerfMultiplyFormat, rate, iterations, rtime);
iOut.writeString(buf);
iConsole.Printf(_L("."));
//Square
diff = 0;
iterations = 0;
start.UniversalTime();
while (diff < iterationTime)
{
mont->SquareL(iA);
iterations++;
end.UniversalTime();
end.SecondsFrom(start, diff);
}
end.UniversalTime();
time = end.MicroSecondsFrom(start);
rate = I64REAL(time.Int64()) / iterations;
rtime = I64REAL(time.Int64());
buf.Zero();
buf.Format(KPerfSquareFormat, rate, iterations, rtime);
iOut.writeString(buf);
iConsole.Printf(_L("."));
//Exponentiate
diff = 0;
iterations = 0;
start.UniversalTime();
while (diff < iterationTime)
{
mont->ExponentiateL(iA, iB);
iterations++;
end.UniversalTime();
end.SecondsFrom(start, diff);
}
end.UniversalTime();
time = end.MicroSecondsFrom(start);
rate = I64REAL(time.Int64()) / iterations;
rtime = I64REAL(time.Int64());
buf.Zero();
buf.Format(KPerfExpFormat, rate, iterations, rtime);
iOut.writeString(buf);
iConsole.Printf(_L("."));
//Reduce
//.........这里部分代码省略.........
示例11: INFO_PRINTF1
/**
@SYMTestCaseID UIF-ETUL-0009
@SYMREQ 7736
@SYMTestCaseDesc Test to Parse for URI's, Email Addresses, Phone Numbers and URL's in a file and to verify them
@SYMTestPriority High
@SYMTestStatus Implemented
@SYMTestActions Constructs CTulAddressStringTokenizer object with CTulAddressStringTokenizer::EFindItemSearchMailAddressBin \n
which parses the given string and creates an item array consisting of all the Email addresses\n
API Calls:\n
CTulAddressStringTokenizer::NewL(const TDesC& aText, TInt aSearchCases);\n
CTulAddressStringTokenizer::Item(SFoundItem& aItem); \n
CTulAddressStringTokenizer::NextItem(SFoundItem& aItem); \n
@SYMTestExpectedResults The test checks whether
1. Phone numbers, Email addresses, URL's and URI's parsed by CTulAddressStringTokenizer are the correct ones.
*/
void CT_AddressStringTokenizerStep::ParseURIFileL()
{
INFO_PRINTF1(_L("Test begins"));
__UHEAP_MARK;
//load test case text to string
RFs rfs;
User::LeaveIfError(rfs.Connect());
CleanupClosePushL(rfs);
_LIT(KParesTextFile, "z:\\system\\data\\addressstringtokenizertestappdata.txt");
_LIT(KParesTextFileRef, "z:\\system\\data\\addressstringtokenizertestappdataref.txt");
RFile file;
HBufC* fullBuf = HBufC::NewMaxLC(KFullBufSize);
TPtr fullBufPtr = fullBuf->Des();
fullBufPtr = KNullDesC;
TFileText reader;
TBuf<KReadBufSize> fileBuffer;
if ((file.Open(rfs, KParesTextFile, EFileStreamText|EFileRead|EFileShareAny)) == KErrNone)
{
CleanupClosePushL(file);
// use TFileText for reading file. There is probably better ways to do this tho.
reader.Set(file);
if (reader.Seek(ESeekStart))
{
INFO_PRINTF1(_L("File corrupted"));
User::Leave(KErrGeneral); // not cleaning up properly
}
while (!reader.Read(fileBuffer))
{
fullBufPtr.Append(fileBuffer);
fullBufPtr.Append('\n');
}
CleanupStack::Pop(&file);
file.Close();
}
else
{
INFO_PRINTF1(_L("z:\\system\\data\\addressstringtokenizertestappdata.txt not found"));
User::Leave(KErrNotFound);
}
if (file.Open(rfs, KParesTextFileRef, EFileStreamText|EFileRead|EFileShareAny) == KErrNone)
{
CleanupClosePushL(file);
// use TFileText for reading file. There is probably better way to do this tho.
reader.Set(file);
if (reader.Seek(ESeekStart))
{
INFO_PRINTF1(_L("File corrupted"));
User::Leave(KErrGeneral); // not cleaning up properly
}
}
else
{
INFO_PRINTF1(_L("z:\\system\\data\\addressstringtokenizertestappdataref.txt not found"));
User::Leave(KErrNotFound);
}
INFO_PRINTF1(_L("Start searching..."));
// Create an instance of Address String Tokenizer and search for URL's.
CTulAddressStringTokenizer* addressString = CTulAddressStringTokenizer::NewL(fullBufPtr, CTulAddressStringTokenizer::EFindItemSearchURLBin);
TestAddressStringTokenizers(addressString, reader, fullBufPtr);
delete addressString;
// find phone numbers from same text
addressString = CTulAddressStringTokenizer::NewL(fullBufPtr, CTulAddressStringTokenizer::EFindItemSearchPhoneNumberBin);
TestAddressStringTokenizers(addressString, reader, fullBufPtr);
// test do new search with same instance
TInt count = addressString->DoNewSearchL(fullBufPtr, CTulAddressStringTokenizer::EFindItemSearchMailAddressBin);
TEST(count > 0);
TestAddressStringTokenizers(addressString, reader, fullBufPtr);
delete addressString;
//.........这里部分代码省略.........
示例12: _LIT
void CLowDiskSpaceTest::FillDiskL()
{
_LIT(KFillDiskTitle, "Fill the disk");
test.Next(_L("Fill the disk"));
TVolumeInfo tv;
User::LeaveIfError( iFileSession.Volume(tv) );
TInt frees = 0;
iManyFiles = tv.iFree / KMaxTInt;
if ( iManyFiles > 0)
{
TPtrC tname( KFileName );
TInt i = 0;
for( ; i < iManyFiles; ++i )
{
HBufC *fval=HBufC::NewLC( tname.Length()+4 );//assume #files < 10000
TPtr fptr = fval->Des() ;
fptr.Append( tname );
fptr.AppendNum( i );
User::LeaveIfError( iFile->Replace( iFileSession, fptr, EFileWrite ) );
User::LeaveIfError( iFile->SetSize( KMaxTInt ) );
iFile->Close();
CleanupStack::PopAndDestroy( fval );
}
User::LeaveIfError( iFileSession.Volume(tv) );
frees = tv.iFree - KMinusFull ;
if( frees <= 0 )
{
frees = tv.iFree;
}
User::LeaveIfError( iFile->Replace( iFileSession, KFileName, EFileWrite ) );
#ifdef __SYMBIAN_CNTMODEL_USE_SQLITE__
TInt err = KErrDiskFull;
while(err == KErrDiskFull)
{
err = iFile->SetSize(frees);
frees -= 100;
if(frees <= 0)
{
break;
}
}
#else
User::LeaveIfError( iFile->SetSize( frees ) );
#endif
iFile->Close();
}
else
{
frees = tv.iFree - KMinusFull ;
if( frees <= 0 )
{
frees = tv.iFree;
}
User::LeaveIfError( iFile->Replace( iFileSession, KFileName, EFileWrite ) );
#ifdef __SYMBIAN_CNTMODEL_USE_SQLITE__
TInt err = KErrDiskFull;
while(err == KErrDiskFull)
{
err = iFile->SetSize(frees);
frees -= 100;
if(frees <= 0)
{
break;
}
}
#else
User::LeaveIfError( iFile->SetSize( frees ) );
#endif
iFile->Close();
}
}
示例13: GetMenuItem
//----------------------------------------------
// execute menu item command
//----------------------------------------------
Bool TLMenu::TMenuController::ExecuteMenuItem(TRefRef MenuItemRef)
{
TPtr<TMenuItem> pMenuItem = GetMenuItem(MenuItemRef);
if ( !pMenuItem )
{
TLDebug_Break("No such menu item");
return FALSE;
}
// get command of menu item
TRefRef MenuCommand = pMenuItem->GetMenuCommand();
TRefRef AudioRef = pMenuItem->GetAudioRef();;
// open-menu command
if ( MenuCommand == "Open" )
{
// Already has a queued command?
if(m_QueuedCommand.GetRef().IsValid())
return FALSE;
// Queue up the command.
m_QueuedCommand.SetRef(MenuCommand);
m_QueuedCommand.SetTypeRef(pMenuItem->GetNextMenu());
}
else if ( MenuCommand == "Close" )
{
// Already has a queued command?
if(m_QueuedCommand.GetRef().IsValid())
return FALSE;
// Queue up the command.
m_QueuedCommand.SetRef(MenuCommand);
}
else
{
// do non standard command
if ( !ExecuteCommand( MenuCommand, pMenuItem->GetData() ) )
return FALSE;
}
// Valid audio to play?
// Create menu audio for command execution
// gr: this should go in menu renderer code, not menu logic code
if(AudioRef.IsValid())
{
TLMessaging::TMessage Message(TLCore::InitialiseRef);
Message.ExportData("Asset", AudioRef);
Message.ExportData("Play", TRUE);
Message.ExportData("RateOfDecay", 0.0f); // Make 2D
Message.ExportData("MinRange", 100000.0f);
Message.ExportData("MaxRange", 100000.0f);
TLAudio::g_pAudiograph->StartAudio(MenuCommand, AudioRef);
}
// publish that command has been executed
OnMenuItemExecuted( MenuCommand, pMenuItem->GetData() );
return TRUE;
}
示例14: SetTestStepResult
TVerdict CHashIncrementalHashWithCopyStep::doTestStepL()
{
if (TestStepResult()==EPass)
{
//Assume faliure, unless all is successful
SetTestStepResult(EFail);
INFO_PRINTF1(_L("*** Hash - Incremental Hash with Copy ***"));
INFO_PRINTF2(_L("HEAP CELLS: %d"), User::CountAllocCells());
TVariantPtrC algorithmUid;
TVariantPtrC operationModeUid;
TPtrC sourcePath;
TPtrC expectedHash;
//Extract the Test Case ID parameter from the specified INI file
if(!GetStringFromConfig(ConfigSection(),KConfigAlgorithmUid,algorithmUid) ||
!GetStringFromConfig(ConfigSection(),KConfigOperationMode,operationModeUid) ||
!GetStringFromConfig(ConfigSection(),KConfigSourcePath,sourcePath) ||
!GetStringFromConfig(ConfigSection(),KConfigExHashHmacValue,expectedHash))
{
ERR_PRINTF1(_L("** Error: Failed to Load Configuration Parameters **"));
SetTestStepResult(EFail);
}
else
{
//Create a pointer for the Hash Implementation Object
CHash* hashImpl = NULL;
//Retrieve a Hash Factory Object
TRAPD(err,CHashFactory::CreateHashL(hashImpl,
algorithmUid,
operationModeUid,
NULL,
NULL));
if(hashImpl && (err == KErrNone))
{
//Push the Hash Implementation Object onto the Cleanup Stack
CleanupStack::PushL(hashImpl);
RFs fsSession;
//Create a connection to the file server
err = fsSession.Connect();
if(err != KErrNone)
{
ERR_PRINTF2(_L("*** Error: File Server Connection - %d ***"), err);
SetTestStepResult(EFail);
}
else
{
RFile sourceFile;
CleanupClosePushL(sourceFile);
//Open the specified source file
err = sourceFile.Open(fsSession,sourcePath, EFileRead);
if(err != KErrNone)
{
ERR_PRINTF2(_L("*** Error: Opening Source File - %d ***"), err);
SetTestStepResult(EFail);
}
else
{
TInt sourceLength = 0;
TInt readPosition = 0;
TInt readIncrement = 0;
TBool hashComplete = EFalse;
TBool hashCopied = EFalse;
TPtrC8 hashStr;
CHash* hashCopyImpl = NULL;
User::LeaveIfError(sourceFile.Size(sourceLength));
//Divide the total size of the source file up into individual equal sized blocks to read
//over several increments
readIncrement = sourceLength/KDataReadBlocks;
do
{
//Create a heap based descriptor to store the data
HBufC8* sourceData = HBufC8::NewL(readIncrement);
CleanupStack::PushL(sourceData);
TPtr8 sourcePtr = sourceData->Des();
//Read in a block of data from the source file from the current position
err = sourceFile.Read(readPosition,sourcePtr,readIncrement);
//Update the read position by adding the number of bytes read
readPosition += readIncrement;
if(readPosition == readIncrement)
{
//Read in the first block from the data file into the Hash implementation object
//.........这里部分代码省略.........
示例15: IsIndicAdaptiveFindMatch
//.........这里部分代码省略.........
IsSpecialIndicLigature( (*searchText).Mid(modifiedStrLength-4) ) )
{
lastChar = (*searchText).Mid(modifiedStrLength-4);
}
else
{
lastChar = (*searchText).Mid(modifiedStrLength-2);
}
}
else
{
//No wildchar here
lastChar = (*searchText).Mid(modifiedStrLength-1);
}
lastChar.UpperCase(); //For latin characters as adaptive grid is always in upper case
TInt charPos = result; //aItemString.Mid(index).MatchC( searchText->Des(), &collationMethod );
//if found position is not within the substring to be searched, return EFalse.
if( charPos == KErrNotFound)
{
delete searchText;
return EFalse;
}
TInt tempPos = charPos;
TInt startCount = -1 , endCount = -1;
//TInt tempIndex(0);
//Get the position of the next syllable to be checked
IndicSyllableBoundary(startCount, endCount, indicSyllableCount, aItemString.Mid(index));
tempPos = aItemString.Mid(index+startCount).MatchC( lastChar, &collationMethod );
if (
//if found position is not within the next syllable to be searched,
//return EFalse.
( tempPos != 0 )
//Also check if character to be searched is a single unicode while
//the match is at the start of a special ligature
|| ( !IsSpecialIndicLigature( lastChar ) &&
IsSpecialIndicLigature( aItemString.Mid(index+startCount) ) )
)
{
delete searchText;
return EFalse;
}
//else, continue - find the next characters to be displayed on the grid
tempPos = index + endCount + 1;
do {
if(charPos!=KErrNotFound && (tempPos) < itemStringLength )
{
TRAP_IGNORE( UpdateNextCharsL( aNextChars, aItemString.Mid(tempPos) ) );
}
//Is the found next character a consonent/independent-vowel/non-Indic character?
if ( IsValidNextChars( *aNextChars ) )
{
//found a valid character for displaying on the grid - return from here
delete searchText;
return ETrue;
}
else //we found an invalid valid character - keep searching
{
TPtr ptr = aNextChars->Des();
ptr.Delete(aNextChars->Length()-1,1);
//Is this a fallback rendered character?
if ( IsFallbackRenderedCharacter(aItemString, tempPos) )
{
//Keep the entry but don't show any more characters from this word
delete searchText;
return ETrue;
}
}
}
//keep looping till we find a valid nextChar or we reach the end of the string
while(tempPos < itemStringLength );
}
} // if( result != KErrNotFound )
} // if (index==0 ..)
} // for loop
if( result != KErrNotFound )
{
delete searchText;
return ETrue;
}
else
{
delete searchText;
return EFalse;
}
} // if (error == KErrNone)
delete searchText;
return EFalse;
}