Exemplo n.º 1
0
// ---------------------------------------------------------
// CPosTp52::GetNrOfLandmarksL
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
TInt CPosTp52::GetNrOfLandmarksL()
{
    TInt nrOfLandmarks = 0;
    CPosLmTextCriteria* textCriteria = CPosLmTextCriteria::NewLC();
    // Search pattern "*" should match all existing landmarks
    textCriteria->SetTextL(_L("*"));

    CPosLandmarkSearch* landmarkSearch = CPosLandmarkSearch::NewL(*iDatabase);
    CleanupStack::PushL(landmarkSearch);

    TPosLmSortPref sortAsc(CPosLandmark::ELandmarkName, TPosLmSortPref::EAscending);
    ExecuteAndDeleteLD(landmarkSearch->StartLandmarkSearchL(
                           *textCriteria,
                           sortAsc,
                           EFalse));

    CPosLmItemIterator* iter = landmarkSearch->MatchIteratorL();
    CleanupStack::PushL(iter);

    nrOfLandmarks = iter->NumOfItemsL();
    CleanupStack::PopAndDestroy(iter);
    CleanupStack::PopAndDestroy(landmarkSearch);
    CleanupStack::PopAndDestroy(textCriteria);
    return nrOfLandmarks;
}
Exemplo n.º 2
0
/*
The function checks if the name of an aliment contains the given string. If the name contains it, we go in the list of categories
check if the category of the aliment that contains the string is already in the category list. Yes-We increase the quantity of that
category .No-we add it to the list.
Input:The list of aliments,the list of categories, the given string
Output:The categories list,modified
*/
void checkString(FoodRepoDynamic* v,solRepoDynamic* s,char solution[]){
    int i=0,k=0,ok;
    for (i=0;i<v->length;i++){
        k=0,ok=0;
        if (strstr(v->foodstuff[i].category,solution)>0){
            addSol(s,createCategory(v->foodstuff[i].category,v->foodstuff[i].quantity));
            //printf("%49s",s->solstuff[k].categorySol);
           // printf("%lf",s->solstuff[k].quantitySol);
            k++;
        }
    }
    sortAsc(s);
}