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