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.
     1 /*
     2 * Copyright (c) 2007 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:  Directory Localizer interface class
    15 *
    16 */
    17 
    18 
    19 
    20 #ifndef C_CDIRECTORYLOCALIZER_H
    21 #define C_CDIRECTORYLOCALIZER_H
    22 
    23 #include <e32def.h>
    24 
    25 class TResourceReader;
    26 
    27 
    28 /**
    29  *  Directory Localizer interface class.
    30  *
    31  *  @lib directorylocalizer.lib
    32  *  @since S60 v3.2
    33  */
    34 NONSHARABLE_CLASS(CDirectoryLocalizer) : public CBase
    35     {
    36 public: // Constructors and destructor    
    37 
    38     /**
    39      * Two-phased constructor.
    40      * Construct a CDirectoryLocalizer and initialize it with platform specific 
    41      * default localization data.
    42      * 
    43      * @return apointer to the created instance of CDirectoryLocalizer.
    44      */
    45     IMPORT_C static CDirectoryLocalizer* NewL();
    46 
    47     /**
    48      * Two-phased constructor.
    49      * Construct a CDirectoryLocalizer and initialize it from resource pointed 
    50      * by aReader.
    51      * 
    52      * @param aReader Reference to an initialized resource reader instance.
    53      * @return apointer to the created instance of CDirectoryLocalizer.
    54      */
    55     IMPORT_C static CDirectoryLocalizer* NewL( TResourceReader& aReader );
    56 
    57     /**
    58      * Two-phased constructor.
    59      * Construct a CDirectoryLocalizer and initialize it from a resource ID.
    60      * 
    61      * @param aResourceId Resource identifier to DIRECTORYLOCALIZER resource.
    62      * @return apointer to the created instance of CDirectoryLocalizer.
    63      */
    64     IMPORT_C static CDirectoryLocalizer* NewL( TInt aResourceId );
    65 
    66     /**
    67      * Destructor.
    68      */
    69     IMPORT_C virtual ~CDirectoryLocalizer();
    70 
    71 public: // New methods
    72 	
    73     /**
    74      * Adds entries to the localizer from resource pointed by aReader.
    75      *
    76      * @param aReader Reference to an initialized resouce reader instance.
    77      * @return None.
    78      */
    79     IMPORT_C void AddFromResourceL( TResourceReader& aReader );
    80 
    81     /**
    82      * Adds entries to the localizer from resource pointed by aResourceId.
    83      *
    84      * @param aResourceId Resource identifier to DIRECTORYLOCALIZER resource.
    85      * @return None.
    86      */
    87     IMPORT_C void AddFromResourceL( TInt aResourceId );
    88 
    89     /**
    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.
    95      *
    96      * @param aFullPath Full path name.
    97      * @return None. 
    98      *
    99      * @code
   100      *  #include <PathInfo.h>
   101      *
   102      *  // Get the the full path of the contacts folder in the memory card.
   103      *  TFileName path = PathInfo::GetPath( PathInfo::EImagesPath );
   104      *
   105      *  // 'path' contains now the images path to be appended to a root path.
   106      *
   107      * CDirectoryLocalizer loc = CDirectoryLocalizer::NewL();
   108      * loc->SetFullPath ( path );
   109      * @endcode     
   110      *
   111      * @see PathInfo
   112      */
   113     IMPORT_C void SetFullPath( const TDesC& aFullPath );
   114 
   115     /**
   116      * Tells if the last given path is recognized as a localized directory.
   117      *
   118      * @return ETrue if last given path is localized and EFalse if not.
   119      */
   120     IMPORT_C TBool IsLocalized() const;
   121 
   122     /**
   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.
   126      *
   127      * @return the last given path's localized name.
   128      */
   129     IMPORT_C const TDesC& LocalizedName() const;
   130 
   131     /**
   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.
   135      *
   136      * @return the last given path's extra data.
   137      */
   138     IMPORT_C const TDesC& ExtraData() const;
   139 
   140     /**
   141      * Returns the icon index of the last given path. If the path is not a
   142      * localized directory KErrGeneral is returned.
   143      *
   144      * @return the icon index of the last given path.
   145      *
   146      * @code
   147      * CDirectoryLocalizer loc = CDirectoryLocalizer::NewL();
   148      * loc-> SetFullPath( aDir );
   149      * if ( loc->Icon() != KErrGeneral )
   150      *     {
   151      *     //...
   152      *     }
   153      * @endcode       
   154      */
   155     IMPORT_C TInt Icon() const;
   156 
   157 protected:
   158 
   159     /**
   160      * C++ default constructor.
   161      */
   162     CDirectoryLocalizer();
   163  
   164     /**
   165      * Symbian 2nd phase constructor.
   166      */
   167     void ConstructL();
   168 
   169 private: // data
   170 
   171     /**
   172      * The index of the current entry.
   173      */
   174     TInt iCurrentEntry;
   175 
   176     /**
   177      * A pointer to the array for paths.
   178      * Own.
   179      */
   180     CArrayPtrFlat<TDesC>* iPaths;
   181 
   182     /**
   183      * A pointer to the array for localised names.
   184      * Own.
   185      */
   186     CArrayPtrFlat<TDesC>* iLocalizedNames;
   187 
   188     /**
   189      * A pointer to the array for extra data.
   190      * Own.
   191      */
   192     CArrayPtrFlat<TDesC>* iExtraData;
   193 
   194     /**
   195      * The array for icon indices.
   196      */
   197     RArray<TInt> iIconIndices;
   198     
   199     };
   200 
   201 #endif // C_CDIRECTORYLOCALIZER_H