API published in: S60 3rd Ed
Link against: eposlmsearchlib.lib eposlmmultidbsearch.lib
Required Capabilities
None
Exceptions
The capability ReadUserData is required in:
CPosLandmarkSearch::StartLandmarkSearchL( const CPosLmSearchCriteria & aCriteria, TBool aSearchOnlyPreviousMatches = EFalse );
CPosLandmarkSearch::StartLandmarkSearchL( const CPosLmSearchCriteria & aCriteria, const TPosLmSortPref & aSortPref, TBool aSearchOnlyPreviousMatches = EFalse );
CPosLandmarkSearch::StartCategorySearchL( const CPosLmSearchCriteria & aCriteria, CPosLmCategoryManager::TCategorySortPref aSortPref, TBool aSearchOnlyPreviousMatches = EFalse );
CPosLmMultiDbSearch::StartLandmarkSearchL( const CPosLmSearchCriteria & aCriteria, TBool aSearchOnlyPreviousMatches = EFalse );
CPosLmMultiDbSearch::StartLandmarkSearchL( const CPosLmSearchCriteria & aCriteria, const TPosLmSortPref & aSortPref, TBool aSearchOnlyPreviousMatches = EFalse );
CPosLmMultiDbSearch::StartCategorySearchL( const CPosLmSearchCriteria & aCriteria, CPosLmCategoryManager::TCategorySortPref aSortPref, TBool aSearchOnlyPreviousMatches = EFalse );
Other Information
The capability NetworkServices is required to work with remote databases.
#include <epos_cposlandmarksearch.h>
To search a landmark database, an instance of this class is created, supplying the database to search. The client creates a criterion object to specify what to search for. There are different criterion classes which all inherit from CPosLmSearchCriteria. For instance, the client can search for landmarks which contain a certain text string by passing a CPosLmTextCriteria.
Some criterion classes are used for searching for landmarks (e.g. CPosLmCategoryCriteria is used for searching for landmarks which contain a certain category) and some are used to search for landmark categories (e.g. CPosLmCatNameCriteria is used to search for landmark categories by specifying a category name which may contain wild-card characters).
Searches can be run in incremental mode. StartLandmarkSearchL and StartCategorySearchL both return a CPosLmOperation
object which is used to execute the search. If it is run incrementally the client can supervise the progress of the operation.
If it is sufficient to run the search synchronously, the client only has to call CPosLmOperation::ExecuteL
. The client can cancel the search by deleting the CPosLmOperation
object.
By default, these functions start a new search, but the client can specify that only previous matches should be searched. This can be used to refine the search when there are many matches.
During the search execution a read-lock is acquired for each database.
Only one search can be performed at a time by the single instance of the class. If a search is already running, the search
function leaves with error code KErrInUse
.
After search completion, the client can make a second search and specify that only the matches from the previous search shall be considered.
The client can also set a limit on how many search matches should be returned (see SetMaxNumOfMatches).
The client retrieves the matches from the search by requesting an iterator (see MatchIteratorL) or by using display data (see SetDisplayData).
NetworkServices
capability is required for remote databases.
Public Member Functions |
|
virtual IMPORT_C | ~CPosLandmarkSearch () |
Destructor. |
|
IMPORT_C TInt | MaxNumOfMatches () const |
Retrieves the maximum number of search matches limit. |
|
IMPORT_C void | SetMaxNumOfMatches (TInt aMaxNumOfMatches=KPosLmMaxNumOfMatchesUnlimited) |
Sets the maximum number of search matches limit. |
|
virtual CPosLmOperation * | StartLandmarkSearchL (const CPosLmSearchCriteria &aCriteria, TBool aSearchOnlyPreviousMatches=EFalse)=0 |
Starts a search for landmarks. |
|
virtual CPosLmOperation * | StartLandmarkSearchL (const CPosLmSearchCriteria &aCriteria, const TPosLmSortPref &aSortPref, TBool aSearchOnlyPreviousMatches=EFalse)=0 |
Starts a search for landmarks. |
|
virtual CPosLmOperation * | StartCategorySearchL (const CPosLmSearchCriteria &aCriteria, CPosLmCategoryManager::TCategorySortPref aSortPref, TBool aSearchOnlyPreviousMatches=EFalse)=0 |
Starts a search for landmark categories. |
|
virtual TUint | NumOfMatches () const =0 |
Returns the number of matches so far in the search. |
|
virtual CPosLmItemIterator * | MatchIteratorL ()=0 |
Creates an iterator object to iterate the matching landmarks or landmark categories. |
|
virtual void | SetDisplayData (CPosLmDisplayData &aData)=0 |
Display data can be used as an alternative way to get result from a database search. |
|
virtual void | UnsetDisplayData ()=0 |
Unsets display data. |
|
Static Public Member Functions |
|
static IMPORT_C CPosLandmarkSearch * | NewL (CPosLandmarkDatabase &aDatabase) |
Two-phased constructor. |
|
Protected Member Functions |
|
IMPORT_C | CPosLandmarkSearch () |
|
Destructor. |
|
|
Creates an iterator object to iterate the matching landmarks or landmark categories. This function can also be called during a search in order to read the matches encountered so far. Note that the iterator will not iterate any new matches. If new matches are found, a new iterator must be created. If a sort preference was specified when the search was started, the landmarks/categories will be sorted when the search is complete but the items are not necessarily sorted if this function is called during a search. Note: If the client has set display data and resets the display data during a search, the sort order in the iterator might be incorrect. The client takes ownership of the returned iterator object. Note that the iterator iterates matches in CPosLandmarkSearch. It cannot be used after the search object has been deleted. Make sure to delete the iterator first.
|
|
Retrieves the maximum number of search matches limit. By default the maximum number of matches is unlimited.
|
|
Two-phased constructor. The client takes ownership of the returned search object.
|
|
Returns the number of matches so far in the search. This function can also be called during a search operation.
|
|
Display data can be used as an alternative way to get result from a database search. Landmarks or categories are added to the display data collection during a search depending on the search type. This function may replace the combination of using MatchIteratorL and reading landmark or category data. Result data is read already during the search and no duplicate access to database is needed. The display data object will be reset each time a new search is started. No items during the search are removed from the collection. New found matches can be added every time next search step is completed, see CPosLmDisplayData::NewItemIndex. Note: The database index of displayable data items in CPosLmDisplayData will be set to 0 as it has no meaning in a single database search. The client owns the display data object. If the client deletes it during a search, this may lead to unexpected errors. The client must call UnsetDisplayData before it deletes the display data object. Note: If the client resets the display data during a search, the sort order in the iterator might become incorrect.
|
|
Sets the maximum number of search matches limit. If the limit is set, the search operation will stop when this limit is reached. By default the maximum number of matches is unlimited. If a new value for maximum number of matches is set when a search is ongoing, it will not affect the current search. The new maximum will be utilized in the next search.
|
|
Starts a search for landmark categories. The criterion which defines whether a landmark category is a match or not is passed as input to this function. The client takes ownership of the returned operation object.
This function requires
|
|
Starts a search for landmarks. This overload of the StartLandmarkSearchL function lets the client define the sort order for the search matches. Only sorting by landmark name is supported. The client takes ownership of the returned operation object.
This function requires
|
|
Starts a search for landmarks. The client takes ownership of the returned operation object.
This function requires
|
|
Unsets display data. No further data will be added to the display data that was set with SetDisplayData.
|