dbcreator/commsdatcreator/Src/cdcreaderbase.cpp
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:   Implementation of the class CReaderBase
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 
       
    23 #include "cdcreaderbase.h"
       
    24 #include "cdclogger.h"
       
    25 
       
    26 #include "cdcerrors.h"
       
    27 #include "cdccommon.h"
       
    28 
       
    29 // CONSTANTS
       
    30 
       
    31 // ================= MEMBER FUNCTIONS =======================
       
    32 
       
    33 //---------------------------------------------------------
       
    34 // Constructor & Destructor
       
    35 //---------------------------------------------------------
       
    36 //
       
    37 CReaderBase::~CReaderBase()
       
    38     {
       
    39     CLOSE_LOG;
       
    40     //no implementation required
       
    41     delete iTagContainer;
       
    42     
       
    43     iInputFile.Close();
       
    44     iFs.Close();
       
    45     }
       
    46     
       
    47     
       
    48 CReaderBase::CReaderBase( TDbCreatorInputFile aFileType,
       
    49                           TDbCreatorFeatures aFeature ):
       
    50     iCurrentFeature( aFeature ),
       
    51     iTagContainer( NULL ),
       
    52     iFileType( aFileType )
       
    53     {
       
    54         //no implementation required
       
    55     }
       
    56 
       
    57 // ---------------------------------------------------------
       
    58 // CProcessorBase::ConstructL
       
    59 // ---------------------------------------------------------
       
    60 //
       
    61 void CReaderBase::ConstructL( const TDesC& aInFileName )
       
    62     {
       
    63     User::LeaveIfError( iFs.Connect() );
       
    64 
       
    65     TInt error( iInputFile.Open( iFs, aInFileName,
       
    66                         EFileShareReadersOnly | EFileStream | EFileRead ) );
       
    67                         
       
    68     if ( error == KErrNotFound )
       
    69         {
       
    70         User::Leave( KErrNotFound );
       
    71         }
       
    72     else if ( error )
       
    73         {
       
    74         User::Leave( KErrFileCannotBeOpened );
       
    75         }
       
    76     else
       
    77         {
       
    78         //nothing to do    
       
    79         }
       
    80     
       
    81     ////iFs.MkDirAll( KFullLogDir );
       
    82 
       
    83     CREATE_LOG;
       
    84 
       
    85     ////User::LeaveIfError( iLogFile.Connect() );
       
    86     ////iLogFile.CreateLog( KLogDir, KLogFile , EFileLoggingModeAppend );
       
    87     
       
    88        iTagContainer = CTagContainer::NewL();
       
    89     }
       
    90     
       
    91     
       
    92 // ---------------------------------------------------------
       
    93 // CProcessorBase::TagContainer
       
    94 // ---------------------------------------------------------
       
    95 //
       
    96 CTagContainer& CReaderBase::TagContainer()
       
    97     {
       
    98     return *iTagContainer;
       
    99     }
       
   100     
       
   101     
       
   102 // ---------------------------------------------------------
       
   103 // CProcessorBase::InputFile
       
   104 // ---------------------------------------------------------
       
   105 //
       
   106 RFile& CReaderBase::InputFile()
       
   107     {
       
   108     return iInputFile;
       
   109     }
       
   110 
       
   111 
       
   112 // ---------------------------------------------------------
       
   113 // CProcessorBase::FileLogger
       
   114 // ---------------------------------------------------------
       
   115 //
       
   116 RFileLogger& CReaderBase::FileLogger()
       
   117     {
       
   118     return iLogFile;    
       
   119     }
       
   120 
       
   121 
       
   122 // ---------------------------------------------------------
       
   123 // CProcessorBase::FieldIDPresent
       
   124 // ---------------------------------------------------------
       
   125 //
       
   126 TBool CReaderBase::FieldIDPresent()
       
   127     {
       
   128     return ( iFileType == EFileXML );    
       
   129     }
       
   130 
       
   131     
       
   132 // ---------------------------------------------------------
       
   133 // CProcessorBase::CurrentFeature
       
   134 // ---------------------------------------------------------
       
   135 //
       
   136 TDbCreatorFeatures CReaderBase::CurrentFeature()
       
   137     {
       
   138     return iCurrentFeature;    
       
   139     }
       
   140     
       
   141 //End of file