xml/legacyminidomparser/XMLParser/INC/GMXMLFileDataSource.h
changeset 34 c7e9f1c97567
parent 25 417699dc19c9
child 36 172b09aa4eb6
equal deleted inserted replaced
25:417699dc19c9 34:c7e9f1c97567
     1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // GMXMLFILEDDATASOURCE.H
       
    15 // This file contains the declaration of the specific CMDXMLParserFileDataSource class
       
    16 // which is used by the XML Parser when the file based API is used.
       
    17 // 
       
    18 //
       
    19 
       
    20 /**
       
    21  @file
       
    22 */
       
    23 
       
    24 
       
    25 #ifndef __GMXMLFILEDATASOURCE_H__
       
    26 #define __GMXMLFILEDATASOURCE_H__
       
    27 
       
    28 class CMDXMLParserFileDataSource : public CBase, public MMDXMLParserDataProvider
       
    29 	{
       
    30 public:
       
    31 	virtual void GetData(TPtrC8 &aPtr, TRequestStatus &aStatus);
       
    32 	virtual void Disconnect();
       
    33 
       
    34 	/** Creates and Initialises the data provider with a specified XML file.
       
    35 	
       
    36 	@param aRFs File server session
       
    37 	@param aFileToParse The file name to parse
       
    38 	*/
       
    39 	static CMDXMLParserFileDataSource *NewL(RFs aRFs, const TDesC& aFileToParse);
       
    40 	static CMDXMLParserFileDataSource *NewLC(RFs aRFs, const TDesC& aFileToParse);
       
    41 
       
    42 	static CMDXMLParserFileDataSource* NewL(RFile& aFileHandleToParse);
       
    43 
       
    44 	~CMDXMLParserFileDataSource();
       
    45 
       
    46 private:
       
    47 	CMDXMLParserFileDataSource();
       
    48 
       
    49 	/** Second phase constructor.
       
    50 	*/
       
    51 	void ConstructL(RFs aRFs, const TDesC& aFileToParse);
       
    52 	
       
    53 	void ConstructL(RFile& aFileHandleToParse);
       
    54 
       
    55 private:
       
    56 
       
    57 	enum EInternalState
       
    58 	{
       
    59 		KInit = 0,
       
    60 		KDataSent,
       
    61 		KDone,
       
    62 		KError
       
    63 	};
       
    64 
       
    65 	TInt  iState;
       
    66 	RFile iXMLFile;
       
    67 	HBufC8* iXMLFileBuffer;
       
    68 	};
       
    69 
       
    70 #endif