Panda3D
Public Member Functions | Static Public Member Functions
VirtualFileMountMultifile Class Reference

Maps a Multifile's contents into the VirtualFileSystem. More...

#include "virtualFileMountMultifile.h"

Inheritance diagram for VirtualFileMountMultifile:
VirtualFileMount TypedReferenceCount TypedObject ReferenceCount MemoryBase MemoryBase

List of all members.

Public Member Functions

 VirtualFileMountMultifile (Multifile *multifile)
virtual TypeHandle force_init_type ()
virtual off_t get_file_size (const Filename &file, istream *stream) const
 Returns the current size on disk (or wherever it is) of the already-open file.
virtual off_t get_file_size (const Filename &file) const
 Returns the current size on disk (or wherever it is) of the file before it has been opened.
Multifileget_multifile () const
 Returns the Multifile pointer that this mount object is based on.
virtual bool get_system_info (const Filename &file, SubfileInfo &info)
 Populates the SubfileInfo structure with the data representing where the file actually resides on disk, if this is knowable.
virtual time_t get_timestamp (const Filename &file) const
 Returns a time_t value that represents the time the file was last modified, to within whatever precision the operating system records this information (on a Windows95 system, for instance, this may only be accurate to within 2 seconds).
virtual TypeHandle get_type () const
virtual bool has_file (const Filename &file) const
 Returns true if the indicated file exists within the mount system.
virtual bool is_directory (const Filename &file) const
 Returns true if the indicated file exists within the mount system and is a directory.
virtual bool is_regular_file (const Filename &file) const
 Returns true if the indicated file exists within the mount system and is a regular file.
virtual istream * open_read_file (const Filename &file) const
 Opens the file for reading, if it exists.
virtual void output (ostream &out) const
virtual bool read_file (const Filename &file, bool do_uncompress, pvector< unsigned char > &result) const
 Fills up the indicated pvector with the contents of the file, if it is a regular file.
virtual bool scan_directory (vector_string &contents, const Filename &dir) const
 Fills the given vector up with the list of filenames that are local to this directory, if the filename is a directory.

Static Public Member Functions

static TypeHandle get_class_type ()
static void init_type ()
 This function is declared non-inline to work around a compiler bug in g++ 2.96.

Detailed Description

Maps a Multifile's contents into the VirtualFileSystem.

Definition at line 29 of file virtualFileMountMultifile.h.


Member Function Documentation

off_t VirtualFileMountMultifile::get_file_size ( const Filename file,
istream *  stream 
) const [virtual]

Returns the current size on disk (or wherever it is) of the already-open file.

Pass in the stream that was returned by open_read_file(); some implementations may require this stream to determine the size.

Implements VirtualFileMount.

Definition at line 128 of file virtualFileMountMultifile.cxx.

off_t VirtualFileMountMultifile::get_file_size ( const Filename file) const [virtual]

Returns the current size on disk (or wherever it is) of the file before it has been opened.

Implements VirtualFileMount.

Definition at line 143 of file virtualFileMountMultifile.cxx.

Returns the Multifile pointer that this mount object is based on.

Definition at line 34 of file virtualFileMountMultifile.I.

Referenced by VirtualFileSystem::unmount().

bool VirtualFileMountMultifile::get_system_info ( const Filename file,
SubfileInfo info 
) [virtual]

Populates the SubfileInfo structure with the data representing where the file actually resides on disk, if this is knowable.

Returns true if the file might reside on disk, and the info is populated, or false if it might not (or it is not known where the file resides), in which case the info is meaningless.

Reimplemented from VirtualFileMount.

Definition at line 185 of file virtualFileMountMultifile.cxx.

time_t VirtualFileMountMultifile::get_timestamp ( const Filename file) const [virtual]

Returns a time_t value that represents the time the file was last modified, to within whatever precision the operating system records this information (on a Windows95 system, for instance, this may only be accurate to within 2 seconds).

If the timestamp cannot be determined, either because it is not supported by the operating system or because there is some error (such as file not found), returns 0.

Implements VirtualFileMount.

Definition at line 166 of file virtualFileMountMultifile.cxx.

bool VirtualFileMountMultifile::has_file ( const Filename file) const [virtual]

Returns true if the indicated file exists within the mount system.

Implements VirtualFileMount.

Definition at line 38 of file virtualFileMountMultifile.cxx.

static void VirtualFileMountMultifile::init_type ( ) [inline, static]

This function is declared non-inline to work around a compiler bug in g++ 2.96.

Making it inline seems to cause problems in the optimizer.

Reimplemented from VirtualFileMount.

Definition at line 67 of file virtualFileMountMultifile.h.

References VirtualFileMount::init_type().

bool VirtualFileMountMultifile::is_directory ( const Filename file) const [virtual]

Returns true if the indicated file exists within the mount system and is a directory.

Implements VirtualFileMount.

Definition at line 51 of file virtualFileMountMultifile.cxx.

bool VirtualFileMountMultifile::is_regular_file ( const Filename file) const [virtual]

Returns true if the indicated file exists within the mount system and is a regular file.

Implements VirtualFileMount.

Definition at line 62 of file virtualFileMountMultifile.cxx.

istream * VirtualFileMountMultifile::open_read_file ( const Filename file) const [virtual]

Opens the file for reading, if it exists.

Returns a newly allocated istream on success (which you should eventually delete when you are done reading). Returns NULL on failure.

Implements VirtualFileMount.

Definition at line 105 of file virtualFileMountMultifile.cxx.

bool VirtualFileMountMultifile::read_file ( const Filename file,
bool  do_uncompress,
pvector< unsigned char > &  result 
) const [virtual]

Fills up the indicated pvector with the contents of the file, if it is a regular file.

Returns true on success, false otherwise.

Reimplemented from VirtualFileMount.

Definition at line 74 of file virtualFileMountMultifile.cxx.

bool VirtualFileMountMultifile::scan_directory ( vector_string &  contents,
const Filename dir 
) const [virtual]

Fills the given vector up with the list of filenames that are local to this directory, if the filename is a directory.

Returns true if successful, or false if the file is not a directory or cannot be read.

Implements VirtualFileMount.

Definition at line 215 of file virtualFileMountMultifile.cxx.


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations