cbs/CbsServer/ServerInc/CbsUtils.h
changeset 46 2fa1fa551b0b
parent 42 35488577e233
child 48 78df25012fda
equal deleted inserted replaced
42:35488577e233 46:2fa1fa551b0b
     1 /*
       
     2 * Copyright (c) 2003 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:  This file contains the header file of the CbsUtils class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CBSUTILS_H
       
    20 #define CBSUTILS_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32std.h>
       
    24   
       
    25 // FORWARD DECLARATIONS
       
    26 class RResourceFile;
       
    27 class RFs;
       
    28 
       
    29 // CLASS DECLARATION
       
    30 
       
    31 /**
       
    32 *   Namespace structure for CBS helper functions.
       
    33 */
       
    34 class CbsUtils 
       
    35     {
       
    36     public:
       
    37 
       
    38         /**
       
    39         * Searches and opens the DLL default resource file. 
       
    40         * Calls FindAndOpenResourceFileLC.
       
    41         *
       
    42         * @param   aFs         open file server handle.
       
    43         * @param   aResFile    resource file to open. If open is succesful, resource file
       
    44         *                      close operation is pushed on to the cleanup stack.
       
    45         *
       
    46         * @see CbsUtils::FindAndOpenResourceFileLC
       
    47         */
       
    48         static void FindAndOpenDefaultResourceFileLC
       
    49             ( RFs& aFs, 
       
    50             RResourceFile& aResFile );
       
    51 
       
    52         /**
       
    53         *   Leaves with KErrDiskFull if writing aBytesToWrite bytes 
       
    54         *   to the Flash File System would reduce the free space on FFS 
       
    55         *   under the critical level.
       
    56         *
       
    57         *   Used before every FFS write operation.
       
    58         *
       
    59         *   @param   aBytesToWrite      Number of bytes that are required 
       
    60         *                               to write to FFS
       
    61         *   @param   aFs                Open file server session
       
    62         *
       
    63         */
       
    64         static void FFSCriticalLevelCheckL( const TInt aBytesToWrite, RFs& aFs );
       
    65         
       
    66         /**
       
    67         *   Returns with KTrue if there is memory enough to allocate memory 
       
    68         *   for aBytesToWrite bytes.
       
    69         *
       
    70         *   Used before every topic allocation operation.
       
    71         *
       
    72         *   @param   aBytesToWrite      Number of bytes that are required 
       
    73         *                               to allocation
       
    74         *
       
    75         */
       
    76         static TBool RamMemCriticalLevelCheckL( const TInt aBytesToWrite);
       
    77 
       
    78         /**
       
    79         *   Leaves with KErrDiskFull if writing aBytesToWrite bytes 
       
    80         *   to the RAM File System would reduce the free space on RAM 
       
    81         *   under the critical level.
       
    82         *
       
    83         *   Used before every RAM write operation.
       
    84         *
       
    85         *   @param aFileName            File whose volume should be checked.
       
    86         *   @param aBytesToWrite        Number of bytes that are required
       
    87         *                               to write to RAM
       
    88         *   @param aFs                  Open file server session
       
    89         */
       
    90         static void VolumeCriticalLevelCheckL( 
       
    91             const TDesC& aFileName,
       
    92             TInt aBytesToWrite, const RFs& aFs );
       
    93 
       
    94         /**
       
    95         *   Returns ETrue, if the file aFile exists.
       
    96         *   
       
    97         *   The caller has to provide a file server session to this method.
       
    98         *
       
    99         *   @param aFs          Open file server session
       
   100         *   @param aFile        File name and path
       
   101         *   @return             ETrue, if the file exists.
       
   102         */
       
   103         static TBool ExistsL( const RFs& aFs, const TDesC& aFile );
       
   104 
       
   105         /**
       
   106         *   Deletes the given file.
       
   107         *
       
   108         *   @param  aFs         Open file server session
       
   109         *   @param  aFile       Filename
       
   110         */
       
   111         static void DeleteFileL( RFs& aFs, const TDesC& aFile );
       
   112 
       
   113 private:
       
   114     // Prohibited default constructor
       
   115     CbsUtils();
       
   116 
       
   117     // Prohibited copy constructor
       
   118     CbsUtils( const CbsUtils& );
       
   119     
       
   120     // Prohibited assignment operator
       
   121     CbsUtils& operator=( const CbsUtils& );
       
   122 
       
   123     };
       
   124 
       
   125 #endif  // CBSUTILS_H
       
   126 
       
   127 // End of File
       
   128 
       
   129