2 * Copyright (c) 2007 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: Directory Localizer interface class
20 #ifndef C_CDIRECTORYLOCALIZER_H
21 #define C_CDIRECTORYLOCALIZER_H
25 class TResourceReader;
29 * Directory Localizer interface class.
31 * @lib directorylocalizer.lib
34 NONSHARABLE_CLASS(CDirectoryLocalizer) : public CBase
36 public: // Constructors and destructor
39 * Two-phased constructor.
40 * Construct a CDirectoryLocalizer and initialize it with platform specific
41 * default localization data.
43 * @return apointer to the created instance of CDirectoryLocalizer.
45 IMPORT_C static CDirectoryLocalizer* NewL();
48 * Two-phased constructor.
49 * Construct a CDirectoryLocalizer and initialize it from resource pointed
52 * @param aReader Reference to an initialized resource reader instance.
53 * @return apointer to the created instance of CDirectoryLocalizer.
55 IMPORT_C static CDirectoryLocalizer* NewL( TResourceReader& aReader );
58 * Two-phased constructor.
59 * Construct a CDirectoryLocalizer and initialize it from a resource ID.
61 * @param aResourceId Resource identifier to DIRECTORYLOCALIZER resource.
62 * @return apointer to the created instance of CDirectoryLocalizer.
64 IMPORT_C static CDirectoryLocalizer* NewL( TInt aResourceId );
69 IMPORT_C virtual ~CDirectoryLocalizer();
71 public: // New methods
74 * Adds entries to the localizer from resource pointed by aReader.
76 * @param aReader Reference to an initialized resouce reader instance.
79 IMPORT_C void AddFromResourceL( TResourceReader& aReader );
82 * Adds entries to the localizer from resource pointed by aResourceId.
84 * @param aResourceId Resource identifier to DIRECTORYLOCALIZER resource.
87 IMPORT_C void AddFromResourceL( TInt aResourceId );
90 * This method is used to set the absolute path to be localized.
91 * For example "c:\\nokia\\images\\pictures". Take care that the path
92 * is given with or without the trailing backslash depending on
93 * how the paths are defined in the resource. localizer can utilize
94 * pathinfo to retrieve predefined folder paths.
96 * @param aFullPath Full path name.
100 * #include <PathInfo.h>
102 * // Get the the full path of the contacts folder in the memory card.
103 * TFileName path = PathInfo::GetPath( PathInfo::EImagesPath );
105 * // 'path' contains now the images path to be appended to a root path.
107 * CDirectoryLocalizer loc = CDirectoryLocalizer::NewL();
108 * loc->SetFullPath ( path );
113 IMPORT_C void SetFullPath( const TDesC& aFullPath );
116 * Tells if the last given path is recognized as a localized directory.
118 * @return ETrue if last given path is localized and EFalse if not.
120 IMPORT_C TBool IsLocalized() const;
123 * Returns a reference to a TDesC that contains the last given path's
124 * localized name. If the path is not a localized directory, then
125 * a pointer to KNullDesc is returned.
127 * @return the last given path's localized name.
129 IMPORT_C const TDesC& LocalizedName() const;
132 * Returns a reference to a TDesC that contains the last given path's
133 * extra data. If the path is not a localized directory or no extra
134 * data is defined, then a pointer to KNullDesc is returned.
136 * @return the last given path's extra data.
138 IMPORT_C const TDesC& ExtraData() const;
141 * Returns the icon index of the last given path. If the path is not a
142 * localized directory KErrGeneral is returned.
144 * @return the icon index of the last given path.
147 * CDirectoryLocalizer loc = CDirectoryLocalizer::NewL();
148 * loc-> SetFullPath( aDir );
149 * if ( loc->Icon() != KErrGeneral )
155 IMPORT_C TInt Icon() const;
160 * C++ default constructor.
162 CDirectoryLocalizer();
165 * Symbian 2nd phase constructor.
172 * The index of the current entry.
177 * A pointer to the array for paths.
180 CArrayPtrFlat<TDesC>* iPaths;
183 * A pointer to the array for localised names.
186 CArrayPtrFlat<TDesC>* iLocalizedNames;
189 * A pointer to the array for extra data.
192 CArrayPtrFlat<TDesC>* iExtraData;
195 * The array for icon indices.
197 RArray<TInt> iIconIndices;
201 #endif // C_CDIRECTORYLOCALIZER_H