|         |      1 /* | 
|         |      2 * Copyright (c) 2002-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:  File system item definitions | 
|         |     15 * | 
|         |     16 */ | 
|         |     17  | 
|         |     18  | 
|         |     19  | 
|         |     20 #ifndef CGFLMFILESYSTEMITEM_H | 
|         |     21 #define CGFLMFILESYSTEMITEM_H | 
|         |     22  | 
|         |     23  | 
|         |     24 //  INCLUDES | 
|         |     25 #include <e32base.h> | 
|         |     26 #include "CGflmGroupItem.h" | 
|         |     27  | 
|         |     28  | 
|         |     29 //  FORWARD DECLARATIONS | 
|         |     30 class TEntry; | 
|         |     31  | 
|         |     32  | 
|         |     33 // CLASS DECLARATION | 
|         |     34  | 
|         |     35 /** | 
|         |     36 *  A class representing a file system item. | 
|         |     37 *  A file system item is either a file or a directory. | 
|         |     38 * | 
|         |     39 *  @lib GFLM.lib | 
|         |     40 *  @since 2.0 | 
|         |     41 */ | 
|         |     42 class CGflmFileSystemItem : public CGflmGroupItem | 
|         |     43     { | 
|         |     44     public:  // Constructors and destructor | 
|         |     45  | 
|         |     46         /** | 
|         |     47         * Two-phased constructor. | 
|         |     48         */ | 
|         |     49         static CGflmFileSystemItem* NewLC( | 
|         |     50             const TEntry& aFSEntry, | 
|         |     51             const TDesC& aBasePath ); | 
|         |     52  | 
|         |     53         /** | 
|         |     54         * Destructor. | 
|         |     55         */ | 
|         |     56         virtual ~CGflmFileSystemItem( ); | 
|         |     57  | 
|         |     58     public: // New functions | 
|         |     59  | 
|         |     60         /** | 
|         |     61         * Get the full path of the item. | 
|         |     62         * @since 2.0 | 
|         |     63         * @param aPath Modifiable descriptor with atleast the size of | 
|         |     64         *        KMaxFileName. The full path of the item will be | 
|         |     65         *        placed in this descriptor. | 
|         |     66         */ | 
|         |     67         IMPORT_C void GetFullPath( TDes& aPath ) const; | 
|         |     68  | 
|         |     69         /** | 
|         |     70         * Sets the localized name of the item. | 
|         |     71         * @since 2.0 | 
|         |     72         * @param aName A descriptor containing the localized name for the | 
|         |     73                  entry. A copy of the name is created. | 
|         |     74         */ | 
|         |     75         IMPORT_C void SetLocalizedNameL( const TDesC& aName ); | 
|         |     76  | 
|         |     77         /** | 
|         |     78         * Get reference to TEntry object of the item. | 
|         |     79         * @since 3.1 | 
|         |     80         * @return  A reference to TEntry object. | 
|         |     81         */ | 
|         |     82         IMPORT_C const TEntry& Entry() const; | 
|         |     83  | 
|         |     84         /** | 
|         |     85         * Get the full path of the item. | 
|         |     86         * @since 3.2 | 
|         |     87         * @return Item full path. The pointer must be freed. | 
|         |     88         */ | 
|         |     89         IMPORT_C HBufC* FullPathLC() const; | 
|         |     90  | 
|         |     91         /** | 
|         |     92         * Get the full path of the item. | 
|         |     93         * @since 3.2 | 
|         |     94         * @return Item full path. The pointer must be freed. | 
|         |     95         */ | 
|         |     96         IMPORT_C HBufC* FullPathL() const; | 
|         |     97  | 
|         |     98     public: // From CGflmGroupItem | 
|         |     99  | 
|         |    100         TGflmItemType Type() const; | 
|         |    101  | 
|         |    102         TPtrC Name() const; | 
|         |    103  | 
|         |    104         TTime Date() const; | 
|         |    105  | 
|         |    106         TInt64 Size() const; | 
|         |    107  | 
|         |    108         TPtrC Ext() const; | 
|         |    109  | 
|         |    110     private: | 
|         |    111  | 
|         |    112         void SetExt(); | 
|         |    113  | 
|         |    114     protected: | 
|         |    115  | 
|         |    116         /** | 
|         |    117         * C++ default constructor. | 
|         |    118         */ | 
|         |    119         CGflmFileSystemItem( | 
|         |    120             const TEntry& aFSEntry, | 
|         |    121             const TDesC& aBasePath ); | 
|         |    122  | 
|         |    123         inline CGflmFileSystemItem() | 
|         |    124             { | 
|         |    125             } | 
|         |    126  | 
|         |    127         inline void SetBasePath( const TDesC& aBasePath ) | 
|         |    128             { | 
|         |    129             iBasePath.Set( aBasePath ); | 
|         |    130             } | 
|         |    131      | 
|         |    132         void SetEntry( const TEntry& aFSEntry ); | 
|         |    133  | 
|         |    134     private:    // Data | 
|         |    135         // A reference to a TEntry object that is the actual filesystem entry | 
|         |    136         const TEntry* iFSEntry; | 
|         |    137  | 
|         |    138         // A pointer descriptor that contains the base path of the | 
|         |    139         // filesystem entry. | 
|         |    140         TPtrC iBasePath; | 
|         |    141  | 
|         |    142         // The localized name of the entry. NULL if it doesn't have one. | 
|         |    143         HBufC* iLocalizedName; | 
|         |    144  | 
|         |    145         // A pointer descriptor that contains the file extension | 
|         |    146         TPtrC iExt; | 
|         |    147  | 
|         |    148     }; | 
|         |    149  | 
|         |    150 #endif      // CGFLMFILESYSTEMITEM_H | 
|         |    151  | 
|         |    152 // End of File |