filesystemuis/memscaneng/serverinc/msengscannerbase.h
branchRCL_3
changeset 21 65326cf895ed
equal deleted inserted replaced
20:491b3ed49290 21:65326cf895ed
       
     1 /*
       
     2 * Copyright (c) 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: 
       
    15 *     Base class for scanner classes.
       
    16 *
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef MSENGSCANNERBASE_H
       
    22 #define MSENGSCANNERBASE_H
       
    23 
       
    24 
       
    25 
       
    26 
       
    27 // USER INCLUDES
       
    28 #include "mseng.hrh"
       
    29 #include "msenginfoarray.h"
       
    30 #include "msengscanobserver.h" 
       
    31 
       
    32 
       
    33 
       
    34 // CONSTANTS
       
    35 const TInt KDirectoryListGranularity = 10;
       
    36 
       
    37 // CLASS DECLARATION
       
    38 
       
    39 /**
       
    40 *  Base class for scanner classes.
       
    41 *  
       
    42 */
       
    43 class CMsengScannerBase : public CActive
       
    44     {
       
    45     public:  // Constructors and destructor
       
    46  
       
    47         /**
       
    48         *
       
    49         */
       
    50         enum TStepResult
       
    51             {
       
    52             ECompleteRequest = 0,
       
    53             ERequestIssuedInternally,
       
    54             EScanComplete
       
    55             };
       
    56         
       
    57         /**
       
    58         * C++ default constructor.
       
    59         */
       
    60         CMsengScannerBase(MMsengScannerObserver& aObserver, 
       
    61             CMsengInfoArray& aInfoArray, RFs& aFsSession);
       
    62         
       
    63         /**
       
    64         * Destructor.
       
    65         */
       
    66         virtual ~CMsengScannerBase();
       
    67 
       
    68 	protected: // Internal functions
       
    69 
       
    70         /**
       
    71         * Do one incremental scanning step
       
    72         */
       
    73         virtual TStepResult PerformStepL() = 0;
       
    74 
       
    75         /**
       
    76         * Complete this active object's request and set it active again
       
    77         */
       
    78         void CompleteRequest(TInt aCode = KErrNone);
       
    79 
       
    80         /**
       
    81         * Add new value in bytes to the amount of data found with this UID.
       
    82         * @param aUid The UID type.
       
    83         * @param aSize The size of the file with this UID.
       
    84         */
       
    85         inline void AddSizeByUidL(TUidTypes aUid, TInt64 aSize);
       
    86 
       
    87         /**
       
    88         * Add new value in bytes to the amount of data found with this UID.
       
    89         * @param aUid The UID type.
       
    90         * @param aSize The size of the file with this UID.
       
    91         */
       
    92         inline void AddSizeByExtL(TExtTypes aExt, TInt64 aSize);
       
    93 
       
    94         /**
       
    95         * Query if the directory is in the list of directories to be 
       
    96         * excluded from scanning, or is a subdirectory of one.
       
    97         * @param aDirectory Path of the directory
       
    98         */
       
    99         inline TBool IsExcludedDir(const TDesC& aDirectory);
       
   100 
       
   101         /**
       
   102         * Query if the directory is in the list of directories to be 
       
   103         * excluded from scanning, or is a subdirectory of one.
       
   104         * @param aDirectory Path of the directory
       
   105         */
       
   106         inline TBool IsSpecialDir(const TDesC& aDirectory);
       
   107 
       
   108         /**
       
   109         * Access the file server session
       
   110         */
       
   111         inline RFs& FsSession();
       
   112 
       
   113         /**
       
   114         * Access the information array
       
   115         */
       
   116         inline CMsengInfoArray& InfoArray();
       
   117 
       
   118         /**
       
   119         * Access the observer of this scanner
       
   120         */
       
   121         inline MMsengScannerObserver& ScannerObserver();
       
   122 
       
   123     private: // from CActive
       
   124 
       
   125         /**
       
   126         *
       
   127         */
       
   128         virtual void RunL();
       
   129 
       
   130         /**
       
   131         *
       
   132 		*/
       
   133         virtual void DoCancel();
       
   134 
       
   135         /**
       
   136         *
       
   137         */
       
   138         virtual TInt RunError(TInt aError);
       
   139 
       
   140     private:
       
   141 
       
   142         // Prohibit copy constructor if not deriving from CBase.
       
   143         CMsengScannerBase( const CMsengScannerBase& );
       
   144         // Prohibit assigment operator if not deriving from CBase.
       
   145         CMsengScannerBase& operator= ( const CMsengScannerBase& );
       
   146 
       
   147 
       
   148     private:
       
   149 
       
   150         MMsengScannerObserver& iObserver;
       
   151         CMsengInfoArray& iInfoArray;
       
   152         RFs& iFsSession;
       
   153     };
       
   154 
       
   155 #include "msengscannerbase.inl"
       
   156 
       
   157 #endif      // CMSENGSCANNERBASE_H   
       
   158             
       
   159 // End of File