1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/mw/EPos_CPosLmDisplayItem.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -0,0 +1,208 @@
1.4 +/*
1.5 +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description: CPosLmDisplayItem class
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +#ifndef CPOSLMDISPLAYITEM_H
1.23 +#define CPOSLMDISPLAYITEM_H
1.24 +
1.25 +#include <e32base.h>
1.26 +
1.27 +class CPosLandmark;
1.28 +class CPosLandmarkCategory;
1.29 +
1.30 +
1.31 +/**
1.32 +* Displayable item.
1.33 +*
1.34 +* A displayable item consists of a landmark or category and its database
1.35 +* index. Database index is 0 if running single database search, and it is
1.36 +* in the range [0, @ref CPosLmMultiDbSearch::NumOfDatabasesInSearch - 1] in
1.37 +* case of multiple database search. Thus, this class is a link between a
1.38 +* landmark or a category and its database.
1.39 +*
1.40 +* The class is usually not instantiated by client applications.
1.41 +*
1.42 +* @lib eposlmsearchlib.lib
1.43 +* @since S60 3.0
1.44 +*/
1.45 +class CPosLmDisplayItem : public CBase
1.46 + {
1.47 +
1.48 + public:
1.49 +
1.50 + /**
1.51 + * Display item type.
1.52 + */
1.53 + enum TDisplayItemType
1.54 + {
1.55 + ELandmarkItem = 0 /**< Landmark display item. This indicates
1.56 + * that the item contains a landmark and the
1.57 + * @ref Landmark function can be called to
1.58 + * access it.
1.59 + */,
1.60 + ECategoryItem /**< Category display item. This indicates
1.61 + * that the item contains a category and the
1.62 + * @ref Category function can be called to
1.63 + * access it.
1.64 + */
1.65 + };
1.66 +
1.67 + public:
1.68 +
1.69 + /**
1.70 + * Two-phased constructor.
1.71 + *
1.72 + * @param[in] aLandmark A landmark.
1.73 + * @param[in] aDatabaseIndex A database index.
1.74 + *
1.75 + * @returns A new instance of this class.
1.76 + */
1.77 + IMPORT_C static CPosLmDisplayItem* NewL(
1.78 + CPosLandmark* aLandmark,
1.79 + TUint aDatabaseIndex = 0
1.80 + );
1.81 +
1.82 + /**
1.83 + * Two-phased constructor.
1.84 + *
1.85 + * @param[in] aCategory A category.
1.86 + * @param[in] aDatabaseIndex A database index.
1.87 + *
1.88 + * @returns A new instance of this class.
1.89 + */
1.90 + IMPORT_C static CPosLmDisplayItem* NewL(
1.91 + CPosLandmarkCategory* aCategory,
1.92 + TUint aDatabaseIndex = 0
1.93 + );
1.94 +
1.95 + /**
1.96 + * Destructor.
1.97 + */
1.98 + virtual ~CPosLmDisplayItem();
1.99 +
1.100 + public:
1.101 +
1.102 + /**
1.103 + * Returns the type of the display item.
1.104 + *
1.105 + * @return The display item type.
1.106 + */
1.107 + IMPORT_C TDisplayItemType DisplayItemType() const;
1.108 +
1.109 + /**
1.110 + * Returns the index of the database, which contained item belongs to.
1.111 + *
1.112 + * The database index is associated with a database URI from the list
1.113 + * of databases specified in @ref CPosLmMultiDbSearch.
1.114 + *
1.115 + * If display data is used in @ref CPosLandmarkSearch, this
1.116 + * function always returns 0.
1.117 + *
1.118 + * @return The database index of this displayable item.
1.119 + */
1.120 + IMPORT_C TUint DatabaseIndex() const;
1.121 +
1.122 + /**
1.123 + * Returns the category contained in the displayable item.
1.124 + *
1.125 + * @return The category.
1.126 + *
1.127 + * @panic "Landmarks Client"-EPosInvalidItemType
1.128 + * The item type is not a category displayable item. See @ref DisplayItemType.
1.129 + */
1.130 + IMPORT_C const CPosLandmarkCategory& Category() const;
1.131 +
1.132 + /**
1.133 + * Returns the landmark contained in the displayable item.
1.134 + *
1.135 + * @return The landmark.
1.136 + *
1.137 + * @panic "Landmarks Client"-EPosInvalidItemType
1.138 + * The item type is not a landmark displayable item. See @ref DisplayItemType.
1.139 + */
1.140 + IMPORT_C const CPosLandmark& Landmark() const;
1.141 +
1.142 + /**
1.143 + * Returns the distance to a position specified in the
1.144 + * @ref CPosLmNearestCriteria. The distance data is only used when
1.145 + * searching with this criteria.
1.146 + *
1.147 + * @param[out] aDistance Distance to the position specified in a
1.148 + * @ref CPosLmNearestCriteria.
1.149 + * @return KErrNone if distance is available. KErrNotFound otherwise.
1.150 + */
1.151 + IMPORT_C TInt GetDistance( TReal32& aDistance ) const;
1.152 +
1.153 + /** @internal */
1.154 + /*
1.155 + * Sets the database index of this displayable item.
1.156 + *
1.157 + * @param aDatabaseIndex The database index.
1.158 + */
1.159 + void SetDatabaseIndex( TUint aDatabaseIndex );
1.160 +
1.161 + /** @internal */
1.162 + /*
1.163 + * Sets the distance to the position specified in the nearest criterion.
1.164 + *
1.165 + * @param aDistance Distance to the position.
1.166 + */
1.167 + void SetDistance( TReal32 aDistance );
1.168 +
1.169 + private:
1.170 +
1.171 + /**
1.172 + * C++ constructor.
1.173 + *
1.174 + * @param[in] aLandmark A landmark.
1.175 + * @param[in] aDatabaseIndex Database index.
1.176 + */
1.177 + CPosLmDisplayItem(
1.178 + CPosLandmark* aLandmark,
1.179 + TUint aDatabaseIndex
1.180 + );
1.181 +
1.182 + /**
1.183 + * C++ constructor.
1.184 + *
1.185 + * @param[in] aCategory A category.
1.186 + * @param[in] aDatabaseIndex Database index.
1.187 + */
1.188 + CPosLmDisplayItem(
1.189 + CPosLandmarkCategory* aCategory,
1.190 + TUint aDatabaseIndex
1.191 + );
1.192 +
1.193 + private:
1.194 +
1.195 + TDisplayItemType iDisplayItemType;
1.196 +
1.197 + CPosLandmark* iLandmark;
1.198 +
1.199 + CPosLandmarkCategory* iCategory;
1.200 +
1.201 + TUint iDatabaseIndex;
1.202 +
1.203 + TReal32 iDistance;
1.204 +
1.205 + TBool iHasDistance;
1.206 +
1.207 + };
1.208 +
1.209 +#endif // CPOSLMDISPLAYITEM_H
1.210 +
1.211 +