本文整理汇总了C++中CArrayFix::AppendL方法的典型用法代码示例。如果您正苦于以下问题:C++ CArrayFix::AppendL方法的具体用法?C++ CArrayFix::AppendL怎么用?C++ CArrayFix::AppendL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CArrayFix
的用法示例。
在下文中一共展示了CArrayFix::AppendL方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
LOCAL_C void test1(CArrayFix<TText>& aFix)
//
{
test.Next(_L("AppendL and InsertL single chars"));
aFix.AppendL(_S("abcd"),4);
test(aFix[0]=='a');
test(aFix[1]=='b');
test(aFix[3]=='d');
test(aFix.Count()==4);
aFix.InsertL(2,_S("ef"),2);
test(aFix[1]=='b');
test(aFix[2]=='e');
test(aFix[4]=='c');
test(aFix.Count()==6);
aFix.AppendL(TText('z'));
test(aFix[6]=='z');
aFix.InsertL(0,TText('y'));
test(aFix[0]=='y');
test(aFix[1]=='a');
test(aFix.Count()==8);
test.Next(_L("Delete single chars"));
aFix.Delete(3);
test(aFix[2]=='b');
test(aFix[3]=='f');
test(aFix[4]=='c');
aFix.Delete(1,2);
test(aFix[0]=='y');
test(aFix[1]=='f');
test(aFix[2]=='c');
test(aFix.Count()==5);
aFix.Compress();
}
示例2: DecodeRespL
TBool CPingController::DecodeRespL()
{
// Reply from %S: bytes=%D time=%Dms TTL=%D
// time
TUint32 triptime = User::NTickCount() - iTimestamp;//icmpHdr->timestamp;
const TUint8* reply = iReplyBuf.Ptr();
const TIpHdr* ipHdr = (const TIpHdr*)reply;
const TIcmpHdr* icmpHdr = (const TIcmpHdr*)(reply + ipHdr->ip_hl * 4);
if (ntohs(icmpHdr->icd_id) != ICMP_ID)
{
iReplyText = StringLoader::LoadL(R_PKTPING_SOMEONE_ELSE_PACKET_RECEIVED);
return EFalse;
}
if (icmpHdr->icmp_type != ICMP_ECHOREPLY)
{
iReplyText = StringLoader::LoadL(R_PKTPING_NONE_ECHO_TYPE_RECEIVED_FORMAT, icmpHdr->icmp_type);
return ETrue;
}
if (ntohs(icmpHdr->icd_seq) != iIcmpPacket->SeqNo())
{
iReplyText = StringLoader::LoadL(R_PKTPING_OUT_OF_ORDER_PACKET_RECEIVED);
return EFalse;
}
// from
iRecv.Zero();
iRecvAddr.Output(iRecv);
// bytes
TUint16 bytes = ntohs(ipHdr->ip_len) - ipHdr->ip_hl * 4 - ICMP_HDR_LEN;
// TTL
TUint8 ttl = ipHdr->ip_ttl;
CDesCArrayFlat* strings = new (ELeave) CDesCArrayFlat( 1 );
CleanupStack::PushL( strings );
strings->AppendL(iRecv);
CArrayFix<TInt>* vals = new (ELeave) CArrayFixFlat<TInt>(3);
CleanupStack::PushL( vals );
vals->AppendL(bytes);
vals->AppendL(triptime);
vals->AppendL(ttl);
iReplyText = StringLoader::LoadL(R_PKTPING_REPLY_TEXT_FORMAT, *strings, *vals);
CleanupStack::PopAndDestroy(2); // strings, vals
//stat
iStat.sum += triptime;
++(iStat.received);
iStat.min = Min(iStat.min, triptime);
iStat.max = Max(iStat.max, triptime);
return ETrue;
}
示例3: TestQVDCurrentValueTextLCL
// -----------------------------------------------------------------------------
// CTestSDKQueries::TestQVSetQueryModeL
// -----------------------------------------------------------------------------
//
TInt CTestSDKQueries::TestQVDCurrentValueTextLCL( CStifItemParser& /*aItem*/ )
{
CAknQueryValueDate* date = CAknQueryValueDate::NewL();
CleanupStack::PushL( date );
CAknQueryValueDateArray* dateArray = CAknQueryValueDateArray::NewL( R_TESTQUERY_DATE_FORMAT );
CleanupStack::PushL( dateArray );
CArrayFix<TTime>* timeArray = new( ELeave ) CArrayFixFlat<TTime>( 4 );
CleanupStack::PushL( timeArray );
TTime time1;
time1.HomeTime();
TTime time2;
time2 = time1 + TTimeIntervalDays( 3 );
timeArray->AppendL( time1 );
timeArray->AppendL( time2 );
dateArray->SetArray( *timeArray );
date->SetArrayL( dateArray );
HBufC* text = date->CurrentValueTextLC();
STIF_ASSERT_NOT_NULL( text );
CleanupStack::Pop( KThree );
CleanupStack::PopAndDestroy( date );
return KErrNone;
}
示例4: TestQVDCreateEditorL
// -----------------------------------------------------------------------------
// CTestSDKQueries::TestQVSetQueryModeL
// -----------------------------------------------------------------------------
//
TInt CTestSDKQueries::TestQVDCreateEditorL( CStifItemParser& /*aItem*/ )
{
CAknQueryValueDate* date = CAknQueryValueDate::NewL();
CleanupStack::PushL( date );
CAknQueryValueDateArray* dateArray = CAknQueryValueDateArray::NewL( R_TESTQUERY_DATE_FORMAT );
CleanupStack::PushL( dateArray );
CArrayFix<TTime>* timeArray = new( ELeave ) CArrayFixFlat<TTime>( 4 );
CleanupStack::PushL( timeArray );
TTime time1;
time1.HomeTime();
TTime time2;
time2 = time1 + TTimeIntervalDays( 3 );
timeArray->AppendL( time1 );
timeArray->AppendL( time2 );
dateArray->SetArray( *timeArray );
date->SetArrayL( dateArray );
date->SetCurrentValueIndex( KZero );
TBool flag = date->CreateEditorL();
STIF_ASSERT_TRUE( flag );
CleanupStack::Pop( KTwo );
CleanupStack::PopAndDestroy( date );
return KErrNone;
}
示例5: TestQVDAFormattedStringSizeTwoL
// -----------------------------------------------------------------------------
// CTestSDKQueries::TestQVDAFormattedStringSizeTwoL
// -----------------------------------------------------------------------------
//
TInt CTestSDKQueries::TestQVDAFormattedStringSizeTwoL( CStifItemParser& /*aItem*/ )
{
CAknQueryValueDateArray* dateArray = CAknQueryValueDateArray::NewL( R_TESTQUERY_DATE_FORMAT );
CleanupStack::PushL( dateArray );
CArrayFix<TTime>* timeArray = new( ELeave ) CArrayFixFlat<TTime>( 4 );
CleanupStack::PushL( timeArray );
TTime time1;
time1.HomeTime();
TTime time2;
time2 = time1 + TTimeIntervalDays( 3 );
timeArray->AppendL( time1 );
timeArray->AppendL( time2 );
dateArray->SetArray( *timeArray );
TInt size = dateArray->FormattedStringSize();
STIF_ASSERT_NOT_EQUALS( KZero, size );
CleanupStack::Pop( timeArray );
CleanupStack::PopAndDestroy( dateArray );
return KErrNone;
}
示例6: TestQVNumberSetArrayL
// -----------------------------------------------------------------------------
// CTestSDKQueries::TestQVNumberSetArrayL
// -----------------------------------------------------------------------------
//
TInt CTestSDKQueries::TestQVNumberSetArrayL( CStifItemParser& /*aItem*/ )
{
CAknQueryValueNumber* number = CAknQueryValueNumber::NewLC();
const MDesCArray* returnArray = number->MdcArray();
STIF_ASSERT_NULL( returnArray );
CArrayFix<TInt>* mArray = new( ELeave ) CArrayFixFlat<TInt>( 2 );
CleanupStack::PushL( mArray );
mArray->AppendL( KNumber1 );
mArray->AppendL( KNumber2 );
CAknQueryValueNumberArray* numberArray =
CAknQueryValueNumberArray::NewL( R_TESTQUERY_NUMBER_FORMAT );
CleanupStack::PushL( numberArray );
numberArray->SetArray( *mArray );
number->SetArrayL( numberArray );
returnArray = number->MdcArray();
STIF_ASSERT_EQUALS( numberArray, ( CAknQueryValueNumberArray* )returnArray );
CleanupStack::Pop( KTwo );
CleanupStack::PopAndDestroy( number );
return KErrNone;
}
示例7: WrapPhoneNumberToArrayL
EXPORT_C TBool AknPhoneNumberTextUtils::WrapPhoneNumberToArrayL(
const TDesC& aPhoneNumberToWrap,
TInt aLineWidthInPixels,
TInt aMaxLines,
const CFont& aFont,
CArrayFix<TPtrC>& aWrappedArray )
{
TBool retVal( EFalse ); // Not truncated
HBufC* reversedText = aPhoneNumberToWrap.AllocLC();
TPtr revPtr = reversedText->Des();
ReverseDescriptor( revPtr );
CArrayFix<TInt>* lineWidthArray = new (ELeave) CArrayFixFlat<TInt>(KLineArrayGranularity);
CleanupStack::PushL( lineWidthArray );
lineWidthArray->AppendL( aLineWidthInPixels, aMaxLines );
// Perform the wrap on the reversed text
AknTextUtils::WrapToArrayL( revPtr, *lineWidthArray, aFont, aWrappedArray );
// Now rearrange the TPtrCs to point to the original array
TInt totalLen = reversedText->Length();
TInt count = aWrappedArray.Count();
TInt usedLen = 0; // Accumulates the length actually used
for ( TInt index = 0; index < count; index++)
{
TPtrC& currentPtr = aWrappedArray.At(index);
// The TPtrCs have to be moved. The reversing is taken into effect, but not purely reversed
// because their otherwise they would have negative lengths. That is, {a,b} does not go to
// { final - a, final - b }, but rather to {final - b, final - a}; they are flipped, to get
// their start points before the end points
//
// Now, representing the start position by pos, and the end by pos+len-1 we have the TPtrC at
// {pos, pos+len-1} inclusive, in reversed array.
// The TPtrC must be modified to point to {total_len-1 - (pos+len-1), total_len-1 - pos}
// in the unreversed array:
TInt len = currentPtr.Length();
usedLen += len;
TInt pos = currentPtr.Ptr() - reversedText->Ptr(); // pointer arithmetic
TInt newPos = totalLen - pos - len;
// If the TPtr is zero length then it must get special treatment, as the normal
// calculations give an end point before the start point! i.e. {pos, pos-1}
// We handle this by NOT flipping in this case.
// { pos, pos-1 } -> {totalLen-1-pos, totalLen-1 - (pos-1)}
// Note that a zero length wrapped line is completely possible amoung a bunch of other
// lines with characters on them, as the line lengths may be of wildly different lengths.
if ( len == 0 )
newPos--;
currentPtr.Set( aPhoneNumberToWrap.Mid(newPos, len) );
}
// If the accumulated length is less than that in the entire input descriptor, then text does not fit
if ( usedLen < totalLen )
retVal = ETrue;
CleanupStack::PopAndDestroy(2); // lineWidthArray first, and then reversedText
return retVal;
}
示例8: TestQVDAMdcaPointL
// -----------------------------------------------------------------------------
// CTestSDKQueries::TestQVDAMdcaPointL
// -----------------------------------------------------------------------------
//
TInt CTestSDKQueries::TestQVDAMdcaPointL( CStifItemParser& /*aItem*/ )
{
CAknQueryValueDateArray* dateArray = CAknQueryValueDateArray::NewL( R_TESTQUERY_DATE_FORMAT );
CleanupStack::PushL( dateArray );
CArrayFix<TTime>* timeArray = new( ELeave ) CArrayFixFlat<TTime>( 4 );
CleanupStack::PushL( timeArray );
TTime time1;
time1.HomeTime();
TTime time2;
time2 = time1 + TTimeIntervalDays( 3 );
timeArray->AppendL( time1 );
timeArray->AppendL( time2 );
dateArray->SetArray( *timeArray );
for ( TInt mark = 0; mark < dateArray->MdcaCount(); mark++ )
{
TPtrC text = dateArray->MdcaPoint( mark );
STIF_ASSERT_NOT_NULL( &text );
}
CleanupStack::Pop( timeArray );
CleanupStack::PopAndDestroy( dateArray );
return KErrNone;
}
示例9: TestQVNumberCreateEditorL
// -----------------------------------------------------------------------------
// CTestSDKQueries::TestQVNumberCreateEditorL
// -----------------------------------------------------------------------------
//
TInt CTestSDKQueries::TestQVNumberCreateEditorL( CStifItemParser& /*aItem*/ )
{
CAknQueryValueNumber* number = CAknQueryValueNumber::NewLC();
CArrayFix<TInt>* mArray = new( ELeave ) CArrayFixFlat<TInt>( 2 );
CleanupStack::PushL( mArray );
mArray->AppendL( KNumber1 );
mArray->AppendL( KNumber2 );
CAknQueryValueNumberArray* numberArray =
CAknQueryValueNumberArray::NewL( R_TESTQUERY_NUMBER_FORMAT );
CleanupStack::PushL( numberArray );
numberArray->SetArray( *mArray );
number->SetArrayL( numberArray );
number->SetCurrentValueIndex( KZero );
TBool flag = number->CreateEditorL();
STIF_ASSERT_TRUE( flag );
CleanupStack::Pop( KTwo );
CleanupStack::PopAndDestroy( number );
return KErrNone;
}
示例10: TestQVNumberCurrentValueTextLCL
// -----------------------------------------------------------------------------
// CTestSDKQueries::TestQVNumberCurrentValueTextLCL
// -----------------------------------------------------------------------------
//
TInt CTestSDKQueries::TestQVNumberCurrentValueTextLCL( CStifItemParser& /*aItem*/ )
{
CAknQueryValueNumber* number = CAknQueryValueNumber::NewLC();
CArrayFix<TInt>* mArray = new( ELeave ) CArrayFixFlat<TInt>( 2 );
CleanupStack::PushL( mArray );
mArray->AppendL( KNumber1 );
mArray->AppendL( KNumber2 );
CAknQueryValueNumberArray* numberArray =
CAknQueryValueNumberArray::NewL( R_TESTQUERY_NUMBER_FORMAT );
CleanupStack::PushL( numberArray );
numberArray->SetArray( *mArray );
number->SetArrayL( numberArray );
HBufC* text = number->CurrentValueTextLC();
STIF_ASSERT_NOT_NULL( text );
CleanupStack::Pop( KThree );
CleanupStack::PopAndDestroy( number );
return KErrNone;
}
示例11: InternalizeL
// ---------------------------------------------------------------------------
// CXIMPContextEventFilter::InternalizeL()
// ---------------------------------------------------------------------------
//
EXPORT_C void CXIMPContextEventFilter::InternalizeL(
RReadStream& aStream )
{
TInt count = aStream.ReadInt32L();
if( count )
{
//We are internalizing data which we have previously externalized
// => Internalized array can be directly set as current array
CArrayFix< TInt32 >* events =
new (ELeave) CArrayFixFlat< TInt32 >( KXIMPEventListGranurality );
CleanupStack::PushL( events );
for( TInt ix = 0; ix < count; ++ix )
{
events->AppendL( aStream.ReadInt32L() );
}
delete iAcceptedEvents;
iAcceptedEvents = events;
CleanupStack::Pop( events );
}
else
{
delete iAcceptedEvents;
iAcceptedEvents = NULL;
}
}
示例12: GetAvailableHeightsInTwipsL
EXPORT_C TInt FontUtils::GetAvailableHeightsInTwipsL(const CGraphicsDevice& aDevice,const TDesC& aTypefaceName,CArrayFix<TInt>& aHeightList)
/** Gets a list of all heights in twips, available for the named typeface and the
graphics device specified.
@param aDevice The graphics device.
@param aTypefaceName The name of the typeface.
@param aHeightList On return, contains all available heights for the typeface,
in twips.
@return KErrNotSupported if the named typeface is not supported by the graphics
device, otherwise KErrNone. */
{ // static
aHeightList.Reset();
const TInt numTypefaces=aDevice.NumTypefaces();
TInt fontIndex;
for (fontIndex=0;fontIndex<numTypefaces;fontIndex++)
{
TTypefaceSupport typefaceInfo;
aDevice.TypefaceSupport(typefaceInfo,fontIndex);
if (typefaceInfo.iTypeface.iName==aTypefaceName)
break;
}
if (fontIndex>=numTypefaces)
return KErrNotSupported;
TTypefaceSupport typefaceInfo;
aDevice.TypefaceSupport(typefaceInfo,fontIndex);
const TInt numHeights=typefaceInfo.iNumHeights;
for (TInt ii=0;ii<numHeights;ii++)
{
const TInt height=aDevice.FontHeightInTwips(fontIndex,ii);
if (PointsFromTwips(height)>=EMinFontHeight)
aHeightList.AppendL(height);
}
return KErrNone;
}
示例13: readStream
/**
Retrieves the SIM lanugages list.
This will retrieve the SIM languages list in a dynamic array, the list was prepared by a previous successful call to @c PrepareSimLanguages().
@param aSimLanguageCount The count of the languages as prepared in a previous call to @c PrepareSimLanguages().
This count is used to allocate and expand the size of the flat buffer.
@return A pointer to the fixed length array CArrayFix<TInt32> of language codes.
@note This API can only be called by processes with the SecureID of the System State Manager.
@see RSsmMiscAdaptation::PrepareSimLanguages
@publishedPartner
@released
*/
EXPORT_C CArrayFix<TInt32>* RSsmMiscAdaptation::SimLanguagesArrayL(TInt aSimLanguageCount)
{
if(! Handle())
{
User::Leave(KErrDisconnected);
}
CArrayFix<TInt32>* clientArray = new (ELeave) CArrayFixFlat<TInt32>(2);
CleanupStack::PushL(clientArray);
CBufFlat* buffer=CBufFlat::NewL(aSimLanguageCount);
CleanupStack::PushL(buffer);
const TInt length = aSimLanguageCount * sizeof(TInt32);
buffer->ExpandL(0,length);
TPtr8 bufPtr = buffer->Ptr(0);
User::LeaveIfError(SendReceive(EGetSimLanguagesArray, TIpcArgs(&bufPtr, aSimLanguageCount)));
RBufReadStream readStream(*buffer);
CleanupClosePushL(readStream);
TInt32 langId = 0; //Initialized with value 0 because this value is not a language id
for (TInt i=0; i < aSimLanguageCount; ++i)
{
langId = readStream.ReadInt32L();
clientArray->AppendL(langId);
}
CleanupStack::PopAndDestroy(2); //readStream, buffer
CleanupStack::Pop(clientArray);
return clientArray;
}
示例14: GetColorUseListL
EXPORT_C void LafScrollThumb::GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList)
{ // static
TInt commonAttributes = TCoeColorUse::ESurrounds|TCoeColorUse::ENormal|TCoeColorUse::ENeutral;
TCoeColorUse colorUse;
colorUse.SetLogicalColor(EColorScrollThumbDimmed);
colorUse.SetUse(TCoeColorUse::EBack|TCoeColorUse::EDimmed|commonAttributes);
aColorUseList.AppendL(colorUse);
colorUse.SetLogicalColor(EColorScrollButtonThumbBackgroundPressed);
colorUse.SetUse(TCoeColorUse::EFore|TCoeColorUse::EPressed|commonAttributes);
aColorUseList.AppendL(colorUse);
colorUse.SetLogicalColor(EColorScrollButtonThumbBackground);
colorUse.SetUse(TCoeColorUse::EBack|TCoeColorUse::EActive|commonAttributes);
aColorUseList.AppendL(colorUse);
}
示例15: GetColorUseListL
EXPORT_C void LafMenuPane::GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList)
{ // static
TInt commonAttributes = TCoeColorUse::ENormal|TCoeColorUse::ENeutral;
TCoeColorUse colorUse;
colorUse.SetLogicalColor(EColorMenuPaneText);
colorUse.SetUse(TCoeColorUse::EFore|TCoeColorUse::EActive|TCoeColorUse::ESurrounds|commonAttributes);
aColorUseList.AppendL(colorUse);
colorUse.SetLogicalColor(EColorMenuPaneBackground);
colorUse.SetUse(TCoeColorUse::EBack|TCoeColorUse::EActive|TCoeColorUse::ESurrounds|commonAttributes);
aColorUseList.AppendL(colorUse);
colorUse.SetLogicalColor(EColorMenuPaneTextHighlight);
colorUse.SetUse(TCoeColorUse::EFore|TCoeColorUse::EActive|TCoeColorUse::EHighlights|commonAttributes);
aColorUseList.AppendL(colorUse);
colorUse.SetLogicalColor(EColorMenuPaneHighlight);
colorUse.SetUse(TCoeColorUse::EBack|TCoeColorUse::EActive|TCoeColorUse::EHighlights|commonAttributes);
aColorUseList.AppendL(colorUse);
colorUse.SetLogicalColor(EColorMenuPaneDimmedTextHighlight);
colorUse.SetUse(TCoeColorUse::EBack|TCoeColorUse::EDimmed|TCoeColorUse::EHighlights|commonAttributes);
aColorUseList.AppendL(colorUse);
colorUse.SetLogicalColor(EColorMenuPaneDimmedHighlight);
colorUse.SetUse(TCoeColorUse::EFore|TCoeColorUse::EDimmed|TCoeColorUse::EHighlights|commonAttributes);
aColorUseList.AppendL(colorUse);
colorUse.SetLogicalColor(EColorMenuPaneDimmedText);
colorUse.SetUse(TCoeColorUse::EBack|TCoeColorUse::EDimmed|TCoeColorUse::ESurrounds|commonAttributes);
aColorUseList.AppendL(colorUse);
}