本文整理汇总了C++中TPtr::AppendNum方法的典型用法代码示例。如果您正苦于以下问题:C++ TPtr::AppendNum方法的具体用法?C++ TPtr::AppendNum怎么用?C++ TPtr::AppendNum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPtr
的用法示例。
在下文中一共展示了TPtr::AppendNum方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetExpectedUTCFromIniL
TPtrC CTestImpExvCardSuiteStepBase::GetExpectedUTCFromIniL(TInt numberOfCases,TBuf<80> aConfig, TBool aExpectedBDay)
{
TPtrC expectedUTC;
TPtrC expectedBDAY;
TPtrC config = aConfig;
HBufC *configval = HBufC::NewLC(config.Length()+2);
TPtr configSection = configval->Des();
configSection.Append(config);
configSection.AppendNum(numberOfCases);
if (aExpectedBDay)
{
GetStringFromConfig(configSection,KExpectedBDay,expectedBDAY);
CleanupStack::PopAndDestroy(configval);
return expectedBDAY;
}
else
{
GetStringFromConfig(configSection,KExpectedUTC,expectedUTC);
CleanupStack::PopAndDestroy(configval);
return expectedUTC;
}
}
示例2: line_A
void CSliderForDialog :: Draw( const TRect& /*aRect*/ ) const
{
// ��������� ��������
TRect rect = Rect();
TInt runner_w = iMaxLbWidth + 2 * iDelimiter + 2 * iBvThickness;
TInt runner_h = font->HeightInPixels() + 2 * iDelimiter + 2 * iBvThickness;
TInt x_offs = rect.iTl.iX + iBvThickness + runner_w / 2;
TPoint line_A( x_offs + 2, rect.iTl.iY + rect.Height() / 2 ),
line_B( rect.iBr.iX - runner_w / 2 - 2, line_A.iY );
TInt runner_c = line_A.iX + iValue * ( line_B.iX - line_A.iX ) / iMaxVal;
TRect iRunner_rect=TRect( runner_c - runner_w / 2,
line_A.iY - runner_h / 2,
runner_c + runner_w / 2,
line_A.iY + runner_h / 2 );
TBufC<50> tmpLabel;
TPtr tmpPtr = tmpLabel.Des();
tmpPtr.Append( iLabel );
tmpPtr.AppendNum( iValue );
TRgb penColor, brushColor;
if( IsFocused() )
{
penColor = KRgbBlack;
brushColor = KRgbRed;
}
else
{
penColor = KRgbWhite;
brushColor = KRgbGray;
}
CWindowGc& gc = SystemGc();
//Window().SetTransparencyAlphaChannel();
//TRgb c(0,0,0,0);
//Window().SetBackgroundColor(c);
//gc.Clear();
gc.SetPenSize( TSize( iBvThickness, iBvThickness ) );
gc.SetPenStyle( CGraphicsContext :: ENullPen );
gc.SetPenColor( penColor );
gc.SetBrushStyle( CGraphicsContext :: ESolidBrush );
gc.SetPenStyle( CGraphicsContext :: ESolidPen );
gc.DrawLine( line_A, line_B );
gc.SetBrushColor( brushColor );
gc.DrawRoundRect( iRunner_rect, TSize( 4, 4 ) );
gc.UseFont( font );
gc.DrawText( tmpLabel, TPoint( iRunner_rect.iTl.iX + iDelimiter + iBvThickness,
iRunner_rect.iBr.iY - iDelimiter - iBvThickness ) );
}
示例3: SaveL
TInt CSpecialLog::SaveL(void)
{
// Open file.
TFileName filename;
filename.Copy(KSpecialLogPath);
filename.Append(KSpecialLogFile);
RFile file;
TInt result = file.Replace(* iFs, filename, EFileWrite);
if (KErrNone != result)
{
return result;
}
// Write file
TFileText fileText;
fileText.Set(file);
HBufC* buffer = HBufC::NewLC(KSpecialLogLineBufferSize);
TPtr line = buffer->Des();
line.Copy(KSpecialLogSection); // Write section header.
fileText.Write(line);
for (TInt i = 0; i < iLogSpecial.Count(); i ++) // Write all special log entries.
{
const RLogSpecial & entry = iLogSpecial[i];
// Write key (text if defined, otherwise index)
if (i < KNumSpecialLogKeys)
line.Copy((const TUint16 *) KSpecialLogKeyText[i]); // TODO: Fix the cast.
else
line.Num(i);
line.Append(_L("="));
// Write value.
if (ESpecialLogInt == entry.iType)
line.AppendNum(entry.iInt);
else
line.Append(* entry.iText);
result = fileText.Write(line);
if (result != KErrNone)
break;
}
CleanupStack::PopAndDestroy(buffer);
file.Close();
if (KErrEof == result) result = KErrNone;
iState = ESaved;
// Bubble result of TFileText::Write().
return result;
}
示例4: FormatListItemLC
// -----------------------------------------------------------------------------
// CLandmarksModel::FormatListItemLC
// Formats a list item to the following format "X\tlandmarkName\t"
// where X = icon index
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
HBufC* CLandmarksModel::FormatListItemLC(CPosLandmark& aLandmark)
{
// Extract name
TPtrC name;
aLandmark.GetLandmarkName(name);
// 10 extra chars for icon index and column separator
const TInt KExtraChars = 10;
HBufC* formattedNameBuf = HBufC::NewLC(name.Length() + KExtraChars);
TPtr formattedNamePtr = formattedNameBuf->Des();
// Extract icon info
TPtrC mbmIconFile;
TInt iconIndex, maskIndex;
TInt res = aLandmark.GetIcon(mbmIconFile, iconIndex, maskIndex);
// Format list item
if (res == KErrNone)
{
// Create icon and append it to icon array.
TRAPD(err, AppendIconL(mbmIconFile, iconIndex, maskIndex));
if (err == KErrNone)
{
// Append the array index where the icon is appended
formattedNamePtr.AppendNum(iIconList->Count() - 1);
}
else
{
formattedNamePtr.AppendNum(KDefaultIconIndex);
}
}
else // res == KErrNotFound
{
formattedNamePtr.AppendNum(KDefaultIconIndex);
}
formattedNamePtr.Append(KTab);
formattedNamePtr.Append(name);
return formattedNameBuf;
}
示例5: GetPhoneL
TPtrC CTestExBDayLocal::GetPhoneL(TInt numberOfCases)
{
TPtrC phone;
TPtrC config = KVCard();
HBufC *configval = HBufC::NewLC(config.Length()+2);
TPtr configSection = configval->Des();
configSection.Append(config);
configSection.AppendNum(numberOfCases);
GetStringFromConfig(configSection,KPhone,phone);
CleanupStack::PopAndDestroy(configval);
return phone;
}
示例6: DrawPoints
void CSpaceInvadersAppView::DrawPoints(CWindowGc& aGc) const
{
TRgb pencolor = TRgb(255,255,255);
aGc.SetPenColor(pencolor);
_LIT(KPointsText, "Points: ");
TBufC<15> pointsText;
TPtr pointsPtr = pointsText.Des();
pointsPtr.Append(KPointsText);
pointsPtr.AppendNum(iHolder->ActivePoints());
const CFont* menuFont =
AknLayoutUtils::FontFromId(EAknLogicalFontPrimarySmallFont, NULL);
aGc.UseFont(menuFont);
TInt textLength = menuFont->TextWidthInPixels(pointsPtr);
TInt textHeight = menuFont->HeightInPixels();
TPoint textpoint(Rect().Width() / 2 - textLength / 2, textHeight);
aGc.DrawText(pointsPtr, textpoint);
}
示例7:
/**
converts contents of a contact item field to a string
*/
HBufC *CContactViewTest::FieldStringLC(const CContactItemField &aField)
{
HBufC *buf = NULL;
if( aField.IsTemplateLabelField() )
{
buf = HBufC::NewLC(0);
return buf;
}
switch(aField.StorageType())
{
case KStorageTypeText:
{
buf = HBufC::NewLC(aField.Label().Length()+2);
TPtr ptr = buf->Des();
ptr.Append( aField.Label() );
}
break;
case KStorageTypeContactItemId:
{
buf = HBufC::NewLC(20);//assume cid < 20 digits
TContactItemId cid = aField.AgentStorage()->Value();
TPtr ptr = buf->Des();
ptr.AppendNum(cid);
}
break;
case KStorageTypeStore:
case KStorageTypeDateTime:
{
buf = HBufC::NewLC(0);//views dont care about date/time or binary fields
}
break;
default:
{
_LIT(KCCVTest,"CCVTest");
User::Panic(KCCVTest , EInvariantFalse );
}
break;
}
return buf;
}
示例8: ShowSingleValueL
//.........这里部分代码省略.........
bufferPtr.Append(_L("SplitterWidth: "));
break;
case QStyle::PM_ToolBarExtensionExtent: // not in S60
bufferPtr.Append(_L("ToolBarExtExtent: "));
break;
case QStyle::PM_ToolBarSeparatorExtent: // not in S60
bufferPtr.Append(_L("ToolBarSepExtent: "));
break;
case QStyle::PM_ToolBarHandleExtent: // not in s60
bufferPtr.Append(_L("ToolBarHandleExtent: "));
break;
case QStyle::PM_MenuButtonIndicator: // none???
bufferPtr.Append(_L("MenuButtonIndicator: "));
break;
case QStyle::PM_ButtonShiftHorizontal: //none in 3.x
bufferPtr.Append(_L("ButtonShiftHorizontal: "));
break;
case QStyle::PM_ButtonShiftVertical: // none in 3.x
bufferPtr.Append(_L("ButtonShiftVertical: "));
break;
case QStyle::PM_TabBar_ScrollButtonOverlap: // not used in S60 - tab arrows are on left and right side of tab group - not together
bufferPtr.Append(_L("TabScrollBtnOverlap: "));
break;
case QStyle::PM_SizeGripSize: // use default
bufferPtr.Append(_L("SizeGripSize: "));
break;
case QStyle::PM_DockWidgetHandleExtent:
bufferPtr.Append(_L("DockWdgtHandleExt: "));
break;
case QStyle::PM_CheckListButtonSize:
bufferPtr.Append(_L("CheckListButtonSize: "));
break;
case QStyle::PM_CheckListControllerSize:
bufferPtr.Append(_L("CheckListCntlerSize: "));
break;
case QStyle::PM_DialogButtonsSeparator:
bufferPtr.Append(_L("DialogBtnSeparator: "));
break;
case QStyle::PM_DialogButtonsButtonWidth:
bufferPtr.Append(_L("DialogBtnWidth: "));
break;
case QStyle::PM_DialogButtonsButtonHeight:
bufferPtr.Append(_L("DialogBtnHeight: "));
break;
case QStyle::PM_HeaderMarkSize:
bufferPtr.Append(_L("HeaderMarkSize: "));
break;
case QStyle::PM_SpinBoxSliderHeight:
bufferPtr.Append(_L("SpinBoxSliderHeight: "));
break;
case QStyle::PM_DefaultTopLevelMargin:
bufferPtr.Append(_L("DefaultTopLvlMrg: "));
break;
case QStyle::PM_DefaultChildMargin:
bufferPtr.Append(_L("DefaultChildMrg: "));
break;
case QStyle::PM_DefaultLayoutSpacing:
bufferPtr.Append(_L("DefaultlayoutSpc: "));
break;
case QStyle::PM_TabCloseIndicatorWidth:
bufferPtr.Append(_L("TabCloseIndWidth: "));
break;
case QStyle::PM_TabCloseIndicatorHeight:
bufferPtr.Append(_L("TabCloseIndHeight: "));
break;
case QStyle::PM_ScrollView_ScrollBarSpacing:
bufferPtr.Append(_L("ScrollViewBarSpc: "));
break;
case QStyle::PM_SubMenuOverlap:
bufferPtr.Append(_L("SubMenuOverlap: "));
break;
case QStyle::PM_Custom_FrameCornerHeight:
bufferPtr.Append(_L("C_FrCornerHeight: "));
break;
case QStyle::PM_Custom_FrameCornerWidth:
bufferPtr.Append(_L("C_FrCornerWidth: "));
break;
case QStyle::PM_Custom_ThinLineWidth:
bufferPtr.Append(_L("C_ThinLineWidth: "));
break;
case QStyle::PM_Custom_BoldLineWidth:
bufferPtr.Append(_L("C_BoldLineWidth: "));
break;
case QStyle::PM_Custom_MessageBoxHeight:
bufferPtr.Append(_L("C_MsgBoxHeight: "));
break;
default:
bufferPtr.Append(_L("Default: "));
break;
}
if (iFileOutputOn)
{
bufferPtr.Append('\t');
}
bufferPtr.AppendNum(aValue);
bufferPtr.Append(_L(" "));
ShowL( *buffer, aLast, iFileOutputOn );
CleanupStack::PopAndDestroy( buffer );
}
示例9: HandleCommandL
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand )
{
switch ( aCommand )
{
case EAknSoftkeyExit:
case EEikCmdExit:
Exit();
break;
case ECmdSwitchOutput:
{
HBufC* buffer = HBufC::NewLC( 100 );
TPtr bufferPtr = buffer->Des();
TBool last = ETrue;
bufferPtr.Append(_L("Output switched to "));
iFileOutputOn = !iFileOutputOn;
if (iFileOutputOn)
bufferPtr.Append(_L("file."));
else
bufferPtr.Append(_L("screen."));
ShowL( *buffer, last );
CleanupStack::PopAndDestroy( buffer );
}
break;
case ECmdStatus:
{
ClearL();
// layout
HBufC* buffer = HBufC::NewLC( 100 );
TPtr bufferPtr = buffer->Des();
TBool last = ETrue;
// Orientation
bufferPtr.Append(_L("Orientation: "));
bufferPtr.AppendNum((TInt)iAvkonAppUi->Orientation());
ShowL( *buffer, last );
bufferPtr.Zero();
// Output
bufferPtr.Append(_L("Output: "));
if (iFileOutputOn) bufferPtr.Append(_L("File"));
else bufferPtr.Append(_L("Screen"));
ShowL( *buffer, last );
bufferPtr.Zero();
CAknLayoutConfig::TScreenMode localAppScreenMode = CAknSgcClient::ScreenMode();
TInt hashValue = localAppScreenMode.ScreenStyleHash();
TPixelsTwipsAndRotation pixels = CAknSgcClient::PixelsAndRotation();
TSize pixelSize = pixels.iPixelSize;
bufferPtr.Append(_L("LayoutName: "));
if ( (pixelSize.iWidth == 320 || pixelSize.iWidth == 240 )&&
(pixelSize.iHeight == 320 || pixelSize.iHeight == 240 ))
{
if (hashValue==0x996F7AA7)
bufferPtr.Append(_L("QVGA2"));
else
bufferPtr.Append(_L("QVGA1"));
}
else if ((pixelSize.iWidth == 640 || pixelSize.iWidth == 360 )&&
(pixelSize.iHeight == 360 || pixelSize.iHeight == 640 ))
{
bufferPtr.Append(_L("nHD"));
}
else if ((pixelSize.iWidth == 640 || pixelSize.iWidth == 480 )&&
(pixelSize.iHeight == 480 || pixelSize.iHeight == 640 ))
{
bufferPtr.Append(_L("VGA"));
}
else if ((pixelSize.iWidth == 352 || pixelSize.iWidth == 800 )&&
(pixelSize.iHeight == 800 || pixelSize.iHeight == 352 ))
{
bufferPtr.Append(_L("E90"));
}
else if ((pixelSize.iWidth == 320 || pixelSize.iWidth == 480 ||
pixelSize.iWidth == 240 || pixelSize.iWidth == 640 )&&
(pixelSize.iHeight == 320 || pixelSize.iHeight == 480 ||
pixelSize.iHeight == 240 || pixelSize.iHeight == 640))
{
bufferPtr.Append(_L("HVGA"));
}
else if ((pixelSize.iWidth == 480 || pixelSize.iWidth == 854 ||
pixelSize.iWidth == 848 || pixelSize.iWidth == 800 )&&
(pixelSize.iHeight == 800 || pixelSize.iHeight == 480 ||
pixelSize.iHeight == 848 || pixelSize.iHeight == 854))
{
bufferPtr.Append(_L("WVGA"));
}
else
{
bufferPtr.Append(_L("Unknown"));
}
ShowL( *buffer, last );
bufferPtr.Zero();
//.........这里部分代码省略.........
示例10: FillDiskL
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();
}
}
示例11: DoShowMenuL
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
void CMCETestUISessionViewContainer::DoShowMenuL()
{
if ( iContextMenuAlreadyShown )
{
iContextMenuAlreadyShown = EFalse;
return;
}
// Get command provider
MMCETestUIEngineCmdProvider& cmdProvider =
iListBoxModel->CmdProvider( iListBox->CurrentItemIndex() );
// Get commands
const RPointerArray<TMCETestUIEngineCmdBase>& commands =
cmdProvider.GetCommandsL();
// Generate list
CAknSinglePopupMenuStyleListBox* listBox =
new (ELeave) CAknSinglePopupMenuStyleListBox;
CleanupStack::PushL( listBox );
CAknPopupList* popup = CAknPopupList::NewL(
listBox,
R_AVKON_SOFTKEYS_MENU_LIST,
AknPopupLayouts::EPopupSNotePopupWindow );
CleanupStack::PushL( popup );
popup->SetTitleL( _L("Available commands") );
listBox->ConstructL( popup,
EAknListBoxSelectionList | EAknListBoxLoopScrolling);
listBox->CreateScrollBarFrameL( ETrue );
listBox->ScrollBarFrame()->SetScrollBarVisibilityL(
CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
CDesCArray* array = new (ELeave) CDesCArrayFlat( 1 );
CleanupStack::PushL( array );
for ( TInt i = 0; i < commands.Count(); ++i )
{
TInt itemLength = commands[i]->Caption().Length() +
KTab().Length();
HBufC* item = HBufC::NewLC( itemLength );
TPtr itemPtr = item->Des();
itemPtr.Append( commands[i]->Caption() );
itemPtr.Append( KTab );
array->AppendL( *item );
CleanupStack::PopAndDestroy( item );
item = NULL;
}
CleanupStack::Pop( array );
listBox->Model()->SetItemTextArray( array );
CleanupStack::Pop( popup );
TInt selectedCommand = -1;
if ( popup->ExecuteLD() )
{
selectedCommand = listBox->CurrentItemIndex();
}
CleanupStack::PopAndDestroy( listBox );
if ( selectedCommand != -1 )
{
// This will not work...
TRAPD( err, commands[ selectedCommand ]->ExecuteL() );
if ( err != KErrNone )
{
CEikonEnv* eikonEnv = CEikonEnv::Static();
CMCETestUIAppUi* tempUiPtr = (CMCETestUIAppUi*)eikonEnv->AppUi();
TInt errorLength = KLeaveMessage().Length() + 10;
HBufC* error = HBufC::NewL( errorLength );
TPtr errorPtr = error->Des();
errorPtr.Append( KLeaveMessage );
errorPtr.AppendNum( err );
// User::InfoPrint( *error );
tempUiPtr->NotifyUser(*error);
delete error;
}
}
}
示例12: HandlePropertyChangedL
// ----------------------------------------------------------------------------
// CSysApPubSubObserver::HandlePropertyChangedL()
// ----------------------------------------------------------------------------
void CSysApPubSubObserver::HandlePropertyChangedL( const TUid& aCategory, const TUint aKey )
{
TInt value( 0 );
RProperty::Get( aCategory, aKey, value );
#ifdef _DEBUG
HBufC* hbuf = HBufC::New( 120 );
if ( hbuf )
{
TPtr buf = hbuf->Des();
buf = _L("CSysApPubSubObserver::HandlePropertyChangedL: category=0x");
buf.AppendNumFixedWidth( aCategory.iUid, EHex, 8 );
buf.Append( _L(", key=0x") );
buf.AppendNumFixedWidth( aKey, EHex, 8 );
buf.Append( _L(", value=") );
buf.AppendNum( value );
RDebug::Print( buf );
delete hbuf;
}
#endif
// KIrdaPropertyCategory is actually defined as KUidSystemCategory, but just in case this ever changes,
// check them separately here. The keys should have no overlap.
if ( aCategory == KUidSystemCategory || aCategory == KIrdaPropertyCategory )
{
HandleSystemCategoryL( aKey, value );
}
else if ( aCategory == KPSUidStartup || aCategory == KAlarmServerPubSubCategory )
{
HandleStartupCategoryL( aKey, value );
}
else if ( aCategory == KPSUidCoreApplicationUIs )
{
HandleCoreAppUIsCategoryL( aKey, value );
}
else if ( aCategory == KPSUidHWRMPowerState )
{
HandleHwrmPowerStateCategoryL( aKey, value );
}
else if ( aCategory == KPSUidWlan )
{
HandleWlanCategoryL( aKey, value );
}
else if ( aCategory == KPSUidCtsyCallInformation )
{
HandleTelephonyCallInformationCategoryL( aKey, value );
}
else if ( aCategory == KPSUidNetworkInfo )
{
HandleNetworkInfoCategoryL( aKey, value );
}
else if ( aCategory == KPSUidHWRM )
{
HandleHwrmCategoryL( aKey, value );
}
/* else if ( aCategory == KPSUidHWRMFmTx )
{
HandleHwrmFmTxCategoryL( aKey, value );
}
*/
else if ( aCategory == KPSUidDataSynchronizationInternalKeys )
{
HandleDataSyncCategoryL( aKey, value );
}
else if ( aCategory == KPosIndicatorCategoryUid )
{
HandlePosIndicatorCategoryL( aKey, value );
}
else if ( aCategory == KUidPSSMSStackCategory )
{
HandleSmsStackCategoryL( aKey, value );
}
else if ( aCategory == KPSUidAvkonDomain)
{
HandleLKeylockEventL( aKey, value );
}
else if ( aCategory == KPSUidSecurityUIs)
{
HandleLightsOnRequestL( aKey, value );
}
}