dbcreator/commsdatcreator/Inc/cdcdumptables.h
changeset 0 5a93021fdf25
equal deleted inserted replaced
-1:000000000000 0:5a93021fdf25
       
     1 /*
       
     2 * Copyright (c) 2002 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:   Declaration of the class CDbCreator
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef DUMP_TABLES_H
       
    22 #define DUMP_TABLES_H
       
    23 
       
    24 // INCLUDE FILES
       
    25 
       
    26 #include <e32base.h>
       
    27 #include <s32file.h>
       
    28 
       
    29 // CLASS DECLARATION
       
    30 
       
    31 class CMDBSession;
       
    32 
       
    33 /**
       
    34 * CDumpTables writes data from CommsDat to CSV format file.
       
    35 * CDumpTables dumps the CommsDat tables which are not dumped 
       
    36 * by any other application.
       
    37 */
       
    38 class CDumpTables : public CBase
       
    39     {
       
    40 
       
    41     public:
       
    42     
       
    43         /**
       
    44          * Two-phase constructor.
       
    45          * @return CDumpTables instance.
       
    46          */
       
    47         static CDumpTables* NewL();
       
    48 
       
    49         /**
       
    50          * Two-phase constructor.
       
    51          * @return CDumpTables instance. Let the instance on the CleanupStack. 
       
    52          */
       
    53         static CDumpTables* NewLC();
       
    54      
       
    55         /**
       
    56          * Destructor.
       
    57          */
       
    58         virtual ~CDumpTables();
       
    59         
       
    60         /**
       
    61          * Dumps the unsupported tables to CSV format file.
       
    62          * @param outFileName name of the output file with full path. 
       
    63          */
       
    64         void DoDumpTablesL( const TFileName& aOutFileName );
       
    65         
       
    66     protected:
       
    67 
       
    68         /**
       
    69          * Second phase constructor. Leaves on failure.
       
    70          */
       
    71         void ConstructL();
       
    72         
       
    73      private:
       
    74     
       
    75         /**
       
    76          * Constructor
       
    77          */
       
    78         CDumpTables();
       
    79         
       
    80         /**
       
    81          * Template method for dumping one CommsDat table
       
    82          * @param class T representing the table which is dumped. 
       
    83          */
       
    84         template<class T> void DumpTableL( const TDesC* aTableName );
       
    85 
       
    86         /**
       
    87          * Opens a output file for dumping. It tries to open the file
       
    88          * and if it does not exist then a new one created.
       
    89          * @param aFileName name of the file. It cannot be NULL.  
       
    90          */
       
    91         TInt OpenFileL( const TFileName& aFileName );
       
    92         
       
    93         /**
       
    94          * Writes 8 bit descriptor to 16 bit unicode file in CSV format.
       
    95          * @param aDes the written text. It gets the ownership.  
       
    96          */
       
    97         void WriteL( HBufC8* aDes );
       
    98 
       
    99         /**
       
   100          * Writes 16 bit descriptor to 16 bit unicode file in CSV format.
       
   101          * @param aDes the written text. It gets the ownership.  
       
   102          */
       
   103         void WriteL( HBufC16* aDes );
       
   104 
       
   105         /**
       
   106          * Transform the parameter field to CSV accepted format.
       
   107          * @param aField the field that should be checked and transform
       
   108          * to CSV format if it is necessary
       
   109          * @return the CSV acceptable format.
       
   110          */
       
   111         HBufC16* TransformToCSVFormatLC( const HBufC16* aField );
       
   112         
       
   113         /**
       
   114          * Checks the parameter field if transformation to CSV format is
       
   115          * necessary.
       
   116          * @param aField the field which should be checked.
       
   117          * @return ETrue if transformation is necessary else EFalse.
       
   118          */
       
   119         TBool CheckCSVTransformNeedL( HBufC16* aFiled );
       
   120 
       
   121 
       
   122     private:
       
   123     
       
   124         // Session for CommsDat
       
   125         CommsDat::CMDBSession* iSession;
       
   126         
       
   127         // Fs for file handling
       
   128         RFs   iRfs;
       
   129 
       
   130         // Output file
       
   131         RFileWriteStream iFile;
       
   132         
       
   133         // Counter for how many double qoutes are in the given text. 
       
   134         TInt iNumOfDQuotes;        
       
   135 
       
   136     };
       
   137 
       
   138 #endif DUMP_TABLES_H
       
   139 
       
   140