Panda3D

Public Member Functions | Static Public Member Functions | List of all members
VirtualFileComposite Class Reference

A composite directory within the VirtualFileSystem: this maps to more than one directory on different mount points. More...

`#include "virtualFileComposite.h"`

Inheritance diagram for VirtualFileComposite:

## Public Member Functions
| VirtualFileComposite (VirtualFileSystem *file_system, const Filename &filename)
void | add_component (VirtualFile *file)
| Adds one more component to the composite directory. More...
virtual TypeHandle | force_init_type ()
virtual VirtualFileSystem * | get_file_system () const
| Returns the VirtualFileSystem this file is associated with. More...
virtual Filename | get_filename () const
| Returns the full pathname to this file within the virtual file system. More...
virtual TypeHandle | get_type () const
virtual bool | has_file () const
| Returns true if this file exists, false otherwise. More...
virtual bool | is_directory () const
| Returns true if this file represents a directory (and scan_directory() may be called), false otherwise. More...
Public Member Functions inherited from VirtualFile
virtual bool | atomic_compare_and_exchange_contents (std::string &orig_contents, const std::string &old_contents, const std::string &new_contents)
| See Filename::atomic_compare_and_exchange_contents(). More...
virtual bool | atomic_read_contents (std::string &contents) const
| See Filename::atomic_read_contents(). More...
virtual void | close_read_file (std::istream *stream) const
| Closes a file opened by a previous call to open_read_file(). More...
virtual void | close_read_write_file (std::iostream *stream)
| Closes a file opened by a previous call to open_read_write_file(). More...
virtual void | close_write_file (std::ostream *stream)
| Closes a file opened by a previous call to open_write_file(). More...
virtual bool | copy_file (VirtualFile *new_file)
| Attempts to copy the contents of this file to the indicated file. More...
virtual bool | delete_file ()
| Attempts to delete this file or directory. More...
virtual std::streamsize | get_file_size () const
| Returns the current size on disk (or wherever it is) of the file before it has been opened. More...
virtual std::streamsize | get_file_size (std::istream *stream) const
| Returns the current size on disk (or wherever it is) of the already-open file. More...
const Filename & | get_original_filename () const
| Returns the original filename as it was used to locate this VirtualFile. More...
virtual bool | get_system_info (SubfileInfo &info)
| Populates the SubfileInfo structure with the data representing where the file actually resides on disk, if this is knowable. More...
virtual time_t | get_timestamp () 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). More...
virtual bool | is_regular_file () const
| Returns true if this file represents a regular file (and read_file() may be called), false otherwise. More...
virtual bool | is_writable () const
| Returns true if this file may be written to, which implies write_file() may be called (unless it is a directory instead of a regular file). More...
void | ls (std::ostream &out=std::cout) const
| If the file represents a directory, lists its contents. More...
void | ls_all (std::ostream &out=std::cout) const
| If the file represents a directory, recursively lists its contents and those of all subdirectories. More...
virtual std::ostream * | open_append_file ()
| Works like open_write_file(), but the file is opened in append mode. More...
virtual std::iostream * | open_read_append_file ()
| Works like open_read_write_file(), but the file is opened in append mode. More...
virtual std::istream * | open_read_file (bool auto_unwrap) const
| Opens the file for reading. More...
virtual std::iostream * | open_read_write_file (bool truncate)
| Opens the file for writing. More...
virtual std::ostream * | open_write_file (bool auto_wrap, bool truncate)
| Opens the file for writing. More...
void | output (std::ostream &out) const
std::string | read_file (bool auto_unwrap) const
| Returns the entire contents of the file as a string. More...
bool | read_file (std::string &result, bool auto_unwrap) const
| Fills up the indicated string with the contents of the file, if it is a regular file. More...
virtual bool | read_file (vector_uchar &result, bool auto_unwrap) const
| Fills up the indicated pvector with the contents of the file, if it is a regular file. More...
virtual bool | rename_file (VirtualFile *new_file)
| Attempts to move or rename this file or directory. More...
PointerTo< VirtualFileList > | scan_directory () const
| If the file represents a directory (that is, is_directory() returns true), this returns the list of files within the directory at the current time. More...
void | set_original_filename (const Filename &filename)
| Stores the original filename that was used to locate this VirtualFile. More...
virtual bool | was_read_successful () const
| Call this method after a reading the istream returned by open_read_file() to completion. More...
bool | write_file (const std::string &data, bool auto_wrap)
| Writes the entire contents of the file as a string, if it is writable. More...
virtual bool | write_file (const unsigned char *data, size_t data_size, bool auto_wrap)
| Writes the indicated data to the file, if it is writable. More...
Public Member Functions inherited from TypedReferenceCount
| TypedReferenceCount (const TypedReferenceCount &copy)
void | operator= (const TypedReferenceCount &copy)
Public Member Functions inherited from TypedObject
| TypedObject (const TypedObject &copy)=default
TypedObject * | as_typed_object ()
| Returns the object, upcast (if necessary) to a TypedObject pointer. More...
const TypedObject * | as_typed_object () const
| Returns the object, upcast (if necessary) to a TypedObject pointer. More...
int | get_best_parent_from_Set (const std::set< int > &) const
int | get_type_index () const
| Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More...
bool | is_exact_type (TypeHandle handle) const
| Returns true if the current object is the indicated type exactly. More...
bool | is_of_type (TypeHandle handle) const
| Returns true if the current object is or derives from the indicated type. More...
TypedObject & | operator= (const TypedObject &copy)=default
Public Member Functions inherited from MemoryBase
void | operator delete (void *, void *)
void | operator delete (void *ptr)
void | operator delete[] (void *, void *)
void | operator delete[] (void *ptr)
void * | operator new (size_t size)
void * | operator new (size_t size, void *ptr)
void * | operator new[] (size_t size)
void * | operator new[] (size_t size, void *ptr)
Public Member Functions inherited from ReferenceCount
int | get_ref_count () const
WeakReferenceList * | get_weak_list () const
| Returns the WeakReferenceList associated with this ReferenceCount object. More...
bool | has_weak_list () const
| Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. More...
void | local_object ()
| This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. More...
void | ref () const
| Explicitly increments the reference count. More...
bool | ref_if_nonzero () const
| Atomically increases the reference count of this object if it is not zero. More...
bool | test_ref_count_integrity () const
| Does some easy checks to make sure that the reference count isn't completely bogus. More...
bool | test_ref_count_nonzero () const
| Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More...
virtual bool | unref () const
| Explicitly decrements the reference count. More...
bool | unref_if_one () const
| Atomically decreases the reference count of this object if it is one. More...
WeakReferenceList * | weak_ref ()
| Adds the indicated PointerToVoid as a weak reference to this object. More...
void | weak_unref ()
| Removes the indicated PointerToVoid as a weak reference to this object. More...

## Static Public Member Functions
static TypeHandle | get_class_type ()
static void | init_type ()
Static Public Member Functions inherited from VirtualFile
static TypeHandle | get_class_type ()
static void | init_type ()
static bool | simple_read_file (std::istream *stream, vector_uchar &result)
| Fills up the indicated pvector with the contents of the just-opened file. More...
static bool | simple_read_file (std::istream *stream, vector_uchar &result, size_t max_bytes)
| As in simple_read_file() with two parameters, above, but only reads up to max_bytes bytes from the file. More...
Static Public Member Functions inherited from TypedReferenceCount
static TypeHandle | get_class_type ()
static void | init_type ()
Static Public Member Functions inherited from TypedObject
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. More...
Static Public Member Functions inherited from ReferenceCount
static TypeHandle | get_class_type ()
static void | init_type ()

## Additional Inherited Members
Public Attributes inherited from TypedObject
| get_type
Public Attributes inherited from ReferenceCount
| get_ref_count
| Returns the current reference count. More...

## Detailed Description

A composite directory within the VirtualFileSystem: this maps to more than one directory on different mount points.

The resulting directory appears to be the union of all the individual simple directories.

Definition at line 26 of file virtualFileComposite.h.

## Member Function Documentation

## ◆ add_component()

void VirtualFileComposite::add_component | ( | VirtualFile * | file | ) |
| inline

Adds one more component to the composite directory.

The component should be a directory and the file system and filename should match the composite.

Definition at line 28 of file virtualFileComposite.I.

## ◆ get_file_system()

VirtualFileSystem * VirtualFileComposite::get_file_system | ( |  | ) | const
| virtual

Returns the VirtualFileSystem this file is associated with.

Implements VirtualFile.

Definition at line 22 of file virtualFileComposite.cxx.

## ◆ get_filename()

Filename VirtualFileComposite::get_filename | ( |  | ) | const
| virtual

Returns the full pathname to this file within the virtual file system.

Implements VirtualFile.

Definition at line 30 of file virtualFileComposite.cxx.

## ◆ has_file()

bool VirtualFileComposite::has_file | ( |  | ) | const
| virtual

Returns true if this file exists, false otherwise.

Reimplemented from VirtualFile.

Definition at line 38 of file virtualFileComposite.cxx.

## ◆ is_directory()

bool VirtualFileComposite::is_directory | ( |  | ) | const
| virtual

Returns true if this file represents a directory (and scan_directory() may be called), false otherwise.

Reimplemented from VirtualFile.

Definition at line 47 of file virtualFileComposite.cxx.

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

- panda/src/express/virtualFileComposite.h
- panda/src/express/virtualFileComposite.cxx
- panda/src/express/virtualFileComposite.I