2 * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: CPosLandmarkCategory class
19 #ifndef CPOSLANDMARKCATEGORY_H
20 #define CPOSLANDMARKCATEGORY_H
23 #include "EPos_Landmarks.h"
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
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.
39 * A landmark category is created, updated or deleted by using functions in
40 * @ref CPosLmCategoryManager.
42 * @lib eposlandmarks.lib
45 class CPosLandmarkCategory : public CBase
50 * Bitmap for specifying a group of category attributes. Bit values are
51 * defined by @ref _TAttributes.
53 typedef TUint32 TAttributes;
56 * Specifies a category attribute, such as category name or category icon.
60 ENoAttribute = 0x0000 /**<
61 No attribute specified. */,
62 ECategoryName = 0x0001 /**<
63 The name of the landmark category. */,
65 The icon that represents the category in a UI. */,
66 EAllAttributes = 0xFFFF /**<
67 All category attributes. */
73 * Two-phased constructor.
74 * @returns A new instance of this class.
76 IMPORT_C static CPosLandmarkCategory* NewLC();
79 * Two-phased constructor.
80 * @returns A new instance of this class.
82 IMPORT_C static CPosLandmarkCategory* NewL();
85 * Two-phased copy constructor.
87 * @param[in] aCategory The category to copy.
88 * @returns A copy of the specified category object.
90 IMPORT_C static CPosLandmarkCategory* NewLC(
91 const CPosLandmarkCategory& aCategory
95 * Two-phased copy constructor.
97 * @param[in] aCategory The category to copy.
98 * @returns A copy of the specified category object.
100 IMPORT_C static CPosLandmarkCategory* NewL(
101 const CPosLandmarkCategory& aCategory
107 virtual ~CPosLandmarkCategory();
112 * Reads the ID of the category entry in the database.
114 * @returns The ID of the category entry in the database, or
115 * @p KPosLmNullItemId if the category has not been added to the
118 IMPORT_C TPosLmItemId CategoryId() const;
121 * Retrieves global category ID.
123 * Global categories enable a uniform categorization across multiple
126 * @returns The global category ID or @p KPosLmNullGlobalCategory if the
127 * category is not global.
129 IMPORT_C TPosLmGlobalCategory GlobalCategory() const;
134 * Sets the category to be global (i.e. not only defined in one
137 * Global categories enable a uniform categorization across multiple
140 * @param[in] aGlobalCategory The global category ID or
141 * @p KPosLmNullGlobalCategory if the category should not be global.
143 void SetGlobalCategory(
144 TPosLmGlobalCategory aGlobalCategory
148 * Reads the name of the landmark category.
150 * @param[out] aCategoryName Will contain the category name.
151 * @returns @p KErrNone if successful, @p KErrNotFound if the category
154 IMPORT_C TInt GetCategoryName(
159 * Sets the name of the landmark category.
161 * @param[in] aCategoryName The category name.
163 * @leave KErrArgument Client passed an empty descriptor or landmark name
164 * is longer than @p KPosLmMaxCategoryNameLength.
166 IMPORT_C void SetCategoryNameL(
167 const TDesC& aCategoryName
171 * Associates the landmark category with an icon.
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.
177 * The landmark is not affected if the icon file is changed or
178 * removed. It only contains a link to the icon.
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
185 * @leave KErrArgument The icon file name is longer than @p KMaxFileName.
187 * @panic "Landmarks Client"-EPosLmInvalidArgument The icon index is negative or
188 * icon mask index is negative and not equal to @p KPosLmIconMaskNotUsed.
190 IMPORT_C void SetIconL(
191 const TDesC& aIconFileName,
197 * Returns the a link to the icon associated with the landmark category.
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.
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.
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
212 * @returns @p KErrNone if successful, @p KErrNotFound if the icon is
215 IMPORT_C TInt GetIcon(
216 TPtrC& aIconFileName,
222 * Removes category attributes from the landmark category.
224 * @param[in] aAttributes A bitmap specifying which category attributes to
227 IMPORT_C void RemoveCategoryAttributes(
228 TAttributes aAttributes
234 * Sets the category ID to the landmark category.
236 * @param[in] aId The category ID to set.
245 CPosLandmarkCategory();
248 void ConstructL(const CPosLandmarkCategory& aCategory);
250 // Prohibit copy constructor
251 CPosLandmarkCategory(const CPosLandmarkCategory&);
253 // Prohibit assigment operator
254 CPosLandmarkCategory& operator= (const CPosLandmarkCategory&);
262 TPosLmGlobalCategory iGlobalCategory;
265 HBufC* iCategoryName;
267 // Category icon filename
268 HBufC* iIconFileName;
270 // Category icon index
273 // Category icon mask index
277 #endif // CPOSLANDMARKCATEGORY_H