dbcreator/commsdatcreator/Src/cdcreaderbase.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 04 Oct 2010 00:43:42 +0300
changeset 66 ed07dcc72692
parent 0 5a93021fdf25
permissions -rw-r--r--
Revision: 201038 Kit: 201039

/*
* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). 
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:   Implementation of the class CReaderBase
*
*/




// INCLUDE FILES

#include "cdcreaderbase.h"
#include "cdclogger.h"

#include "cdcerrors.h"
#include "cdccommon.h"

// CONSTANTS

// ================= MEMBER FUNCTIONS =======================

//---------------------------------------------------------
// Constructor & Destructor
//---------------------------------------------------------
//
CReaderBase::~CReaderBase()
    {
    CLOSE_LOG;
    //no implementation required
    delete iTagContainer;
    
    iInputFile.Close();
    iFs.Close();
    }
    
    
CReaderBase::CReaderBase( TDbCreatorInputFile aFileType,
                          TDbCreatorFeatures aFeature ):
    iCurrentFeature( aFeature ),
    iTagContainer( NULL ),
    iFileType( aFileType )
    {
        //no implementation required
    }

// ---------------------------------------------------------
// CProcessorBase::ConstructL
// ---------------------------------------------------------
//
void CReaderBase::ConstructL( const TDesC& aInFileName )
    {
    User::LeaveIfError( iFs.Connect() );

    TInt error( iInputFile.Open( iFs, aInFileName,
                        EFileShareReadersOnly | EFileStream | EFileRead ) );
                        
    if ( error == KErrNotFound )
        {
        User::Leave( KErrNotFound );
        }
    else if ( error )
        {
        User::Leave( KErrFileCannotBeOpened );
        }
    else
        {
        //nothing to do    
        }
    
    ////iFs.MkDirAll( KFullLogDir );

    CREATE_LOG;

    ////User::LeaveIfError( iLogFile.Connect() );
    ////iLogFile.CreateLog( KLogDir, KLogFile , EFileLoggingModeAppend );
    
       iTagContainer = CTagContainer::NewL();
    }
    
    
// ---------------------------------------------------------
// CProcessorBase::TagContainer
// ---------------------------------------------------------
//
CTagContainer& CReaderBase::TagContainer()
    {
    return *iTagContainer;
    }
    
    
// ---------------------------------------------------------
// CProcessorBase::InputFile
// ---------------------------------------------------------
//
RFile& CReaderBase::InputFile()
    {
    return iInputFile;
    }


// ---------------------------------------------------------
// CProcessorBase::FileLogger
// ---------------------------------------------------------
//
RFileLogger& CReaderBase::FileLogger()
    {
    return iLogFile;    
    }


// ---------------------------------------------------------
// CProcessorBase::FieldIDPresent
// ---------------------------------------------------------
//
TBool CReaderBase::FieldIDPresent()
    {
    return ( iFileType == EFileXML );    
    }

    
// ---------------------------------------------------------
// CProcessorBase::CurrentFeature
// ---------------------------------------------------------
//
TDbCreatorFeatures CReaderBase::CurrentFeature()
    {
    return iCurrentFeature;    
    }
    
//End of file