QLandmarkManagerEngine Class Reference
The QLandmarkManagerEngine class provides the interface for all implementations of the landmark manager backend functionality. More...
#include <QLandmarkManagerEngine>
Public Functions
| QLandmarkManagerEngine () |
virtual | ~QLandmarkManagerEngine () |
virtual bool | cancelRequest ( QLandmarkAbstractRequest * request ) = 0 |
virtual QList<QLandmarkCategory> | categories ( const QList<QLandmarkCategoryId> & landmarkCategoryIds, QLandmarkManager::Error * error, QString * errorString ) const = 0 |
virtual QList<QLandmarkCategory> | categories ( const QLandmarkNameSort & nameSort, QLandmarkManager::Error * error, QString * errorString ) const = 0 |
virtual QLandmarkCategory | category ( const QLandmarkCategoryId & categoryId, QLandmarkManager::Error * error, QString * errorString ) const = 0 |
virtual QList<QLandmarkCategoryId> | categoryIds ( const QLandmarkNameSort & nameSort, QLandmarkManager::Error * error, QString * errorString ) const = 0 |
virtual bool | exportLandmarks ( QIODevice * device, const QByteArray & format, QList<QLandmarkId> landmarkIds, QLandmarkManager::Error * error, QString * errorString ) const |
virtual QLandmarkManager::FilterSupportLevel | filterSupportLevel ( const QLandmarkFilter & filter ) const = 0 |
virtual bool | importLandmarks ( QIODevice * device, const QByteArray & format, QLandmarkManager::Error * error, QString * errorString ) |
virtual bool | isFeatureSupported ( QLandmarkManager::LandmarkFeature feature ) const = 0 |
virtual bool | isReadOnly () const = 0 |
virtual bool | isReadOnly ( const QLandmarkId & landmarkId ) const = 0 |
virtual bool | isReadOnly ( const QLandmarkCategoryId & categoryId ) const = 0 |
virtual QLandmark | landmark ( const QLandmarkId & landmarkId, QLandmarkManager::Error * error, QString * errorString ) const = 0 |
virtual QList<QLandmarkId> | landmarkIds ( const QLandmarkFilter & filter, const QList<QLandmarkSortOrder> & sortOrders, const QLandmarkFetchHint & fetchHint, QLandmarkManager::Error * error, QString * errorString ) const = 0 |
virtual QList<QLandmark> | landmarks ( const QLandmarkFilter & filter, const QList<QLandmarkSortOrder> & sortOrders, const QLandmarkFetchHint & fetchHint, QLandmarkManager::Error * error, QString * errorString ) const = 0 |
virtual QString | managerName () const = 0 |
virtual QMap<QString, QString> | managerParameters () const = 0 |
QString | managerUri () const |
virtual int | managerVersion () const = 0 |
virtual bool | removeCategory ( const QLandmarkCategoryId & categoryId, QLandmarkManager::Error * error, QString * errorString ) = 0 |
virtual bool | removeLandmark ( const QLandmarkId & landmarkId, QLandmarkManager::Error * error, QString * errorString ) = 0 |
virtual bool | removeLandmarks ( const QList<QLandmarkId> & landmarkIds, QMap<int, QLandmarkManager::Error> * errorMap, QLandmarkManager::Error * error, QString * errorString ) = 0 |
virtual void | requestDestroyed ( QLandmarkAbstractRequest * request ) = 0 |
virtual bool | saveCategory ( QLandmarkCategory * category, QLandmarkManager::Error * error, QString * errorString ) = 0 |
virtual bool | saveLandmark ( QLandmark * landmark, QLandmarkManager::Error * error, QString * errorString ) = 0 |
virtual bool | saveLandmarks ( QList<QLandmark> * landmarks, QMap<int, QLandmarkManager::Error> * errorMap, QLandmarkManager::Error * error, QString * errorString ) = 0 |
virtual bool | startRequest ( QLandmarkAbstractRequest * request ) = 0 |
virtual bool | waitForRequestFinished ( QLandmarkAbstractRequest * request, int msecs ) = 0 |
Signals
Static Protected Members
void | addSorted ( QList<QLandmark> * sorted, const QLandmark & landmark, const QList<QLandmarkSortOrder> & sortOrders ) |
int | compareDistance ( const QLandmark & a, const QLandmark & b, const QLandmarkDistanceSort & distanceSort ) |
int | compareLandmark ( const QLandmark & a, const QLandmark & b, const QList<QLandmarkSortOrder> & sortOrders ) |
int | compareName ( const QLandmark & a, const QLandmark & b, const QLandmarkNameSort & nameSort ) |
QList<QLandmarkId> | sortLandmarks ( const QList<QLandmark> & landmarks, const QList<QLandmarkSortOrder> & sortOrders ) |
bool | testFilter ( const QLandmarkFilter & filter, const QLandmark & landmark ) |
void | updateLandmarkCategoryFetchRequest ( QLandmarkCategoryFetchRequest * req, const QList<QLandmarkCategory> & result, QLandmarkManager::Error error, const QString & errorString, QLandmarkAbstractRequest::State newState ) |
void | updateLandmarkCategoryIdFetchRequest ( QLandmarkCategoryIdFetchRequest * req, const QList<QLandmarkCategoryId> & result, QLandmarkManager::Error error, const QString & errorString, QLandmarkAbstractRequest::State newState ) |
void | updateLandmarkCategoryRemoveRequest ( QLandmarkCategoryRemoveRequest * req, QLandmarkManager::Error error, const QString & errorString, const QMap<int, QLandmarkManager::Error> & errorMap, QLandmarkAbstractRequest::State newState ) |
void | updateLandmarkCategorySaveRequest ( QLandmarkCategorySaveRequest * req, const QList<QLandmarkCategory> & result, QLandmarkManager::Error error, const QString & errorString, const QMap<int, QLandmarkManager::Error> & errorMap, QLandmarkAbstractRequest::State newState ) |
void | updateLandmarkExportRequest ( QLandmarkExportRequest * req, QLandmarkManager::Error error, const QString & errorString, QLandmarkAbstractRequest::State newState ) |
void | updateLandmarkFetchRequest ( QLandmarkFetchRequest * req, const QList<QLandmark> & result, QLandmarkManager::Error error, const QString & errorString, QLandmarkAbstractRequest::State newState ) |
void | updateLandmarkIdFetchRequest ( QLandmarkIdFetchRequest * req, const QList<QLandmarkId> & result, QLandmarkManager::Error error, const QString & errorString, QLandmarkAbstractRequest::State newState ) |
void | updateLandmarkImportRequest ( QLandmarkImportRequest * req, QLandmarkManager::Error error, const QString & errorString, QLandmarkAbstractRequest::State newState ) |
void | updateLandmarkRemoveRequest ( QLandmarkRemoveRequest * req, QLandmarkManager::Error error, const QString & errorString, const QMap<int, QLandmarkManager::Error> & errorMap, QLandmarkAbstractRequest::State newState ) |
void | updateLandmarkSaveRequest ( QLandmarkSaveRequest * req, const QList<QLandmark> & result, QLandmarkManager::Error error, const QString & errorString, const QMap<int, QLandmarkManager::Error> & errorMap, QLandmarkAbstractRequest::State newState ) |
void | updateRequestState ( QLandmarkAbstractRequest * req, QLandmarkAbstractRequest::State state ) |
Detailed Description
The QLandmarkManagerEngine class provides the interface for all implementations of the landmark manager backend functionality.
Instances of this class are usually provided by QLandmarkManagerEngineFactory, which is loaded from a plugin.
Member Function Documentation
QLandmarkManagerEngine::QLandmarkManagerEngine ()
Constructs a landmark manager engine.
QLandmarkManagerEngine::~QLandmarkManagerEngine () [virtual]
Destructor.
void QLandmarkManagerEngine::addSorted ( QList<QLandmark> * sorted, const QLandmark & landmark, const QList<QLandmarkSortOrder> & sortOrders ) [static protected]
Performs insertion sort landmark into the sorted list, according to the provided sortOrders list. The first QLandmarkSortOrder in the list has the highest priority; if the landmark is deemed equal to another in the sorted list, the second QLandmarkSortOrder in the list is used (and so on until either the landmark is inserted or there are no more sort order objects in the list).
bool QLandmarkManagerEngine::cancelRequest ( QLandmarkAbstractRequest * request ) [pure virtual]
Asks the manager engine to cancel the given request which was previously started and is currently in a cancellable state. Returns true if cancellation of the request was started successfully, otherwise returns false.
See also startRequest() and QLandmarkAbstractRequest::cancel().
QList<QLandmarkCategory> QLandmarkManagerEngine::categories ( const QList<QLandmarkCategoryId> & landmarkCategoryIds, QLandmarkManager::Error * error, QString * errorString ) const [pure virtual]
Returns a list of categories identified by landmarkCategoryIds.
Overall operation errors are stored in error and errorString.
QList<QLandmarkCategory> QLandmarkManagerEngine::categories ( const QLandmarkNameSort & nameSort, QLandmarkManager::Error * error, QString * errorString ) const [pure virtual]
Returns a list of all categories sorted according to the gien nameSort.
void QLandmarkManagerEngine::categoriesAdded ( const QList<QLandmarkCategoryId> & categoryIds ) [signal]
This signal is emitted some time after a set of categories has been added As it is possible that other processes(or other devices) may have added the landmarks, the exact timing cannot be determined.
There may be one or more category identifiers in the categoryIds list.
See also categoriesChanged() and categoriesRemoved().
void QLandmarkManagerEngine::categoriesChanged ( const QList<QLandmarkCategoryId> & categoryIds ) [signal]
This signal is emitted some time after a set of categories have been modified As it is possible that other processes(or other devices) may have modified the categories, the timing cannot be determined.
There may be one ore more category identifiers in the categoryIds list.
See also categoriesAdded() and categoriesRemoved().
void QLandmarkManagerEngine::categoriesRemoved ( const QList<QLandmarkCategoryId> & categoryIds ) [signal]
This signal is emitted some time after a set of categories have been removed As it is possible that other processes(or other devices) may have removed the categories, the timing cannot be determined.
There may be one ore more category identifiers in the categoryIds list.
See also categoriesAdded() and categoriesChanged().
Returns the cateory in the datastore identified by categoryId.
Any errors encountered are stored in error and errorString.
Returns a list of all category identifiers which are sorted according to nameSort. Any error which occurs will be saved in error and errorString.
int QLandmarkManagerEngine::compareDistance ( const QLandmark & a, const QLandmark & b, const QLandmarkDistanceSort & distanceSort ) [static protected]
Compares two landmarks (a and b) by distance from a point given by distanceSort. Returns a negative number if a should appear before b according to the sort order, a positive number if a should appear after b according to the sort order, and zero if the two are unable to be sorted.
Assuming an ascending order sort, a negative number is returned if a is closer and a positive number if b is considered closer. 0 is returned if both are the same distance away.
A invalid coordinate is considered to be an infinite distance away.
int QLandmarkManagerEngine::compareLandmark ( const QLandmark & a, const QLandmark & b, const QList<QLandmarkSortOrder> & sortOrders ) [static protected]
Compares two landmarks (a and b) using the given list of sortOrders. Returns a negative number if a should appear before b according to the sort order, a positive number if a should appear after b according to the sort order, and zero if the two are unable to be sorted.
int QLandmarkManagerEngine::compareName ( const QLandmark & a, const QLandmark & b, const QLandmarkNameSort & nameSort ) [static protected]
Compares two landmarks (a and b) by name.
Returns a negative number if a should appear before b according to the nameSort, a positive number if a should appear after b according to the nameSort, and zero if the two are unable to be sorted.
Assuming an ascending order sort, an integer less than, equal to, or greater than zero is returned if a is less than, equal to or greater than b.
nameSort specifies whether an ascending or descending order is used and whether the sort is case sensitive or not.
bool QLandmarkManagerEngine::exportLandmarks ( QIODevice * device, const QByteArray & format, QList<QLandmarkId> landmarkIds, QLandmarkManager::Error * error, QString * errorString ) const [virtual]
Writes landmarks to the given device. The landmarks will be written according to the specified format. If landmarkIds is empty, then all landmarks will be exported, otherwise only those landmarks that match landmarkIds will be exported.
Returns true if all specified landmarks were successfully exported, otherwise returns false. It may be possible that only a subset of landmarks are exported.
Overall operation errors are stored in error and errorString.
Returns the support level the manager engine provides for the given filter.
bool QLandmarkManagerEngine::importLandmarks ( QIODevice * device, const QByteArray & format, QLandmarkManager::Error * error, QString * errorString ) [virtual]
Reads landmarks from the given device and saves them. The data from the device is expected to adhere to the provided format. If no format is provided, the manager engine tries to autodetect the format.
Returns true if all landmarks could be imported, otherwise returns false. It may be possible that only a subset of landmarks are imported.
Overall operational errors are stored in error and errorString.
bool QLandmarkManagerEngine::isFeatureSupported ( QLandmarkManager::LandmarkFeature feature ) const [pure virtual]
Returns true if the manager engine supports the given feature, otherwise returns false;
bool QLandmarkManagerEngine::isReadOnly () const [pure virtual]
Returns true if the manager engine is exclusively read only. Meaning landmarks and categories cannot be added, modified or removed
bool QLandmarkManagerEngine::isReadOnly ( const QLandmarkId & landmarkId ) const [pure virtual]
Returns true if the landmark identified by landmarkId considered read-only by the manager engine.
If the landmarkId does not refer to an existing landmark, it is considered writable unless the manager engine. is exclusively read-only.
bool QLandmarkManagerEngine::isReadOnly ( const QLandmarkCategoryId & categoryId ) const [pure virtual]
Returns true if the category identified by categoryId is considered read-only by the manager engine.
If categoryId does not refer to an existing category, it is considered writable unless the manager engine is exclusively read-only.
QLandmark QLandmarkManagerEngine::landmark ( const QLandmarkId & landmarkId, QLandmarkManager::Error * error, QString * errorString ) const [pure virtual]
Returns the landmark in the datastore identified by landmarkId.
Any errors encountered are:stored in error and errorString.
Returns a list of landmark ids of landmarks that match the given filter, sorted according to the given sortOrders. Depending on the backend, this filtering operation may involve retrieving all the landmarks. Various fetch operation parameters may be specified by fetchHint.
Any error which occurs will be saved in error and errorString.
Returns a list of landmarks which match the given filter and are sorted according to the sortOrders. Various fetch operation parameters are specified by fetchHint.
Overall operation errors are stored in error and errorString.
void QLandmarkManagerEngine::landmarksAdded ( const QList<QLandmarkId> & landmarkIds ) [signal]
This signal is emitted some time after a set of landmarks has been added. As it is possible that other processes(or other devices) may have added the landmarks, the exact timing cannot be determined.
There may be one or more landmark identifiers in the landmarkIds list.
See also landmarksChanged() and landmarksRemoved().
void QLandmarkManagerEngine::landmarksChanged ( const QList<QLandmarkId> & landmarkIds ) [signal]
This signal is emitted some time after a set of landmarks have been modified. As it is possible that other processes(or other devices) may have modified the landmarks, the timing cannot be determined.
There may be one ore more landmark identifiers in the landmarkIds list.
See also landmarksAdded() and landmarksRemoved().
void QLandmarkManagerEngine::landmarksRemoved ( const QList<QLandmarkId> & landmarkIds ) [signal]
This signal is emitted some time after a set of landmarks have been removed. As it is possible that other processes(or other devices) may have removed the landmarks, the timing cannot be determined.
There may be one ore more landmark identifiers in the landmarkIds list.
See also landmarksAdded() and landmarksChanged().
QString QLandmarkManagerEngine::managerName () const [pure virtual]
Returns the manager name for this QLandmarkManagerEngine
QMap<QString, QString> QLandmarkManagerEngine::managerParameters () const [pure virtual]
Returns the parameters with which this engine was constructed. Note that the engine may have discarded unused or invalid parameters at the time of construction, and these will not be returned.
QString QLandmarkManagerEngine::managerUri () const
Returns the unique URI of this manager, which is built from the manager name and the parameters used to construct it.
int QLandmarkManagerEngine::managerVersion () const [pure virtual]
Returns the engine backend implementation version number
bool QLandmarkManagerEngine::removeCategory ( const QLandmarkCategoryId & categoryId, QLandmarkManager::Error * error, QString * errorString ) [pure virtual]
Removes the category identified by categoryId from the datastore. The categoryId is cleared(and becomes invalid) on successful removal. An unsuccessful removal should leave the identifer alone.
Returns true if the category was removed successfully, otherwise returnse false.
The engine emits the appropriate signals to inform clients of changes to the datastore resulting from this operation
Overall operational errors are stored in error and errorString.
bool QLandmarkManagerEngine::removeLandmark ( const QLandmarkId & landmarkId, QLandmarkManager::Error * error, QString * errorString ) [pure virtual]
Remove the landmark identified by landmarkId from the datastore.
Returns true if the landmark was removed successfully, otherwise returnse false.
The engine emits the appropriate signals to inform clients of changes to the datastore resulting from this operation.
Any errors encountered during this operation should be stored to error and errorString.
bool QLandmarkManagerEngine::removeLandmarks ( const QList<QLandmarkId> & landmarkIds, QMap<int, QLandmarkManager::Error> * errorMap, QLandmarkManager::Error * error, QString * errorString ) [pure virtual]
Removes every landmark whose identifier is contained in the list of landmarkIds. Returns true if all landmarks were removed successfully, otherwise false.
The engine populates errorMap (the map of indices of the landmarkIds list to the error which occurred when saving the landmark at that index) for every index for which the landmark could not be removed.
The engine also emits the appropriate signals to inform clients of changes to the datastore resulting from this operation.
Overall operation errors are stored in error and errorString. error is set to QLandmarkManager::NoError, if all landmarks were successfully removed.
See also QLandmarkManagerEngine::removeLandmark().
void QLandmarkManagerEngine::requestDestroyed ( QLandmarkAbstractRequest * request ) [pure virtual]
Notifies the manager engine that the givan request has been destroyed.
bool QLandmarkManagerEngine::saveCategory ( QLandmarkCategory * category, QLandmarkManager::Error * error, QString * errorString ) [pure virtual]
Adds the given category to the datastore if category has a default-constructed identifier, or an identifier with the manager URI set to the URI of this manager and an empty id.
If the manager URI of the identifier of the category is neither empty nor equal to the URI of this manager, or the id member of the identifier is not empty, but does not exist in the manager, the operation should fail and error should be set to QLandmarkManager::DoesNotExistError.
Alternatively, the function should update the existing category in the datastore if category has a non-empty id and currently exists within the datastore.
Returns false on failure or true on success. On successful save of a category with an invalid id, it should be assigned a valid id and have its manager URI set to the URI of this manager.
The engine returns the appropriate signals to inform clients of changes to the datastore resulting from this operation.
Overall operations errors should be stored in error and errorString.
bool QLandmarkManagerEngine::saveLandmark ( QLandmark * landmark, QLandmarkManager::Error * error, QString * errorString ) [pure virtual]
Adds the given landmark to the datastore if landmark has a default-constructed identifer, or an identifier with the manager URI set to the URI of this manager and an empty id.
If the manager URI of the identifier of the landmark is neither empty nor equal to the URI of this manager, or the id member of the identifier is not empty, but does not exist in the manager, the operation will fail and and error will be set to QLandmarkManager::DoesNotExistError.
Alternatively, the function will update the existing landmark in the datastore if landmark has a non-empty id and currently exists within the datastore.
Returns false on failure or true on success. On successful save of a landmark with an empty id, it will be assigned a valid id and have its manager URI set to the URI of this manager.
This function is called by the landmarks framework in both the single landmark save and batch batch save, if the saveLandmarks function is not overridden.
The engine must emit the appropriate signals to inform clients of changes to the datastore resulting from this operation.
Any errors encountered during this operation should be stored in error and errorString.
bool QLandmarkManagerEngine::saveLandmarks ( QList<QLandmark> * landmarks, QMap<int, QLandmarkManager::Error> * errorMap, QLandmarkManager::Error * error, QString * errorString ) [pure virtual]
Adds the list of landmarks to the datastore. Returns true if the landmarks were saved successfully, otherwise returns false.
The engine will populate errorMap (the map of indices of the landmarks list to the error which occurred when saving the landmark at that index) for every index for which the landmark could not be saved.
The function will only set error to QLandmarkManager::NoError if all landmarks were saved successfully.
For each newly saved landmark that was successful, the identifier of the landmark will be updated with a new value. If a failure occurs when saving a new landmark, the identifier will be cleared (and become an invalid identifier).
The engine emits the appropriate signals to inform clients of changes to the datastore resulting from this operation.
Overall operation errors are stored in error and errorString. error is set to QLandmarkManager::NoError, if all landmarks were successfully saved.
See also QLandmarkManagerEngine::saveLandmark().
QList<QLandmarkId> QLandmarkManagerEngine::sortLandmarks ( const QList<QLandmark> & landmarks, const QList<QLandmarkSortOrder> & sortOrders ) [static protected]
Sorts the given list of landmarks according to the provided sortOrders
bool QLandmarkManagerEngine::startRequest ( QLandmarkAbstractRequest * request ) [pure virtual]
Asks the manager engine to begin the given request which is currently in a re(startable) state.
Returns true if the request was started successfully, else returns false.
See also QLandmarkAbstractRequest::start().
bool QLandmarkManagerEngine::testFilter ( const QLandmarkFilter & filter, const QLandmark & landmark ) [static protected]
Returns true if the supplied landmark matches the supplied filter.
Updates the given QLandmarkCategoryFetchRequest req with the latest result, and operation error and errorString. In addition, the state of the request will be changed to newState.
It then causes the request to emit its resultsAvailable() signal to notify clients of the request progress.
If the new request state is different from the previous state, the stateChanged() signal will also be emitted from the request.
Updates the given QLandmarkCategoryIdFetchRequest req with the latest result, and operation error and errorString. In addition, the state of the request will be changed to newState.
It then causes the request to emit its resultsAvailable() signal to notify clients of the request progress.
If the new request state is different from the previous state, the stateChanged() signal will also be emitted from the request.
Updates the given QLandmarkCategoryRemoveRequest req with the operation error and errorString and map of input index to individual errors, errorMap. In addition, the state of the request will be changed to newState.
It then causes the request to emit its resultsAvailable() signal to notify clients of the request progress.
If the new request state is different from the previous state, the stateChanged() signal will also be emitted from the request.
Updates the given QLandmarkSaveCategoryRequest req with the latest result, operation error error and errorString, and map of input index to individual errors, errorMap. In addition, the state of the request will be changed to newState.
It then causes the request to emit its resultsAvailable() signal to notify clients of the request progress.
If the new request state is different from the previous state, the stateChanged() signal will also be emitted from the request.
Updates the given QLandmarkExportRequest req with the operation error and errorString. In addition the state of the request is changed to newState.
It then causes the request to emit its resultsAvailable() signal to notify the clients of the request progress.
If the new request state is different from the previous state, the stateChanged() signal will also be emitted from the request.
Updates the given QLandmarkFetchRequest req with the latest result, and operation error and errorString. In addition, the state of the request will be changed to newState.
It then causes the request to emit its resultsAvailable() signal to notify clients of the request progress.
If the new request state is different from the previous state, the stateChanged() signal will also be emitted from the request.
Updates the given QLandmarkIdFetchRequest req with the latest result, and operation error and errorString. In addition, the state of the request will be changed to newState.
It then causes the request to emit its resultsAvailable() signal to notify clients of the request progress.
If the new request state is different from the previous state, the stateChanged() signal will also be emitted from the request.
Updates the given QLandmarkImportRequest req with the operation error and errorString. In addition the state of the request is changed to newState.
It then causes the request to emit its resultsAvailable() signal to notify the clients of the request progress.
If the new request state is different from the previous state, the stateChanged() signal will also be emitted from the request.
Updates the given QLandmarkRemoveRequest req with the operation error and errorString and map of input index to individual errors, errorMap. In addition, the state of the request will be changed to newState.
It then causes the request to emit its resultsAvailable() signal to notify clients of the request progress.
If the new request state is different from the previous state, the stateChanged() signal will also be emitted from the request.
Updates the given QLandmarkSaveRequest req with the latest result, operation error and errorString, and map of input index to individual errors, errorMap. In addition, the state of the request will be changed to newState.
It then causes the request to emit its resultsAvailable() signal to notify clients of the request progress.
If the new request state is different from the previous state, the stateChanged() signal will also be emitted from the request.
Updates the given asynchronous request req by setting the new state of the request. It then causes the stateChanged() signal to be emitted by the request.
bool QLandmarkManagerEngine::waitForRequestFinished ( QLandmarkAbstractRequest * request, int msecs ) [pure virtual]
Blocks until the manager engine has completed the given request which was previously started, or until msecs milliseconds have passed. Returns true if the request was completed, and false if the request was not in the QLandmarkAbstractRequest::Active state or no progress could be reported.
See also startRequest().