Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics
[Home] [Tutorials] [All Classes] [Grouped Classes]
Public Member Functions | Protected Member Functions | Protected Attributes

vl::VirtualFile Class Reference

An abstract class representing a file. More...

#include <VirtualFile.hpp>

Inheritance diagram for vl::VirtualFile:
vl::Object vl::DiskFile vl::GZipCodec vl::MemoryFile vl::ZippedFile

List of all members.

Public Member Functions

virtual const char * className ()
 Returns the name of the class.
 VirtualFile ()
 Constructor.
unsigned int crc32 ()
 Computes the crc32 of the entire file.
MD5CheckSum md5 ()
 Computes the md5 of the entire file.
virtual bool open (EOpenMode mode)=0
 Opens the file in the specified mode.
virtual bool isOpen () const =0
 Returns true if the file has been opened.
virtual bool exists () const =0
 Returns true if the file exists.
virtual void close ()=0
 Closes the file.
virtual long long size () const =0
 Returns the size of the file in bytes.
virtual ref< VirtualFileclone () const =0
 Creates a clone of this class instance.
VirtualFileoperator= (const VirtualFile &other)
const Stringpath () const
 Returns the path of the file.
void setPath (const String &name)
 Changes the path bound to a VirtualFile. Use carefully this function, you shouldn't rename a VirtualFile managed by a VirtualDirectory.
long long peek (void *buffer, long long byte_count)
 Reads byte_count bytes and returns to the original position.
long long read (void *buffer, long long byte_count)
 Reads byte_count bytes from a file. Returns the number of bytes actually read.
long long write (const void *buffer, long long byte_count)
 Writes byte_count bytes to a file. Returns the number of bytes actually written.
long long position () const
 Returns the current position in the file.
bool seekSet (long long offset)
 Changes the current read/write position of a file.
bool seekCur (long long offset)
 Changes the current read/write position of a file.
bool seekEnd (long long offset)
 Changes the current read/write position of a file.
bool endOfFile () const
 Returns true if position() >= size()
long long load (std::vector< unsigned char > &data)
 Loads the entire file in the specified vector.
long long load (void *buffer, long long max=-1)
 Loads the entire file in the specified buffer.
double readDouble (bool little_endian_data=true)
 Reads single entry.
float readFloat (bool little_endian_data=true)
 Reads single entry.
unsigned long long readUInt64 (bool little_endian_data=true)
 Reads single entry.
long long readSInt64 (bool little_endian_data=true)
 Reads single entry.
unsigned int readUInt32 (bool little_endian_data=true)
 Reads single entry.
int readSInt32 (bool little_endian_data=true)
 Reads single entry.
unsigned short readUInt16 (bool little_endian_data=true)
 Reads single entry.
short readSInt16 (bool little_endian_data=true)
 Reads single entry.
unsigned char readUInt8 ()
 Reads single entry.
char readSInt8 ()
 Reads single entry.
long long readDouble (double *buffer, long long count, bool little_endian_data=true)
 Reads multiple entries. Returns the number of bytes read.
long long readFloat (float *buffer, long long count, bool little_endian_data=true)
 Reads multiple entries. Returns the number of bytes read.
long long readUInt64 (unsigned long long *buffer, long long count, bool little_endian_data=true)
 Reads multiple entries. Returns the number of bytes read.
long long readSInt64 (long long *buffer, long long count, bool little_endian_data=true)
 Reads multiple entries. Returns the number of bytes read.
long long readUInt32 (unsigned int *buffer, long long count, bool little_endian_data=true)
 Reads multiple entries. Returns the number of bytes read.
long long readSInt32 (int *buffer, long long count, bool little_endian_data=true)
 Reads multiple entries. Returns the number of bytes read.
long long readUInt16 (unsigned short *buffer, long long count, bool little_endian_data=true)
 Reads multiple entries. Returns the number of bytes read.
long long readSInt16 (short *buffer, long long count, bool little_endian_data=true)
 Reads multiple entries. Returns the number of bytes read.
long long readUInt8 (unsigned char *buffer, long long count)
 Reads multiple entries. Returns the number of bytes read.
long long readSInt8 (char *buffer, long long count)
 Reads multiple entries. Returns the number of bytes read.
long long writeDouble (double data, bool little_endian_data=true)
 Writes a single entry. Returns the number of bytes written.
long long writeFloat (float data, bool little_endian_data=true)
 Writes a single entry. Returns the number of bytes written.
long long writeUInt64 (unsigned long long data, bool little_endian_data=true)
 Writes a single entry. Returns the number of bytes written.
long long writeSInt64 (long long data, bool little_endian_data=true)
 Writes a single entry. Returns the number of bytes written.
long long writeUInt32 (unsigned int data, bool little_endian_data=true)
 Writes a single entry. Returns the number of bytes written.
long long writeSInt32 (int data, bool little_endian_data=true)
 Writes a single entry. Returns the number of bytes written.
long long writeUInt16 (unsigned short data, bool little_endian_data=true)
 Writes a single entry. Returns the number of bytes written.
long long writeSInt16 (short data, bool little_endian_data=true)
 Writes a single entry. Returns the number of bytes written.
long long writeUInt8 (unsigned char data)
 Writes a single entry. Returns the number of bytes written.
long long writeSInt8 (char data)
 Writes a single entry. Returns the number of bytes written.
long long writeDouble (const double *buffer, long long count, bool little_endian_data=true)
 Writes multiple entries. Returns the number of bytes written.
long long writeFloat (const float *buffer, long long count, bool little_endian_data=true)
 Writes multiple entries. Returns the number of bytes written.
long long writeUInt64 (const unsigned long long *buffer, long long count, bool little_endian_data=true)
 Writes multiple entries. Returns the number of bytes written.
long long writeSInt64 (const long long *buffer, long long count, bool little_endian_data=true)
 Writes multiple entries. Returns the number of bytes written.
long long writeUInt32 (const unsigned int *buffer, long long count, bool little_endian_data=true)
 Writes multiple entries. Returns the number of bytes written.
long long writeSInt32 (const int *buffer, long long count, bool little_endian_data=true)
 Writes multiple entries. Returns the number of bytes written.
long long writeUInt16 (const unsigned short *buffer, long long count, bool little_endian_data=true)
 Writes multiple entries. Returns the number of bytes written.
long long writeSInt16 (const short *buffer, long long count, bool little_endian_data=true)
 Writes multiple entries. Returns the number of bytes written.
long long writeUInt8 (const unsigned char *buffer, long long count)
 Writes multiple entries. Returns the number of bytes written.
long long writeSInt8 (const char *buffer, long long count)
 Writes multiple entries. Returns the number of bytes written.

Protected Member Functions

 VirtualFile (const VirtualFile &other)
virtual long long read_Implementation (void *buffer, long long byte_count)=0
virtual long long write_Implementation (const void *buffer, long long byte_count)=0
virtual long long position_Implementation () const =0
virtual bool seekSet_Implementation (long long offset)=0
long long write64 (const void *buffer, long long count, bool little_endian_data=true)
long long write32 (const void *buffer, long long count, bool little_endian_data=true)
long long write16 (const void *buffer, long long count, bool little_endian_data=true)
long long read64 (void *buffer, long long count, bool little_endian_data=true)
long long read32 (void *buffer, long long count, bool little_endian_data=true)
long long read16 (void *buffer, long long count, bool little_endian_data=true)
long long write64 (const void *buffer, bool little_endian_data=true)
long long write32 (const void *buffer, bool little_endian_data=true)
long long write16 (const void *buffer, bool little_endian_data=true)
long long read64 (void *buffer, bool little_endian_data=true)
long long read32 (void *buffer, bool little_endian_data=true)
long long read16 (void *buffer, bool little_endian_data=true)

Protected Attributes

String mPath

Detailed Description

An abstract class representing a file.

See also:

Constructor & Destructor Documentation

vl::VirtualFile::VirtualFile ( const VirtualFile other ) [inline, protected]
vl::VirtualFile::VirtualFile (  ) [inline]

Constructor.


Member Function Documentation

virtual const char* vl::VirtualFile::className (  ) [inline, virtual]

Returns the name of the class.

Reimplemented from vl::Object.

Reimplemented in vl::DiskFile, vl::GZipCodec, vl::MemoryFile, and vl::ZippedFile.

unsigned int VirtualFile::crc32 (  )

Computes the crc32 of the entire file.

MD5CheckSum VirtualFile::md5 (  )

Computes the md5 of the entire file.

virtual bool vl::VirtualFile::open ( EOpenMode  mode ) [pure virtual]

Opens the file in the specified mode.

Implemented in vl::DiskFile, vl::GZipCodec, vl::MemoryFile, and vl::ZippedFile.

virtual bool vl::VirtualFile::isOpen (  ) const [pure virtual]

Returns true if the file has been opened.

Implemented in vl::DiskFile, vl::GZipCodec, vl::MemoryFile, and vl::ZippedFile.

virtual bool vl::VirtualFile::exists (  ) const [pure virtual]

Returns true if the file exists.

Implemented in vl::DiskFile, vl::GZipCodec, vl::MemoryFile, and vl::ZippedFile.

virtual void vl::VirtualFile::close (  ) [pure virtual]

Closes the file.

Implemented in vl::DiskFile, vl::GZipCodec, vl::MemoryFile, and vl::ZippedFile.

virtual long long vl::VirtualFile::size (  ) const [pure virtual]

Returns the size of the file in bytes.

Implemented in vl::DiskFile, vl::GZipCodec, vl::MemoryFile, and vl::ZippedFile.

virtual ref<VirtualFile> vl::VirtualFile::clone (  ) const [pure virtual]

Creates a clone of this class instance.

Implemented in vl::DiskFile, vl::GZipCodec, vl::MemoryFile, and vl::ZippedFile.

VirtualFile& vl::VirtualFile::operator= ( const VirtualFile other ) [inline]
const String& vl::VirtualFile::path (  ) const [inline]

Returns the path of the file.

void vl::VirtualFile::setPath ( const String name ) [inline]

Changes the path bound to a VirtualFile. Use carefully this function, you shouldn't rename a VirtualFile managed by a VirtualDirectory.

long long VirtualFile::peek ( void *  buffer,
long long  byte_count 
)

Reads byte_count bytes and returns to the original position.

Returns the number of bytes read.

long long VirtualFile::read ( void *  buffer,
long long  byte_count 
)

Reads byte_count bytes from a file. Returns the number of bytes actually read.

long long VirtualFile::write ( const void *  buffer,
long long  byte_count 
)

Writes byte_count bytes to a file. Returns the number of bytes actually written.

long long VirtualFile::position (  ) const

Returns the current position in the file.

bool VirtualFile::seekSet ( long long  offset )

Changes the current read/write position of a file.

bool VirtualFile::seekCur ( long long  offset )

Changes the current read/write position of a file.

bool VirtualFile::seekEnd ( long long  offset )

Changes the current read/write position of a file.

bool vl::VirtualFile::endOfFile (  ) const [inline]

Returns true if position() >= size()

long long VirtualFile::load ( std::vector< unsigned char > &  data )

Loads the entire file in the specified vector.

Returns the number of bytes read. The file must be closed before calling this function.

long long VirtualFile::load ( void *  buffer,
long long  max = -1 
)

Loads the entire file in the specified buffer.

Returns the number of bytes read. The file must be closed before calling this function.

double VirtualFile::readDouble ( bool  little_endian_data = true )

Reads single entry.

float VirtualFile::readFloat ( bool  little_endian_data = true )

Reads single entry.

unsigned long long VirtualFile::readUInt64 ( bool  little_endian_data = true )

Reads single entry.

long long VirtualFile::readSInt64 ( bool  little_endian_data = true )

Reads single entry.

unsigned int VirtualFile::readUInt32 ( bool  little_endian_data = true )

Reads single entry.

int VirtualFile::readSInt32 ( bool  little_endian_data = true )

Reads single entry.

unsigned short VirtualFile::readUInt16 ( bool  little_endian_data = true )

Reads single entry.

short VirtualFile::readSInt16 ( bool  little_endian_data = true )

Reads single entry.

unsigned char VirtualFile::readUInt8 (  )

Reads single entry.

char VirtualFile::readSInt8 (  )

Reads single entry.

long long VirtualFile::readDouble ( double *  buffer,
long long  count,
bool  little_endian_data = true 
)

Reads multiple entries. Returns the number of bytes read.

long long VirtualFile::readFloat ( float *  buffer,
long long  count,
bool  little_endian_data = true 
)

Reads multiple entries. Returns the number of bytes read.

long long VirtualFile::readUInt64 ( unsigned long long *  buffer,
long long  count,
bool  little_endian_data = true 
)

Reads multiple entries. Returns the number of bytes read.

long long VirtualFile::readSInt64 ( long long *  buffer,
long long  count,
bool  little_endian_data = true 
)

Reads multiple entries. Returns the number of bytes read.

long long VirtualFile::readUInt32 ( unsigned int *  buffer,
long long  count,
bool  little_endian_data = true 
)

Reads multiple entries. Returns the number of bytes read.

long long VirtualFile::readSInt32 ( int *  buffer,
long long  count,
bool  little_endian_data = true 
)

Reads multiple entries. Returns the number of bytes read.

long long VirtualFile::readUInt16 ( unsigned short *  buffer,
long long  count,
bool  little_endian_data = true 
)

Reads multiple entries. Returns the number of bytes read.

long long VirtualFile::readSInt16 ( short *  buffer,
long long  count,
bool  little_endian_data = true 
)

Reads multiple entries. Returns the number of bytes read.

long long VirtualFile::readUInt8 ( unsigned char *  buffer,
long long  count 
)

Reads multiple entries. Returns the number of bytes read.

long long VirtualFile::readSInt8 ( char *  buffer,
long long  count 
)

Reads multiple entries. Returns the number of bytes read.

long long VirtualFile::writeDouble ( double  data,
bool  little_endian_data = true 
)

Writes a single entry. Returns the number of bytes written.

long long VirtualFile::writeFloat ( float  data,
bool  little_endian_data = true 
)

Writes a single entry. Returns the number of bytes written.

long long VirtualFile::writeUInt64 ( unsigned long long  data,
bool  little_endian_data = true 
)

Writes a single entry. Returns the number of bytes written.

long long VirtualFile::writeSInt64 ( long long  data,
bool  little_endian_data = true 
)

Writes a single entry. Returns the number of bytes written.

long long VirtualFile::writeUInt32 ( unsigned int  data,
bool  little_endian_data = true 
)

Writes a single entry. Returns the number of bytes written.

long long VirtualFile::writeSInt32 ( int  data,
bool  little_endian_data = true 
)

Writes a single entry. Returns the number of bytes written.

long long VirtualFile::writeUInt16 ( unsigned short  data,
bool  little_endian_data = true 
)

Writes a single entry. Returns the number of bytes written.

long long VirtualFile::writeSInt16 ( short  data,
bool  little_endian_data = true 
)

Writes a single entry. Returns the number of bytes written.

long long VirtualFile::writeUInt8 ( unsigned char  data )

Writes a single entry. Returns the number of bytes written.

long long VirtualFile::writeSInt8 ( char  data )

Writes a single entry. Returns the number of bytes written.

long long VirtualFile::writeDouble ( const double *  buffer,
long long  count,
bool  little_endian_data = true 
)

Writes multiple entries. Returns the number of bytes written.

long long VirtualFile::writeFloat ( const float *  buffer,
long long  count,
bool  little_endian_data = true 
)

Writes multiple entries. Returns the number of bytes written.

long long VirtualFile::writeUInt64 ( const unsigned long long *  buffer,
long long  count,
bool  little_endian_data = true 
)

Writes multiple entries. Returns the number of bytes written.

long long VirtualFile::writeSInt64 ( const long long *  buffer,
long long  count,
bool  little_endian_data = true 
)

Writes multiple entries. Returns the number of bytes written.

long long VirtualFile::writeUInt32 ( const unsigned int *  buffer,
long long  count,
bool  little_endian_data = true 
)

Writes multiple entries. Returns the number of bytes written.

long long VirtualFile::writeSInt32 ( const int *  buffer,
long long  count,
bool  little_endian_data = true 
)

Writes multiple entries. Returns the number of bytes written.

long long VirtualFile::writeUInt16 ( const unsigned short *  buffer,
long long  count,
bool  little_endian_data = true 
)

Writes multiple entries. Returns the number of bytes written.

long long VirtualFile::writeSInt16 ( const short *  buffer,
long long  count,
bool  little_endian_data = true 
)

Writes multiple entries. Returns the number of bytes written.

long long VirtualFile::writeUInt8 ( const unsigned char *  buffer,
long long  count 
)

Writes multiple entries. Returns the number of bytes written.

long long VirtualFile::writeSInt8 ( const char *  buffer,
long long  count 
)

Writes multiple entries. Returns the number of bytes written.

virtual long long vl::VirtualFile::read_Implementation ( void *  buffer,
long long  byte_count 
) [protected, pure virtual]
virtual long long vl::VirtualFile::write_Implementation ( const void *  buffer,
long long  byte_count 
) [protected, pure virtual]
virtual long long vl::VirtualFile::position_Implementation (  ) const [protected, pure virtual]
virtual bool vl::VirtualFile::seekSet_Implementation ( long long  offset ) [protected, pure virtual]
long long VirtualFile::write64 ( const void *  buffer,
long long  count,
bool  little_endian_data = true 
) [protected]
long long VirtualFile::write32 ( const void *  buffer,
long long  count,
bool  little_endian_data = true 
) [protected]
long long VirtualFile::write16 ( const void *  buffer,
long long  count,
bool  little_endian_data = true 
) [protected]
long long VirtualFile::read64 ( void *  buffer,
long long  count,
bool  little_endian_data = true 
) [protected]
long long VirtualFile::read32 ( void *  buffer,
long long  count,
bool  little_endian_data = true 
) [protected]
long long VirtualFile::read16 ( void *  buffer,
long long  count,
bool  little_endian_data = true 
) [protected]
long long VirtualFile::write64 ( const void *  buffer,
bool  little_endian_data = true 
) [protected]
long long VirtualFile::write32 ( const void *  buffer,
bool  little_endian_data = true 
) [protected]
long long VirtualFile::write16 ( const void *  buffer,
bool  little_endian_data = true 
) [protected]
long long VirtualFile::read64 ( void *  buffer,
bool  little_endian_data = true 
) [protected]
long long VirtualFile::read32 ( void *  buffer,
bool  little_endian_data = true 
) [protected]
long long VirtualFile::read16 ( void *  buffer,
bool  little_endian_data = true 
) [protected]

Member Data Documentation


The documentation for this class was generated from the following files:

Visualization Library v2010.11.1123 Reference Documentation
Copyright 2005-2009 Michele Bosi. All rights reserved.
Updated on Thu Nov 18 2010 02:08:17.
Permission is granted to use this page to write and publish articles regarding Visualization Library.