epoc32/include/mw/EPos_CPosLmDisplayItem.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 /*
     2 * Copyright (c) 2005-2006 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 "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:  CPosLmDisplayItem class
    15 *
    16 */
    17 
    18 
    19 #ifndef CPOSLMDISPLAYITEM_H
    20 #define CPOSLMDISPLAYITEM_H
    21 
    22 #include <e32base.h>
    23 
    24 class CPosLandmark;
    25 class CPosLandmarkCategory;
    26 
    27 
    28 /**
    29 * Displayable item.
    30 *
    31 * A displayable item consists of a landmark or category and its database
    32 * index. Database index is 0 if running single database search, and it is
    33 * in the range [0, @ref CPosLmMultiDbSearch::NumOfDatabasesInSearch - 1] in
    34 * case of multiple database search. Thus, this class is a link between a
    35 * landmark or a category and its database.
    36 *
    37 * The class is usually not instantiated by client applications.
    38 *
    39 *  @lib eposlmsearchlib.lib
    40 *  @since S60 3.0
    41 */
    42 class CPosLmDisplayItem : public CBase
    43     {
    44 
    45     public:
    46 
    47     /**
    48     * Display item type.
    49     */
    50     enum TDisplayItemType
    51         {
    52         ELandmarkItem = 0       /**< Landmark display item. This indicates
    53                                 * that the item contains a landmark and the
    54                                 * @ref Landmark function can be called to
    55                                 * access it.
    56                                 */,
    57         ECategoryItem           /**< Category display item. This indicates
    58                                 * that the item contains a category and the
    59                                 * @ref Category function can be called to
    60                                 * access it.
    61                                 */
    62         };
    63 
    64     public:
    65 
    66         /**
    67         * Two-phased constructor.
    68         *
    69         * @param[in] aLandmark A landmark.
    70         * @param[in] aDatabaseIndex A database index.
    71         *
    72         * @returns A new instance of this class.
    73         */
    74         IMPORT_C static CPosLmDisplayItem* NewL(
    75             CPosLandmark* aLandmark,
    76             TUint aDatabaseIndex = 0
    77         );
    78 
    79         /**
    80         * Two-phased constructor.
    81         *
    82         * @param[in] aCategory A category.
    83         * @param[in] aDatabaseIndex A database index.
    84         *
    85         * @returns A new instance of this class.
    86         */
    87         IMPORT_C static CPosLmDisplayItem* NewL(
    88             CPosLandmarkCategory* aCategory,
    89             TUint aDatabaseIndex = 0
    90         );
    91 
    92         /**
    93         * Destructor.
    94         */
    95         virtual ~CPosLmDisplayItem();
    96 
    97     public:
    98 
    99         /**
   100         * Returns the type of the display item.
   101         *
   102         * @return The display item type.
   103         */
   104         IMPORT_C TDisplayItemType DisplayItemType() const;
   105 
   106         /**
   107         * Returns the index of the database, which contained item belongs to.
   108         *
   109         * The database index is associated with a database URI from the list
   110         * of databases specified in @ref CPosLmMultiDbSearch.
   111         *
   112         * If display data is used in @ref CPosLandmarkSearch, this
   113         * function always returns 0.
   114         *
   115         * @return The database index of this displayable item.
   116         */
   117         IMPORT_C TUint DatabaseIndex() const;
   118 
   119         /**
   120         * Returns the category contained in the displayable item.
   121         *
   122         * @return The category.
   123         *
   124         * @panic "Landmarks Client"-EPosInvalidItemType
   125         *   The item type is not a category displayable item. See @ref DisplayItemType.
   126         */
   127         IMPORT_C const CPosLandmarkCategory& Category() const;
   128 
   129         /**
   130         * Returns the landmark contained in the displayable item.
   131         *
   132         * @return The landmark.
   133         *
   134         * @panic "Landmarks Client"-EPosInvalidItemType
   135         *   The item type is not a landmark displayable item. See @ref DisplayItemType.
   136         */
   137         IMPORT_C const CPosLandmark& Landmark() const;
   138 
   139         /**
   140         * Returns the distance to a position specified in the
   141         * @ref CPosLmNearestCriteria. The distance data is only used when
   142         * searching with this criteria.
   143         *
   144         * @param[out] aDistance Distance to the position specified in a
   145         *   @ref CPosLmNearestCriteria.
   146         * @return KErrNone if distance is available. KErrNotFound otherwise.
   147         */
   148         IMPORT_C TInt GetDistance( TReal32& aDistance ) const;
   149 
   150         /** @internal */
   151         /* 
   152         * Sets the database index of this displayable item.
   153         *
   154         * @param aDatabaseIndex The database index.
   155         */
   156         void SetDatabaseIndex( TUint aDatabaseIndex );
   157 
   158         /** @internal */
   159         /*
   160         * Sets the distance to the position specified in the nearest criterion.
   161         *
   162         * @param aDistance Distance to the position.
   163         */
   164         void SetDistance( TReal32 aDistance );
   165 
   166     private:
   167 
   168         /**
   169         * C++ constructor.
   170         *
   171         * @param[in] aLandmark A landmark.
   172         * @param[in] aDatabaseIndex Database index.
   173         */
   174         CPosLmDisplayItem(
   175             CPosLandmark* aLandmark,
   176             TUint aDatabaseIndex
   177         );
   178 
   179         /**
   180         * C++ constructor.
   181         *
   182         * @param[in] aCategory A category.
   183         * @param[in] aDatabaseIndex Database index.
   184         */
   185         CPosLmDisplayItem(
   186             CPosLandmarkCategory* aCategory,
   187             TUint aDatabaseIndex
   188         );
   189 
   190     private:
   191 
   192         TDisplayItemType iDisplayItemType;
   193 
   194         CPosLandmark* iLandmark;
   195 
   196         CPosLandmarkCategory* iCategory;
   197 
   198         TUint iDatabaseIndex;
   199 
   200         TReal32 iDistance;
   201 
   202         TBool iHasDistance;
   203 
   204     };
   205 
   206 #endif      // CPOSLMDISPLAYITEM_H
   207 
   208