# VirtualFileComposite

from pandac.PandaModules import VirtualFileComposite

Class : VirtualFileComposite
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.

## Inheritance:

VirtualFileComposite: VirtualFile
VirtualFile: TypedReferenceCount
TypedReferenceCount: TypedObject ReferenceCount
TypedObject: MemoryBase
MemoryBase:
ReferenceCount: MemoryBase

## Methods of VirtualFileComposite:

getClassType

## Methods of VirtualFile:

closeReadFile
getClassType
getFilename
getFileSize
getFileSystem
getOriginalFilename
getTimestamp
isDirectory
isRegularFile
ls
lsAll
openReadFile
output
readFile
scanDirectory

## Methods of TypedReferenceCount:

getClassType

## Methods of TypedObject:

getClassType
getType
getTypeIndex
isExactType
isOfType

## Methods of ReferenceCount:

getClassType
getRefCount
ref
testRefCountIntegrity
testRefCountNonzero
unref

getClassType static TypeHandle VirtualFileComposite::get_class_type(void); Undocumented function.

closeReadFile void VirtualFile::close_read_file(istream *stream) const; Description: Closes a file opened by a previous call to open_read_file(). This really just deletes the istream pointer, but it is recommended to use this interface instead of deleting it explicitly, to help work around compiler issues.

getClassType static TypeHandle VirtualFile::get_class_type(void); Undocumented function.

getFilename virtual Filename VirtualFile::get_filename(void) const = 0; Undocumented function.

getFileSize virtual int VirtualFile::get_file_size(istream *stream) const; Description: 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. Description: Returns the current size on disk (or wherever it is) of the file before it has been opened.

getFileSystem virtual VirtualFileSystem *VirtualFile::get_file_system(void) const = 0; Undocumented function.

getOriginalFilename Filename const &VirtualFile::get_original_filename(void) const; Description: Returns the original filename as it was used to locate this VirtualFile. This is usually, but not always, the same string returned by get_filename().

getTimestamp virtual unsigned int VirtualFile::get_timestamp(void) const; Description: 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.

isDirectory virtual bool VirtualFile::is_directory(void) const; Description: Returns true if this file represents a directory (and scan_directory() may be called), false otherwise.

isRegularFile virtual bool VirtualFile::is_regular_file(void) const; Description: Returns true if this file represents a regular file (and read_file() may be called), false otherwise.

ls void VirtualFile::ls(ostream &out = (cout)) const; Description: If the file represents a directory, lists its contents.

lsAll void VirtualFile::ls_all(ostream &out = (cout)) const; Description: If the file represents a directory, recursively lists its contents and those of all subdirectories.

openReadFile virtual istream *VirtualFile::open_read_file(bool auto_unwrap) const; Description: Opens the file for reading. Returns a newly allocated istream on success (which you should eventually delete when you are done reading). Returns NULL on failure.

output void VirtualFile::output(ostream &out) const; Description:

readFile string VirtualFile::read_file(bool auto_unwrap) const; Description: Returns the entire contents of the file as a string. Description: Fills up the indicated string with the contents of the file, if it is a regular file. Returns true on success, false otherwise. Description: Fills up the indicated pvector with the contents of the file, if it is a regular file. Returns true on success, false otherwise. Description: Fills up the indicated pvector with the contents of the just-opened file. Returns true on success, false otherwise. If the pvector was not empty on entry, the data read from the file will be appended onto it. Description: As in read_file() with two parameters, above, but only reads up to max_bytes bytes from the file.

scanDirectory PointerTo< VirtualFileList > VirtualFile::scan_directory(void) const; Description: 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. Returns NULL if the file is not a directory or if the directory cannot be read.

getClassType static TypeHandle TypedReferenceCount::get_class_type(void); Undocumented function.

getClassType static TypeHandle TypedObject::get_class_type(void); Undocumented function.

getType virtual TypeHandle TypedObject::get_type(void) const = 0; Derived classes should override this function to return get_class_type().

getTypeIndex int TypedObject::get_type_index(void) const; Description: Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. This is equivalent to get_type().get_index().

isExactType bool TypedObject::is_exact_type(TypeHandle handle) const; Description: Returns true if the current object is the indicated type exactly.

isOfType bool TypedObject::is_of_type(TypeHandle handle) const; Description: Returns true if the current object is or derives from the indicated type.

getClassType static TypeHandle ReferenceCount::get_class_type(void); Undocumented function.

getRefCount int ReferenceCount::get_ref_count(void) const; Description: Returns the current reference count.

ref void ReferenceCount::ref(void) const; Description: Explicitly increments the reference count. User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically. This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.

testRefCountIntegrity bool ReferenceCount::test_ref_count_integrity(void) const; Description: Does some easy checks to make sure that the reference count isn't completely bogus. Returns true if ok, false otherwise.

testRefCountNonzero bool ReferenceCount::test_ref_count_nonzero(void) const; Description: Does some easy checks to make sure that the reference count isn't zero, or completely bogus. Returns true if ok, false otherwise.

unref bool ReferenceCount::unref(void) const; Description: Explicitly decrements the reference count. Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic; plus, we don't have a virtual destructor anyway.) However, see the helper function unref_delete(). User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically. This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it. The return value is true if the new reference count is nonzero, false if it is zero.