serviceproviders/sapi_landmarks/landmarksservice/src/clandmarkfilter.cpp
changeset 19 989d2f495d90
child 33 50974a8b132e
equal deleted inserted replaced
14:a36b1e19a461 19:989d2f495d90
       
     1 /*
       
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  CLandmarkFilter class implementation.
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #include <epos_cposlandmarksearch.h>
       
    20 #include <epos_cposlmcatnamecriteria.h>
       
    21 #include <epos_cposlmtextcriteria.h>
       
    22 #include <epos_cposlandmark.h>
       
    23 #include "clandmarkfilter.h"
       
    24 
       
    25 _LIT(KGetAll,"*");
       
    26 // ============================ MEMBER FUNCTIONS ===============================
       
    27 
       
    28 // -----------------------------------------------------------------------------
       
    29 // CLandmarkFilter::NewL()
       
    30 // Two-phased constructor.
       
    31 // -----------------------------------------------------------------------------
       
    32 //
       
    33 EXPORT_C CLandmarkFilter* CLandmarkFilter::NewL( TFilterItem aItem )
       
    34 	{
       
    35 	CLandmarkFilter* self = CLandmarkFilter::NewLC(aItem);
       
    36 	CleanupStack::Pop( self );
       
    37 	return self;
       
    38 	}
       
    39 
       
    40 // -----------------------------------------------------------------------------
       
    41 // CLandmarkFilter::NewLC()
       
    42 // Two-phased constructor.
       
    43 // -----------------------------------------------------------------------------
       
    44 //
       
    45 EXPORT_C CLandmarkFilter* CLandmarkFilter::NewLC( TFilterItem aItem )
       
    46 	{
       
    47 	CLandmarkFilter* self = new (ELeave) CLandmarkFilter();
       
    48 	CleanupStack::PushL( self );
       
    49 	self->ConstructL(aItem);
       
    50 	return self;
       
    51 	}
       
    52 
       
    53 // -----------------------------------------------------------------------------
       
    54 // CLandmarkFilter::ConstructL()
       
    55 // Symbian 2nd phase constructor can leave.
       
    56 // -----------------------------------------------------------------------------
       
    57 //
       
    58 void CLandmarkFilter::ConstructL( TFilterItem aItem )
       
    59 	{
       
    60 	iIsLandmark = aItem;
       
    61 	CPosLmCatNameCriteria* catCriteria = NULL;
       
    62 	CPosLmTextCriteria* lmCriteria = NULL;
       
    63 	switch ( iIsLandmark )
       
    64 		{
       
    65 		case ECategory:
       
    66 			catCriteria = CPosLmCatNameCriteria::NewLC ( );
       
    67 			catCriteria->SetSearchPatternL (KGetAll );
       
    68 			SetCriteria (catCriteria );
       
    69 			CleanupStack::Pop (catCriteria );
       
    70 			break;
       
    71 		case ELandmark:
       
    72 			lmCriteria = CPosLmTextCriteria::NewLC ( );
       
    73 			lmCriteria->SetTextL (KGetAll );
       
    74 			lmCriteria->SetAttributesToSearch (CPosLandmark::ELandmarkName );
       
    75 			SetCriteria (lmCriteria );
       
    76 			CleanupStack::Pop (lmCriteria );
       
    77 			break;
       
    78 		default:
       
    79 			break;
       
    80 		}
       
    81 	}
       
    82 // -----------------------------------------------------------------------------
       
    83 // CLandmarkFilter::CLandmarkFilter()
       
    84 // C++ default constructor can NOT contain any code, that might leave.
       
    85 // -----------------------------------------------------------------------------
       
    86 //
       
    87 CLandmarkFilter::CLandmarkFilter( ) :
       
    88 	iLmSortPref(CPosLandmark::ELandmarkName),
       
    89 			iCatSortPref(CPosLmCategoryManager::ECategorySortOrderNone),
       
    90 			iSearchOnlyPreviousMatches(EFalse),
       
    91 			iMaximumMatches(KPosLmMaxNumOfMatchesUnlimited)
       
    92 
       
    93 	{
       
    94 	}
       
    95 
       
    96 // -----------------------------------------------------------------------------
       
    97 // CLandmarkFilter::~CLandmarkFilter()
       
    98 // Destructor.
       
    99 // -----------------------------------------------------------------------------
       
   100 //
       
   101 CLandmarkFilter::~CLandmarkFilter( )
       
   102 	{
       
   103 	delete iCriteria;
       
   104 	}
       
   105 
       
   106 // -----------------------------------------------------------------------------
       
   107 // CLandmarkFilter::SetCriteria ( CPosLmSearchCriteria* aCriteria )
       
   108 // Sets the criteria on which search should be made.
       
   109 // -----------------------------------------------------------------------------
       
   110 //
       
   111 EXPORT_C void CLandmarkFilter::SetCriteria ( CPosLmSearchCriteria* aCriteria )
       
   112 	{
       
   113 	if( iCriteria )
       
   114 		{
       
   115 		delete iCriteria;
       
   116 		iCriteria = NULL;
       
   117 		}
       
   118 	iCriteria = aCriteria;
       
   119 	}
       
   120 //end of file