dbcreator/commsdatcreator/Inc/cdcreaderbase.h
changeset 0 5a93021fdf25
equal deleted inserted replaced
-1:000000000000 0:5a93021fdf25
       
     1 /*
       
     2 * Copyright (c) 2004 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 CReaderBase.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef READER_BASE_H
       
    22 #define READER_BASE_H
       
    23 
       
    24 
       
    25 // INCLUDE FILES
       
    26 #include <e32base.h>
       
    27 #include <f32file.h>
       
    28 #include <flogger.h>
       
    29 
       
    30 #include "cdccommon.h"
       
    31 #include "cdcerrors.h"
       
    32 #include "cdctagcontainer.h"
       
    33 
       
    34 // CLASS DECLARATION
       
    35 
       
    36 /**
       
    37 * CReaderBase.
       
    38 * Base class for XML and CSV reader.
       
    39 */
       
    40 class CReaderBase : public CBase
       
    41     {
       
    42     
       
    43     public:
       
    44         /**
       
    45         * Destructor.
       
    46         */
       
    47         virtual ~CReaderBase();
       
    48         
       
    49     protected:
       
    50 
       
    51         /**
       
    52         * Default constructor.
       
    53         * @param TDbCreatorInputFile input file type (csv or xml)
       
    54         * @param TDbCreatorFeatures feature type - relevant in case 
       
    55         * of csv input as feature is not detected by the reader.
       
    56         */
       
    57         CReaderBase( TDbCreatorInputFile aFileType, 
       
    58                      TDbCreatorFeatures aFeature );
       
    59         
       
    60         /**
       
    61         * Second phase constructor. Leaves on failure.
       
    62         * @param aInFileName Name of the input file.
       
    63         */
       
    64         void ConstructL( const TDesC& aInFileName );
       
    65         
       
    66     public:
       
    67     
       
    68         /**
       
    69         * Locates the next feature in input file.
       
    70         */
       
    71         virtual void LocateFeatureL() = 0;
       
    72            
       
    73         /**
       
    74         * Gives back the next line from the given buffer.
       
    75         * @return EFalse if the end of buffer is accessed, ETrue otherwise.
       
    76         */
       
    77         virtual TBool LocateAPL() = 0;
       
    78         
       
    79         /**
       
    80         * Parses a line of the input file.
       
    81         */
       
    82         virtual void ParseAPL() = 0;
       
    83         
       
    84         /**
       
    85         * Resets the actual file position to the beginning of the file.
       
    86         * @return One of the system-wide error codes if reset failed.
       
    87         */
       
    88         virtual TInt Reset() = 0;
       
    89            
       
    90         /**
       
    91         * Writes log to the log file.
       
    92         */
       
    93         virtual void ToDoLog() = 0;
       
    94         
       
    95         /**
       
    96         * Returns reference to the TagContainer
       
    97         * @return CTagContainer
       
    98         */
       
    99         CTagContainer& TagContainer();
       
   100         
       
   101         /**
       
   102         * Returns reference to the input file
       
   103         * @return RFile
       
   104         */   
       
   105         RFile& InputFile();
       
   106         
       
   107         /**
       
   108         * Returns reference to the logger
       
   109         * @return RFileLogger
       
   110         */   
       
   111         RFileLogger& FileLogger();
       
   112         
       
   113         /**
       
   114         * Checks if filed ID is read from the input file (otherwise it is 
       
   115         * calculated by reader according to the index of the tag)
       
   116         * @return TRUE if reader reads the field id
       
   117         */
       
   118         TBool FieldIDPresent();
       
   119         
       
   120         /**
       
   121         * Returns the feature currently being parsed
       
   122         * @return TDbCreatorFeatures
       
   123         *    - EFeatureNone    - No feature found
       
   124         *    - EFeatureAP      - Internet access point
       
   125         *    - EFeatureWLAN    - WLAN access point
       
   126         *    - EFeatureVPN     - VPN access point
       
   127         */
       
   128         TDbCreatorFeatures CurrentFeature();
       
   129 
       
   130     protected:
       
   131         // @var marks the found feature that is being processed
       
   132         TDbCreatorFeatures    iCurrentFeature;
       
   133                                             
       
   134     private:
       
   135     
       
   136         // @var contains the values read from input file
       
   137         CTagContainer*        iTagContainer;      
       
   138         // @var for file handling.                                
       
   139         RFs                   iFs;
       
   140         // @var Input file.
       
   141         RFile                 iInputFile; 
       
   142         // @var Log file.
       
   143         RFileLogger           iLogFile; 
       
   144         // @var Input file type
       
   145         TDbCreatorInputFile   iFileType;  
       
   146     
       
   147     };
       
   148 
       
   149 
       
   150 
       
   151 #endif // READER_BASE_H
       
   152 
       
   153 // End of File.