本文整理汇总了C++中CArrayFix类的典型用法代码示例。如果您正苦于以下问题:C++ CArrayFix类的具体用法?C++ CArrayFix怎么用?C++ CArrayFix使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CArrayFix类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetAvailableHeightsInTwipsAndPointsL
EXPORT_C TInt FontUtils::GetAvailableHeightsInTwipsAndPointsL(const CGraphicsDevice& aDevice,const TDesC& aTypefaceName,CArrayFix<TInt>& aTwipsList,CDesCArray& aPointsList)
/** Gets a list of all heights in twips, available for the named typeface and the
graphics device specified.
Also gets a list of heights in points, represented as character strings.
@param aDevice The graphics device.
@param aTypefaceName The name of the typeface.
@param aTwipsList On return, contains all available heights for the typeface,
in twips.
@param aPointsList On return, the heights in points, represented as character
strings.
@return KErrNotSupported if the named typeface is not supported by the graphics
device, otherwise KErrNone. */
{ // static
aTwipsList.Reset();
aPointsList.Reset();
TInt err=GetAvailableHeightsInTwipsL(aDevice,aTypefaceName,aTwipsList);
if (err==KErrNotSupported)
return err;
const TInt count=aTwipsList.Count();
for (TInt ii=0;ii<count;ii++)
{
const TInt points=PointsFromTwips(aTwipsList[ii]);
if (points<EMinFontHeight)
continue;
TBuf<8> num;
num.Num(points);
aPointsList.AppendL(num);
}
return KErrNone;
}
示例2: JELOG2
// -----------------------------------------------------------------------------
// CPIMAgnToDoAdapter::ExportItemL
// (other items were commented in a header)
// -----------------------------------------------------------------------------
//
void CPIMAgnToDoAdapter::ExportItemL(const MPIMToDoItem& aItem,
CCalEntry& aEntry, TBool aResetEntry)
{
JELOG2(EPim);
if (aResetEntry)
{
// Reset native entry for exporting new data
aEntry.SetSummaryL(KNullDesC());
aEntry.SetDescriptionL(KNullDesC());
aEntry.SetPriorityL(0);
aEntry.SetCompletedL(EFalse, aEntry.CompletedTimeL());
}
// Export item data to the native ToDo calendar entry
const MPIMItemData& itemData = aItem.ItemData();
CArrayFix<TPIMField>* fields = itemData.FieldsLC();
// Add default values to the calendar entry
AddDefaultValuesToEntryL(itemData, aEntry);
// Convert each field to the native ToDo calendar entry
TInt count = fields->Count();
for (TInt i = 0; i < count; i++)
{
TPIMToDoField field = static_cast<TPIMToDoField>(fields->At(i));
ConvertToAgnL(field, aEntry, itemData);
}
CleanupStack::PopAndDestroy(fields);
}
示例3: PrepareSimLanguages
/**
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;
}
示例4: new
// -----------------------------------------------------------------------------
// 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: 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;
}
示例6: STIF_ASSERT_NULL
// -----------------------------------------------------------------------------
// 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: test3
LOCAL_C void test3(CArrayFix<TInt>& aFix)
{
test.Next(_L("InsertIsqL"));
TKeyArrayFix kk(0,ECmpTInt);
TInt pos=0;
TInt mod=47;
TInt inc=23;
TInt i=0;
FOREVER
{
TInt ret;
if (i&1)
TRAP(ret,aFix.InsertIsqL(i,kk))
else
{
TRAP(ret,pos=aFix.InsertIsqL(i,kk))
if (ret==KErrNone)
test(aFix[pos]==i);
}
if (ret==KErrAlreadyExists)
break;
i=(i+inc)%mod;
}
for(i=0;i<mod;i++)
{
test(aFix.FindIsq(i,kk,pos)==0);
test(pos==i);
TRAPD(r,aFix.InsertIsqL(i,kk))
test(r==KErrAlreadyExists);
}
}
示例8: new
// ---------------------------------------------------------------------------
// 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;
}
}
示例9: retVal
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;
}
示例10: new
// -----------------------------------------------------------------------------
// 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;
}
示例11: ConvertExceptionDatesL
// -----------------------------------------------------------------------------
// CPIMEventPropertyConverter::ConvertExceptionDatesL
// Inserts exceptiondates to a parser.
// -----------------------------------------------------------------------------
//
void CPIMEventPropertyConverter::ConvertExceptionDatesL(const CArrayFix<
TPIMDate>& aDates, CParserVCalEntity& aParser)
{
JELOG2(EPim);
TInt exDateCount = aDates.Count();
if (exDateCount > 0)
{
CArrayPtrFlat<TVersitDateTime>* versitExDates =
new(ELeave) CArrayPtrFlat<TVersitDateTime> (exDateCount);
CleanupStack::PushL(versitExDates);
CleanupResetAndDestroyPushL(*versitExDates);
for (TInt i = 0; i < exDateCount; i++)
{
TVersitDateTime
* versitDateTime =
new(ELeave) TVersitDateTime(aDates.At(i).DateTime(), TVersitDateTime::EIsUTC);
CleanupDeletePushL(versitDateTime);
versitExDates->AppendL(versitDateTime);
CleanupStack::Pop(versitDateTime); // versitDateTime
}
CParserPropertyValue* propertyValue =
new(ELeave) CParserPropertyValueMultiDateTime(versitExDates);
CleanupStack::Pop(2); // versitExDates is now owned by propertyValue
AddPropertyToParserL(propertyValue, KVersitTokenEXDATE(), aParser);
// Needed cleanup stack items are popped out in the AddPropretyToParserL
}
}
示例12:
// ---------------------------------------------------------
// FavouritesUtil::ExternalizeL
// ---------------------------------------------------------
//
void FavouritesUtil::ExternalizeL
( const CArrayFix<TInt>& aArray, RWriteStream& aStream )
{
aStream.WriteInt32L( aArray.Count() );
for ( TInt i = 0; i < aArray.Count(); i++ )
{
aStream.WriteInt32L( aArray[ i ] );
}
}
示例13: ntohs
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;
}
示例14: JELOG2
// -----------------------------------------------------------------------------
// CPIMAgnEventAdapter::ConvertFieldsToAgnL
// Reads PIM Item fields and converts them into Agenda entry's fields.
// -----------------------------------------------------------------------------
//
void CPIMAgnEventAdapter::ConvertFieldsToAgnL(const MPIMEventItem& aItem,
CCalEntry& aEntry)
{
JELOG2(EPim);
CArrayFix<TPIMField>* fields = aItem.ItemData().FieldsLC();
TInt amount = fields->Count();
for (int i = 0; i < amount; i++)
{
TPIMEventField field = static_cast<TPIMEventField>(fields->At(i));
switch (field)
{
case EPIMEventSummary: // Fallthrough
case EPIMEventLocation: // Fallthrough
case EPIMEventNote:
{
ConvertStringFieldToAgnL(aItem, aEntry, field);
break;
}
case EPIMEventAlarm:
{
ConvertAlarmToAgnL(aItem, aEntry);
break;
}
case EPIMEventStart: // Fallthrough
case EPIMEventEnd:
{
ConvertDateFieldToAgnL(aItem, aEntry, field);
break;
}
case EPIMEventClass:
{
ConvertClassToAgnL(aItem, aEntry);
break;
}
case EPIMEventRevision: // fallthrough
case EPIMEventUid:
{
// nothing
break;
}
default:
{
User::Leave(KErrArgument);
}
}
}
CleanupStack::PopAndDestroy(fields);
}
示例15: 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);
}