Open GoogleCodeExporter opened 9 years ago
Also, here is an example of a custom file IO being used:
class PiCsvParser : public csv_parser, CsvParserFileSystem
{
public:
PiCsvParser( const char * filename, FileSystem::FileDomain domain )
{
if ( m_FileHandle = Pi.File.Open( filename, FileSystem::READ, domain ) != FileSystem::FileHandleInvalid )
{
init( this );
}
}
virtual ~PiCsvParser( )
{
if ( m_FileHandle )
{
Pi.File.Close( m_FileHandle );
m_FileHandle = FileSystem::FileHandleInvalid;
}
}
// CsvParserFileSystem implementation.
void Rewind( )
{
if ( m_FileHandle != FileSystem::FileHandleInvalid )
{
Pi.File.Seek( m_FileHandle, 0, FileSystem::START );
}
}
long Tell( )
{
if ( m_FileHandle != FileSystem::FileHandleInvalid )
{
return Pi.File.Tell( m_FileHandle );
}
return 0;
}
int GetC( )
{
return Pi.File.GetC( m_FileHandle );
}
int Seek( long offset, int origin )
{
return Pi.File.Seek( m_FileHandle, offset, ( FileSystem::FileSeekMode ) origin );
}
size_t Read( void * dstBuffer, size_t elementSize, size_t count )
{
return Pi.File.Read( dstBuffer, elementSize, count, m_FileHandle );
}
private:
FileSystem::FileHandle m_FileHandle;
};
Original comment by st...@pawprintgames.com
on 21 Aug 2014 at 9:09
Original issue reported on code.google.com by
st...@pawprintgames.com
on 21 Aug 2014 at 9:07Attachments: