xml/xmldomandxpath/src/xmlenginedom/xmlengfileoutputstream.cpp
changeset 0 e35f40988205
equal deleted inserted replaced
-1:000000000000 0:e35f40988205
       
     1 // Copyright (c) 2006-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 // Text node functions
       
    15 //
       
    16 
       
    17 #include <bafl/sysutil.h>
       
    18 #include "xmlengfileoutputstream.h"
       
    19 
       
    20 TInt TXmlEngFileOutputStream::Write(const TDesC8 &aBuffer)
       
    21 	{
       
    22 	TRAP(iError,WriteL(aBuffer));
       
    23 	if(iError)
       
    24 	    {
       
    25     	return -1;
       
    26 	    }
       
    27 	return aBuffer.Size();
       
    28 	};
       
    29 	
       
    30 TInt TXmlEngFileOutputStream::Close()
       
    31 	{
       
    32 	return KErrNone;
       
    33 	}
       
    34 	
       
    35 TInt TXmlEngFileOutputStream::CheckError()
       
    36     {
       
    37     return iError;
       
    38     }
       
    39 	
       
    40 TXmlEngFileOutputStream::TXmlEngFileOutputStream(RFile& aFile,RFs& aRFs)
       
    41 	{
       
    42 	TDriveInfo drInfo;
       
    43 	iError = aFile.Drive(iDrive, drInfo);			
       
    44 	iFile = aFile;
       
    45 	iRFs = aRFs;
       
    46 	}
       
    47    
       
    48 void TXmlEngFileOutputStream::WriteL(const TDesC8 &aBuffer)
       
    49 	{
       
    50 	if(SysUtil::DiskSpaceBelowCriticalLevelL(&iRFs, aBuffer.Size(), iDrive))
       
    51 		{
       
    52 		User::Leave(KErrDiskFull);
       
    53 		}
       
    54 	User::LeaveIfError(iFile.Write(aBuffer));
       
    55 	}
       
    56