epoc32/include/mw/cdirectorylocalizer.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
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@2
     1
/*
williamr@2
     2
* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@4
     5
* under the terms of "Eclipse Public License v1.0"
williamr@2
     6
* which accompanies this distribution, and is available
williamr@4
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:  Directory Localizer interface class
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
williamr@2
    19
williamr@2
    20
#ifndef C_CDIRECTORYLOCALIZER_H
williamr@2
    21
#define C_CDIRECTORYLOCALIZER_H
williamr@2
    22
williamr@2
    23
#include <e32def.h>
williamr@2
    24
williamr@2
    25
class TResourceReader;
williamr@2
    26
williamr@2
    27
williamr@2
    28
/**
williamr@2
    29
 *  Directory Localizer interface class.
williamr@2
    30
 *
williamr@2
    31
 *  @lib directorylocalizer.lib
williamr@2
    32
 *  @since S60 v3.2
williamr@2
    33
 */
williamr@2
    34
NONSHARABLE_CLASS(CDirectoryLocalizer) : public CBase
williamr@2
    35
    {
williamr@2
    36
public: // Constructors and destructor    
williamr@2
    37
williamr@2
    38
    /**
williamr@2
    39
     * Two-phased constructor.
williamr@2
    40
     * Construct a CDirectoryLocalizer and initialize it with platform specific 
williamr@2
    41
     * default localization data.
williamr@2
    42
     * 
williamr@2
    43
     * @return apointer to the created instance of CDirectoryLocalizer.
williamr@2
    44
     */
williamr@2
    45
    IMPORT_C static CDirectoryLocalizer* NewL();
williamr@2
    46
williamr@2
    47
    /**
williamr@2
    48
     * Two-phased constructor.
williamr@2
    49
     * Construct a CDirectoryLocalizer and initialize it from resource pointed 
williamr@2
    50
     * by aReader.
williamr@2
    51
     * 
williamr@2
    52
     * @param aReader Reference to an initialized resource reader instance.
williamr@2
    53
     * @return apointer to the created instance of CDirectoryLocalizer.
williamr@2
    54
     */
williamr@2
    55
    IMPORT_C static CDirectoryLocalizer* NewL( TResourceReader& aReader );
williamr@2
    56
williamr@2
    57
    /**
williamr@2
    58
     * Two-phased constructor.
williamr@2
    59
     * Construct a CDirectoryLocalizer and initialize it from a resource ID.
williamr@2
    60
     * 
williamr@2
    61
     * @param aResourceId Resource identifier to DIRECTORYLOCALIZER resource.
williamr@2
    62
     * @return apointer to the created instance of CDirectoryLocalizer.
williamr@2
    63
     */
williamr@2
    64
    IMPORT_C static CDirectoryLocalizer* NewL( TInt aResourceId );
williamr@2
    65
williamr@2
    66
    /**
williamr@2
    67
     * Destructor.
williamr@2
    68
     */
williamr@2
    69
    IMPORT_C virtual ~CDirectoryLocalizer();
williamr@2
    70
williamr@2
    71
public: // New methods
williamr@2
    72
	
williamr@2
    73
    /**
williamr@2
    74
     * Adds entries to the localizer from resource pointed by aReader.
williamr@2
    75
     *
williamr@2
    76
     * @param aReader Reference to an initialized resouce reader instance.
williamr@2
    77
     * @return None.
williamr@2
    78
     */
williamr@2
    79
    IMPORT_C void AddFromResourceL( TResourceReader& aReader );
williamr@2
    80
williamr@2
    81
    /**
williamr@2
    82
     * Adds entries to the localizer from resource pointed by aResourceId.
williamr@2
    83
     *
williamr@2
    84
     * @param aResourceId Resource identifier to DIRECTORYLOCALIZER resource.
williamr@2
    85
     * @return None.
williamr@2
    86
     */
williamr@2
    87
    IMPORT_C void AddFromResourceL( TInt aResourceId );
williamr@2
    88
williamr@2
    89
    /**
williamr@2
    90
     * This method is used to set the absolute path to be localized.
williamr@2
    91
     * For example "c:\\nokia\\images\\pictures". Take care that the path
williamr@2
    92
     * is given with or without the trailing backslash depending on
williamr@2
    93
     * how the paths are defined in the resource. localizer can utilize 
williamr@2
    94
     * pathinfo to retrieve predefined folder paths.
williamr@2
    95
     *
williamr@2
    96
     * @param aFullPath Full path name.
williamr@2
    97
     * @return None. 
williamr@2
    98
     *
williamr@2
    99
     * @code
williamr@2
   100
     *  #include <PathInfo.h>
williamr@2
   101
     *
williamr@2
   102
     *  // Get the the full path of the contacts folder in the memory card.
williamr@2
   103
     *  TFileName path = PathInfo::GetPath( PathInfo::EImagesPath );
williamr@2
   104
     *
williamr@2
   105
     *  // 'path' contains now the images path to be appended to a root path.
williamr@2
   106
     *
williamr@2
   107
     * CDirectoryLocalizer loc = CDirectoryLocalizer::NewL();
williamr@2
   108
     * loc->SetFullPath ( path );
williamr@2
   109
     * @endcode     
williamr@2
   110
     *
williamr@2
   111
     * @see PathInfo
williamr@2
   112
     */
williamr@2
   113
    IMPORT_C void SetFullPath( const TDesC& aFullPath );
williamr@2
   114
williamr@2
   115
    /**
williamr@2
   116
     * Tells if the last given path is recognized as a localized directory.
williamr@2
   117
     *
williamr@2
   118
     * @return ETrue if last given path is localized and EFalse if not.
williamr@2
   119
     */
williamr@2
   120
    IMPORT_C TBool IsLocalized() const;
williamr@2
   121
williamr@2
   122
    /**
williamr@2
   123
     * Returns a reference to a TDesC that contains the last given path's
williamr@2
   124
     * localized name. If the path is not a localized directory, then
williamr@2
   125
     * a pointer to KNullDesc is returned.
williamr@2
   126
     *
williamr@2
   127
     * @return the last given path's localized name.
williamr@2
   128
     */
williamr@2
   129
    IMPORT_C const TDesC& LocalizedName() const;
williamr@2
   130
williamr@2
   131
    /**
williamr@2
   132
     * Returns a reference to a TDesC that contains the last given path's
williamr@2
   133
     * extra data. If the path is not a localized directory or no extra
williamr@2
   134
     * data is defined, then a pointer to KNullDesc is returned.
williamr@2
   135
     *
williamr@2
   136
     * @return the last given path's extra data.
williamr@2
   137
     */
williamr@2
   138
    IMPORT_C const TDesC& ExtraData() const;
williamr@2
   139
williamr@2
   140
    /**
williamr@2
   141
     * Returns the icon index of the last given path. If the path is not a
williamr@2
   142
     * localized directory KErrGeneral is returned.
williamr@2
   143
     *
williamr@2
   144
     * @return the icon index of the last given path.
williamr@2
   145
     *
williamr@2
   146
     * @code
williamr@2
   147
     * CDirectoryLocalizer loc = CDirectoryLocalizer::NewL();
williamr@2
   148
     * loc-> SetFullPath( aDir );
williamr@2
   149
     * if ( loc->Icon() != KErrGeneral )
williamr@2
   150
     *     {
williamr@2
   151
     *     //...
williamr@2
   152
     *     }
williamr@2
   153
     * @endcode       
williamr@2
   154
     */
williamr@2
   155
    IMPORT_C TInt Icon() const;
williamr@2
   156
williamr@2
   157
protected:
williamr@2
   158
williamr@2
   159
    /**
williamr@2
   160
     * C++ default constructor.
williamr@2
   161
     */
williamr@2
   162
    CDirectoryLocalizer();
williamr@2
   163
 
williamr@2
   164
    /**
williamr@2
   165
     * Symbian 2nd phase constructor.
williamr@2
   166
     */
williamr@2
   167
    void ConstructL();
williamr@2
   168
williamr@2
   169
private: // data
williamr@2
   170
williamr@2
   171
    /**
williamr@2
   172
     * The index of the current entry.
williamr@2
   173
     */
williamr@2
   174
    TInt iCurrentEntry;
williamr@2
   175
williamr@2
   176
    /**
williamr@2
   177
     * A pointer to the array for paths.
williamr@2
   178
     * Own.
williamr@2
   179
     */
williamr@2
   180
    CArrayPtrFlat<TDesC>* iPaths;
williamr@2
   181
williamr@2
   182
    /**
williamr@2
   183
     * A pointer to the array for localised names.
williamr@2
   184
     * Own.
williamr@2
   185
     */
williamr@2
   186
    CArrayPtrFlat<TDesC>* iLocalizedNames;
williamr@2
   187
williamr@2
   188
    /**
williamr@2
   189
     * A pointer to the array for extra data.
williamr@2
   190
     * Own.
williamr@2
   191
     */
williamr@2
   192
    CArrayPtrFlat<TDesC>* iExtraData;
williamr@2
   193
williamr@2
   194
    /**
williamr@2
   195
     * The array for icon indices.
williamr@2
   196
     */
williamr@2
   197
    RArray<TInt> iIconIndices;
williamr@2
   198
    
williamr@2
   199
    };
williamr@2
   200
williamr@2
   201
#endif // C_CDIRECTORYLOCALIZER_H