filemanager/GFLM/inc/CGflmDirectoryListingCache.h
changeset 0 6a9f87576119
equal deleted inserted replaced
-1:000000000000 0:6a9f87576119
       
     1 /*
       
     2 * Copyright (c) 2002-2006 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:  Provides directory listing cache
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CGFLMDIRECTORYLISTINGCACHE_H
       
    21 #define CGFLMDIRECTORYLISTINGCACHE_H
       
    22 
       
    23 
       
    24 //  INCLUDES
       
    25 #include <f32file.h>
       
    26 #include "GFLM.hrh"
       
    27 
       
    28 
       
    29 // CLASS DECLARATION
       
    30 
       
    31 /**
       
    32 *  A class that encapsulates reading and storing the contents of a
       
    33 *  directory. When a directory listing is read, the results are
       
    34 *  cached so that the same listing can be used in other groups
       
    35 *  without having to re-read the same directory.
       
    36 *
       
    37 *  @lib GFLM.lib
       
    38 *  @since 2.0
       
    39 */
       
    40 NONSHARABLE_CLASS(CGflmDirectoryListingCache) : public CBase
       
    41     {
       
    42     public:
       
    43         typedef CArrayPakFlat< TEntry > CEntryArray;
       
    44 
       
    45     private:
       
    46         /**
       
    47         * An internal data structure for storing directory name and listing
       
    48         * pairs.
       
    49         */
       
    50         NONSHARABLE_CLASS(CListingNamePair) : public CBase
       
    51             {
       
    52             public:
       
    53                 ~CListingNamePair();
       
    54                 static CListingNamePair* NewLC( const TDesC& aDirectory );
       
    55             private:
       
    56                 void ConstructL( const TDesC& aDirectory );
       
    57             public:
       
    58                 HBufC* iDirectory;
       
    59                 CEntryArray* iListing;
       
    60             };
       
    61 
       
    62     public:  // Constructors and destructor
       
    63 
       
    64         /**
       
    65         * Two-phased constructor.
       
    66         * @since 2.0
       
    67         * @param aFss A reference to a valid and open file server session
       
    68         * @param aCancelIndicator A reference to cancel indicator
       
    69         */
       
    70         static CGflmDirectoryListingCache* NewL(
       
    71             RFs& aFss,
       
    72             const TBool& aCancelIndicator );
       
    73 
       
    74         /**
       
    75         * Destructor.
       
    76         */
       
    77         virtual ~CGflmDirectoryListingCache();
       
    78 
       
    79     public: // New functions
       
    80 
       
    81         /**
       
    82         * Clears the contents of the cache
       
    83         * @since 2.0
       
    84         */
       
    85         void ClearCache();
       
    86 
       
    87         /**
       
    88         * Retrieves a directory listing
       
    89         * @since 2.0
       
    90         * @param aDirectory Path of the directory
       
    91         * @return A pointer to a CEntryArray object that contains the requested items
       
    92         */
       
    93         const CEntryArray* ListingL( const TDesC& aDirectory );
       
    94 
       
    95     private:
       
    96 
       
    97         /**
       
    98         * C++ default constructor.
       
    99         */
       
   100         CGflmDirectoryListingCache(
       
   101             RFs& aFss,
       
   102             const TBool& aCancelIndicator );
       
   103 
       
   104         void GetDirL( CListingNamePair& aPair );
       
   105 
       
   106     private:    // Data
       
   107         // For caching directory contents. Owned.
       
   108         CListingNamePair* iCache;
       
   109 
       
   110         // An open fileserver session. Not owned.
       
   111         RFs& iFss;
       
   112 
       
   113         // Read only cancel indicator. Not owned
       
   114         const TBool& iCancelIndicator;
       
   115 
       
   116         // A buffer for reading directory contents
       
   117         TEntryArray iEntryBuffer;
       
   118 
       
   119         // An indicator if cache must be cleared
       
   120         TBool iClearCache;
       
   121 
       
   122     };
       
   123 
       
   124 #endif      // CGFLMDIRECTORYLISTINGCACHE_H
       
   125 
       
   126 // End of File