本文整理汇总了C++中CDesCArray::Count方法的典型用法代码示例。如果您正苦于以下问题:C++ CDesCArray::Count方法的具体用法?C++ CDesCArray::Count怎么用?C++ CDesCArray::Count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDesCArray
的用法示例。
在下文中一共展示了CDesCArray::Count方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TestNavigationL
void CBCTestPtiEngine::TestNavigationL()
{
iEngine->ClearCurrentWord();
SimuInput(iEngine, _L("46873"));
CDesCArray* cands = new (ELeave) CDesCArrayFlat(16);
CleanupStack::PushL(cands);
iEngine->GetCandidateListL(*cands);
AssertIntL(0, iEngine->FirstCandidate().Compare(cands->MdcaPoint(0)),
_L("First candidate verified"));
for (int i = 1; i < cands->Count(); ++i)
{
AssertIntL(0, iEngine->NextCandidate().Compare(cands->MdcaPoint(i)),
_L("next candidate verified"));
}
for (int i = cands->Count() - 2; i >= 0; --i)
{
AssertIntL(0, iEngine->PreviousCandidate().Compare(cands->MdcaPoint(i)),
_L("Previous candidate verified"));
}
CleanupStack::PopAndDestroy(); // cands
}
示例2: DoCompareCDesCArray
TBool CPackagerCntComparator::DoCompareCDesCArray(const CDesCArray& anArray1, const CDesCArray& anArray2) const
/** Compares two CDesCArray items.
@param anArray1 The first CDesCArray to be compared.
@param anArray2 The second CDesCArray to be compared.
@return ETrue if the two items are equal, EFalse otherwise. */
{// Need to check for NULL arrays first.
if((!&anArray1) && (!&anArray2))
{
return ETrue;
}
if((!&anArray1) || (!&anArray1))
{
return EFalse;
}
// Check if arrays are same length to begin with.
TInt maxCount = anArray1.Count();
if(!DoCompareTInt(maxCount, anArray2.Count()))
{
return EFalse;
}
for(TInt i=0; i<maxCount; ++i)
{
if(anArray1[i]!=anArray2[i])
{
return EFalse;
}
}
return ETrue;
}
示例3: CopyToNewJavaStringArrayL
jobjectArray CopyToNewJavaStringArrayL(JNIEnv& aJni,
const CDesCArray& aNativeArray)
{
JELOG2(EJavaLocation);
jclass stringClass = aJni.FindClass("java/lang/String");
User::LeaveIfNull(stringClass);
//
jobjectArray result = aJni.NewObjectArray(aNativeArray.Count(),
stringClass, NULL);
if (result != NULL)
{
TPtrC item;
for (int i = 0; i < aNativeArray.Count(); ++i)
{
item.Set(aNativeArray[i]);
jstring javaString =
java::util::S60CommonUtils::NativeToJavaString(aJni, item);
User::LeaveIfNull(javaString);
//
aJni.SetObjectArrayElement(result, i, javaString);
aJni.DeleteLocalRef(javaString);
}
}
return result;
}
示例4: NotifyNewResultsL
void CMdEQuery::NotifyNewResultsL( const CDesCArray& aNewResults )
{
TInt firstNewItemIndex = aNewResults.Count();
TInt oldCount = 0;
if( iDistinctResults )
{
oldCount = iDistinctResults->Count();
}
else
{
iDistinctResults = new (ELeave) CDesCArrayFlat( 8 );
}
TRAPD( err, AppendResultsL( aNewResults ) );
if( err != KErrNone )
{
// Cleanup: remove the ones that were added.
while( iDistinctResults->Count() > oldCount )
{
iDistinctResults->Delete( iDistinctResults->Count() - 1 );
}
// Leave with the same error.
User::Leave(err);
}
for( TInt i = iObservers.Count() - 1; i >=0; i-- )
{
MMdEQueryObserver* observer = iObservers[i];
observer->HandleQueryNewResults( *this, firstNewItemIndex,
aNewResults.Count() );
}
}
示例5: TestPredictL
void CBCTestPtiEngine::TestPredictL()
{
//predictive
iEngine->ActivateLanguageL(ELangEnglish, EPtiEnginePredictive);
SimuInput(iEngine, _L("this"));
TBuf<32> msg=_L("current word is: ");
msg.Append(iEngine->CurrentWord()); //may be "this"
msg.ZeroTerminate();
AssertTrueL( ETrue, msg);
// next
msg=_L("next word is: ");
msg.Append(iEngine->NextCandidate()); // Move on to next candidate.
msg.ZeroTerminate();
AssertTrueL( ETrue, msg);
iEngine->CommitCurrentWord();
// delete
SimuInput(iEngine, _L("8447"));
msg = _L("current word after del is: ");
msg.Append(iEngine->DeleteKeyPress());
msg.ZeroTerminate();
AssertTrueL(ETrue, msg);
// reject
iEngine->ClearCurrentWord();
AssertTrueL(ETrue, _L("reject current word"));
// char2key
AssertIntL(EPtiKey7, iEngine->CharacterToKey('s'), _L("char 's' map to key 7"));
// candidate list
iEngine->ClearCurrentWord();
CDesCArray* cands = new (ELeave) CDesCArrayFlat(16);
CleanupStack::PushL(cands);
SimuInput(iEngine, _L("8447"));
iEngine->GetCandidateListL(*cands);
msg=_L("candidates: ");
for (int i = 0; i < cands->Count(); ++i)
{
msg.Append(cands->MdcaPoint(i));
msg.Append(_L(", "));
}
msg.ZeroTerminate();
AssertIntL(cands->Count(), iEngine->NumberOfCandidates(), msg);
CleanupStack::PopAndDestroy(); // cands
// set current word
iEngine->SetCurrentWord(_L("dog"));
SimuInput(iEngine, _L("t"));
msg=_L("dog+t change to: ");
msg.Append(iEngine->CurrentWord());
msg.ZeroTerminate();
AssertTrueL(ETrue, msg);
}
示例6: Update
void CPluginsList::Update()
{
CDesCArray* itemArray = static_cast< CDesCArray* > ( iListBox->Model()->ItemTextArray() );
if (itemArray->Count()>0){itemArray->Delete(0,itemArray->Count());}
iListBox->HandleItemAdditionL();
TInt i=0;
for (i=0; i<((CPluginsListView*)iCommandObserver)->iPlugins->Count(); i++)
{
TBuf<255> Buf;
CreateListBoxItemL(Buf,((CPluginsListView*)iCommandObserver)->iPlugins->At(i).iName,((CPluginsListView*)iCommandObserver)->iPlugins->At(i).iDescription);
AddListBoxItemL(iListBox,Buf);
}
}
示例7: DoTestV8DatabaseL
void DoTestV8DatabaseL()
{
CopyOldCdbFileToCDriveL(KDatabaseV8);
CContactDatabase* db=CContactDatabase::OpenL(KDatabaseCDrive);
TDriveUnit driveUnit = _L("c:");
TBuf<190> driveName;
CDesCArray* dataBaseList = db->ListDatabasesL(driveUnit);
CleanupStack::PushL(dataBaseList);
TInt theCount = dataBaseList->Count();
TBool oldFileFormat = EFalse;
for(TInt i = 0; i< theCount; i++)
{
driveName = (*dataBaseList)[i];
test.Printf(_L("ListDatabaseTestL, ListDatabasesL: %s \n"),driveName.PtrZ());
TPtrC filenamePtr(driveName);
TInt found = filenamePtr.FindF(KOldFileFormatPrefix);
if (found != 0 && found != KErrNotFound)
{
oldFileFormat = ETrue;
}
}
test(oldFileFormat);
CleanupStack::PopAndDestroy(dataBaseList);
delete db;
}
示例8: ListDatabasesL
// ---------------------------------------------------------
// CPosLmLocalDatabaseManager::ListDatabasesL
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CPosLmLocalDatabaseManager::ListDatabasesL(
RPointerArray<HPosLmDatabaseInfo>& aDatabaseInfoArray)
{
// list URIs
CDesCArray* dbUriArray = ListDatabasesLC();
// list registered databases
Session().ListDatabasesL(aDatabaseInfoArray, KFileProtocol);
// delete from URI list those databases that are registered
for (TInt i = aDatabaseInfoArray.Count() - 1; i >= 0; i--)
{
TInt index;
if (dbUriArray->Find(aDatabaseInfoArray[i]->DatabaseUri(), index) == 0)
{
dbUriArray->Delete(index);
}
}
// for each remaining URI in the list, fill in database info
// and add to list
TInt count = dbUriArray->Count();
for (TInt i = 0; i < count; i++)
{
HPosLmDatabaseInfo* info = HPosLmDatabaseInfo::NewLC((*dbUriArray)[i]);
aDatabaseInfoArray.AppendL(info);
CleanupStack::Pop(info); // transfer of ownership to array
}
CleanupStack::PopAndDestroy(dbUriArray);
// database drive, database media and default flag
// will be filled in by database management provider.
}
示例9: ListDatabasesLC
// ---------------------------------------------------------
// CPosLmDatabaseManagerImpl::ListDatabasesLC
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
CDesCArray* CPosLmDatabaseManagerImpl::ListDatabasesLC(
const TDesC& aProtocol)
{
CDesCArray* resultList = NULL;
if (aProtocol == KNullDesC)
{
TInt pluginCount = iPlugins->NumberOfInstances();
for (TInt i = 0; i < pluginCount; i++)
{
if (i == 0)
{
resultList = iPlugins->GetInstanceAt(i)->ListDatabasesLC();
}
else
{
CDesCArray* dbList =
iPlugins->GetInstanceAt(i)->ListDatabasesLC();
TInt dbCount = dbList->Count();
for (TInt j = 0; j < dbCount; j++)
{
resultList->AppendL((*dbList)[j]);
}
CleanupStack::PopAndDestroy(dbList);
}
}
}
else
{
CPosLmDatabaseManagerPluginBase* plugin =
iPlugins->GetInstanceL(aProtocol);
resultList = plugin->ListDatabasesLC();
}
return resultList;
}
示例10: LandmarkStoresL
// ---------------------------------------------------------------------------
// CLAPILandmarkStoreManager::LandmarkStoresL
// ---------------------------------------------------------------------------
//
CDesCArray* CLAPILandmarkStoreManager::LandmarkStoresL()
{
JELOG2(EJavaLocation);
// List landmark databases but remove the default store from the array
CDesCArray* stores = iLmDbManager->ListDatabasesLC();
HBufC* defaultDbName = iLmDbManager->DefaultDatabaseUriLC();
// Remove the default database from the store names array. External stores
// are also removed because this API does not support other than stores
// which are located in the file system of the device
TInt count = stores->Count();
for (TInt i = 0; i < count; i++)
{
TPtrC storeUri = stores->MdcaPoint(i);
if (defaultDbName->CompareF(storeUri) == 0 || storeUri.FindF(
KLAPIDefaultProtocol) == KErrNotFound)
{
stores->Delete(i);
break;
}
}
CleanupStack::PopAndDestroy(defaultDbName);
CleanupStack::Pop(stores);
return stores;
}
示例11: DeleteItemL
void CMainMenuGridContainer::DeleteItemL(TInt aIndex)
{
CArrayPtr<CGulIcon>* icons =
iGrid->ItemDrawer()->FormattedCellData()->IconArray();
if (icons && aIndex >= 0 && aIndex < icons->Count()) {
//Delete item if index is valid.
_LIT(KItem, "%d\t\t0");
TBuf<8> buf;
MDesCArray* array = iGrid->Model()->ItemTextArray();
CDesCArray* cArray = (CDesCArray*)array;
//Remove icon and items.
icons->Delete(aIndex);
cArray->Delete(aIndex, (cArray->Count() - aIndex));
iGrid->HandleItemRemovalL();
//Re-add the items behind, needed since we changed the indexes.
for (TInt i = aIndex; i < icons->Count(); i++) {
buf.Format(KItem, i);
cArray->AppendL(buf);
}
//Inform list box that data was added.
iGrid->HandleItemAdditionL();
SetGridGraphicStyleL();
}
}
示例12: CopyL
/**
Copies the specified array contents.
@param aFrom The source array.
@param aTo The target array.
@leave One of the system wide error code, if a processing failure occurs.
*/
void CMTPMetaData::CopyL(const CDesCArray& aFrom, CDesCArray& aTo)
{
const TUint KCount(aFrom.Count());
for (TUint i(0); (i < KCount); i++)
{
aTo.AppendL(aFrom[i]);
}
}
示例13: AppendResultsL
void CMdEQuery::AppendResultsL( const CDesCArray& aNewResults )
{
const TInt count = aNewResults.Count();
for ( TInt i = 0; i < count; ++i )
{
iDistinctResults->AppendL( aNewResults[i] );
}
}
示例14: ExecuteAndDeleteLD
// ---------------------------------------------------------
// CPosTp666::SetupTestEnvironmentL
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CPosTp666::SetupTestEnvironmentL()
{
iLog->Put(_L("SetupTestEnvironmentL"));
// Setup start conditions for compatibility test
_LIT(KDefaultDb, "file://c:eposlm.ldb");
CPosLmDatabaseManager* dbManager = CPosLmDatabaseManager::NewL();
CleanupStack::PushL(dbManager);
// Remove all landmark databases
CDesCArray* uris = dbManager->ListDatabasesL();
CleanupStack::PushL(uris);
for (TInt i = 0; i < uris->Count(); i++)
{
dbManager->DeleteDatabaseL((*uris)[i]);
}
CleanupStack::PopAndDestroy(uris);
// Create and initialize a default database
dbManager->CreateDatabaseL(KDefaultDb);
dbManager->SetDefaultDatabaseL(KDefaultDb);
CPosLandmarkDatabase* database = CPosLandmarkDatabase::OpenL();
CleanupStack::PushL(database);
ExecuteAndDeleteLD(database->InitializeL());
// Add 5 landmarks - will generate ids 1 - 5
const TInt KFive = 5;
for (TInt j = 0; j < KFive; j++)
{
CPosLandmark* lm = CPosLandmark::NewLC();
lm->SetLandmarkNameL(_L("Landmark"));
database->AddLandmarkL(*lm);
CleanupStack::PopAndDestroy(lm);
}
// Add 5 categories
CPosLmCategoryManager* catManager = CPosLmCategoryManager::NewL(*database);
CleanupStack::PushL(catManager);
for (TInt k = 0; k < KFive; k++)
{
CPosLandmarkCategory* category = CPosLandmarkCategory::NewLC();
TBuf<15> name;
name = _L("Category ");
name.AppendNum(k);
category->SetCategoryNameL(name);
catManager->AddCategoryL(*category);
CleanupStack::PopAndDestroy(category);
}
CleanupStack::PopAndDestroy(3, dbManager);
}
示例15: ListDatabaseTestL
void CPlPerformanceAPI::ListDatabaseTestL()
{
TDriveUnit driveUnit = _L("c:");
TBuf<190> driveName;
CDesCArray* dataBaseList = iCntTestImpl.ListDatabasesL(driveUnit);
CleanupStack::PushL(dataBaseList);
TInt theCount = dataBaseList->Count();
for(TInt i = 0; i< theCount; i++)
{
driveName = (*dataBaseList)[i];
test.Printf(_L("ListDatabaseTestL, ListDatabasesL: %s \n"),driveName.PtrZ());
// driveName.Delete(0,driveName.Size());
}
// dataBaseList->Reset();
CleanupStack::PopAndDestroy(dataBaseList);
}