epoc32/include/mw/EPos_CPosLandmarkCategory.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:  CPosLandmarkCategory class
    15 *
    16 */
    17 
    18 
    19 #ifndef CPOSLANDMARKCATEGORY_H
    20 #define CPOSLANDMARKCATEGORY_H
    21 
    22 #include <e32base.h>
    23 #include "EPos_Landmarks.h"
    24 
    25 
    26 /**
    27 *  Landmark category.
    28 *
    29 *  A landmark database can contain a number of categories which can be
    30 *  assigned to the landmarks in the database. A landmark can be associated
    31 *  with multiple categories, e.g. a landmark can be a "Restaurant" and a "Pub".
    32 *  Categories also enable filtered searches, e.g. a client could search for
    33 *  nearby restaurants.
    34 *
    35 *  This class specifies the landmark category attributes, i.e. name, icon and
    36 *  a global category identifier. Global categories enable a uniform
    37 *  categorization across multiple databases.
    38 *
    39 *  A landmark category is created, updated or deleted by using functions in
    40 *  @ref CPosLmCategoryManager.
    41 *
    42 *  @lib eposlandmarks.lib
    43 *  @since S60 3.0
    44 */
    45 class CPosLandmarkCategory : public CBase
    46     {
    47     public:
    48 
    49         /**
    50         *  Bitmap for specifying a group of category attributes. Bit values are
    51         *  defined by @ref _TAttributes.
    52         */
    53         typedef TUint32 TAttributes;
    54 
    55         /**
    56         *  Specifies a category attribute, such as category name or category icon.
    57         */
    58         enum _TAttributes
    59             {
    60             ENoAttribute        = 0x0000  /**<
    61                 No attribute specified. */,
    62             ECategoryName       = 0x0001  /**<
    63                 The name of the landmark category. */,
    64             EIcon               = 0x0010  /**<
    65                 The icon that represents the category in a UI. */,
    66             EAllAttributes      = 0xFFFF  /**<
    67                 All category attributes. */
    68             };
    69 
    70     public:
    71 
    72         /**
    73         * Two-phased constructor.
    74         * @returns A new instance of this class.
    75         */
    76         IMPORT_C static CPosLandmarkCategory* NewLC();
    77 
    78         /**
    79         * Two-phased constructor.
    80         * @returns A new instance of this class.
    81         */
    82         IMPORT_C static CPosLandmarkCategory* NewL();
    83 
    84         /**
    85         * Two-phased copy constructor.
    86         *
    87         * @param[in] aCategory The category to copy.
    88         * @returns A copy of the specified category object.
    89         */
    90         IMPORT_C static CPosLandmarkCategory* NewLC(
    91                const CPosLandmarkCategory&  aCategory
    92         );
    93 
    94         /**
    95         * Two-phased copy constructor.
    96         *
    97         * @param[in] aCategory The category to copy.
    98         * @returns A copy of the specified category object.
    99         */
   100         IMPORT_C static CPosLandmarkCategory* NewL(
   101                const CPosLandmarkCategory&  aCategory
   102         );
   103 
   104         /**
   105         * Destructor.
   106         */
   107         virtual ~CPosLandmarkCategory();
   108 
   109     public:
   110 
   111         /**
   112         * Reads the ID of the category entry in the database.
   113         *
   114         * @returns The ID of the category entry in the database, or
   115         *   @p KPosLmNullItemId if the category has not been added to the
   116         *   database yet.
   117         */
   118         IMPORT_C TPosLmItemId CategoryId() const;
   119 
   120         /**
   121         * Retrieves global category ID.
   122         *
   123         * Global categories enable a uniform categorization across multiple
   124         * databases.
   125         *
   126         * @returns The global category ID or @p KPosLmNullGlobalCategory if the
   127         *   category is not global.
   128         */
   129         IMPORT_C TPosLmGlobalCategory GlobalCategory() const;
   130 
   131         /**
   132         * @internal */
   133         /*
   134         * Sets the category to be global (i.e. not only defined in one
   135         * database).
   136         *
   137         * Global categories enable a uniform categorization across multiple
   138         * databases.
   139         *
   140         * @param[in] aGlobalCategory The global category ID or
   141         *   @p KPosLmNullGlobalCategory if the category should not be global.
   142         */
   143         void SetGlobalCategory(
   144                TPosLmGlobalCategory  aGlobalCategory
   145         );
   146 
   147         /**
   148         * Reads the name of the landmark category.
   149         *
   150         * @param[out] aCategoryName Will contain the category name.
   151         * @returns @p KErrNone if successful, @p KErrNotFound if the category
   152         *   name is not set.
   153         */
   154         IMPORT_C TInt GetCategoryName(
   155                TPtrC&  aCategoryName
   156         ) const;
   157 
   158         /**
   159         * Sets the name of the landmark category.
   160         *
   161         * @param[in] aCategoryName The category name.
   162         *
   163         * @leave KErrArgument Client passed an empty descriptor or landmark name 
   164         *   is longer than @p KPosLmMaxCategoryNameLength.
   165         */
   166         IMPORT_C void SetCategoryNameL(
   167                const TDesC&  aCategoryName
   168         );
   169 
   170         /**
   171         * Associates the landmark category with an icon.
   172         *
   173         * Icons are found in icon files. To set an icon, the client
   174         * must specify the name of the icon file and the index of the
   175         * icon within the file.
   176         *
   177         * The landmark is not affected if the icon file is changed or
   178         * removed. It only contains a link to the icon.
   179         *
   180         * @param[in] aIconFileName The full icon file name.
   181         * @param[in] aIconIndex The index of the icon within the icon file.
   182         * @param[in] aIconMaskIndex The index of the icon mask within the
   183         *   icon file.
   184         *
   185         * @leave KErrArgument The icon file name is longer than @p KMaxFileName.
   186         *
   187         * @panic "Landmarks Client"-EPosLmInvalidArgument The icon index is negative or
   188         *   icon mask index is negative and not equal to @p KPosLmIconMaskNotUsed.
   189         */
   190         IMPORT_C void SetIconL(
   191                const TDesC&  aIconFileName,
   192                TInt  aIconIndex,
   193                TInt  aIconMaskIndex
   194         );
   195 
   196         /**
   197         * Returns the a link to the icon associated with the landmark category.
   198         *
   199         * Icons are found in icon files. It is referenced by the name of
   200         * the icon file and the index of the icon within the file.
   201         *
   202         * The landmark category is not affected if the icon file is
   203         * changed or removed. It only contains a link to the icon. This means
   204         * that the link could be invalid.
   205         *
   206         * @param[out] aIconFileName The full icon file name.
   207         * @param[out] aIconIndex The index of the icon within the icon file.
   208         * @param[out] aIconMaskIndex The index of the icon mask within the
   209         *   icon file. If no icon mask index is defined @p KPosLmIconMaskNotUsed
   210         *   is returned.
   211         *
   212         * @returns @p KErrNone if successful, @p KErrNotFound if the icon is
   213         *   not set.
   214         */
   215         IMPORT_C TInt GetIcon(
   216                TPtrC& aIconFileName,
   217                TInt& aIconIndex,
   218                TInt& aIconMaskIndex
   219         ) const;
   220 
   221         /**
   222         * Removes category attributes from the landmark category.
   223         *
   224         * @param[in] aAttributes A bitmap specifying which category attributes to
   225         *   remove.
   226         */
   227         IMPORT_C void RemoveCategoryAttributes(
   228                TAttributes aAttributes
   229         );
   230 
   231         /**
   232         * @internal */
   233         /*
   234         * Sets the category ID to the landmark category.
   235         *
   236         * @param[in] aId The category ID to set.
   237         */
   238         void SetCategoryIdL(
   239                TPosLmItemId aId
   240         );
   241 
   242     private:
   243 
   244         // C++ constructor
   245         CPosLandmarkCategory();
   246 
   247         void ConstructL();
   248         void ConstructL(const CPosLandmarkCategory& aCategory);
   249 
   250         // Prohibit copy constructor
   251         CPosLandmarkCategory(const CPosLandmarkCategory&);
   252 
   253         // Prohibit assigment operator
   254         CPosLandmarkCategory& operator= (const CPosLandmarkCategory&);
   255 
   256     private:
   257 
   258         // Category ID
   259         TPosLmItemId iId;
   260 
   261         // Global category
   262         TPosLmGlobalCategory iGlobalCategory;
   263 
   264         // Category label
   265         HBufC* iCategoryName;
   266 
   267         // Category icon filename
   268         HBufC* iIconFileName;
   269 
   270         // Category icon index
   271         TInt iIconIndex;
   272 
   273         // Category icon mask index
   274         TInt iIconMaskIndex;
   275     };
   276 
   277 #endif      // CPOSLANDMARKCATEGORY_H
   278 
   279