VirtualFile
from panda3d.core import VirtualFile
- class VirtualFile
Bases:
TypedReferenceCount
The abstract base class for a file or directory within the VirtualFileSystem.
Inheritance diagram
- __init__(*args, **kwargs)
- closeReadFile()
C++ Interface: close_read_file(VirtualFile self, istream stream)
- /**
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.
*/
- closeReadWriteFile()
C++ Interface: close_read_write_file(const VirtualFile self, iostream stream)
- /**
Closes a file opened by a previous call to open_read_write_file(). This
really just deletes the iostream pointer, but it is recommended to use this
interface instead of deleting it explicitly, to help work around compiler
issues.
*/
- closeWriteFile()
C++ Interface: close_write_file(const VirtualFile self, ostream stream)
- /**
Closes a file opened by a previous call to open_write_file(). This really
just deletes the ostream pointer, but it is recommended to use this
interface instead of deleting it explicitly, to help work around compiler
issues.
*/
- close_read_file()
C++ Interface: close_read_file(VirtualFile self, istream stream)
- /**
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.
*/
- close_read_write_file()
C++ Interface: close_read_write_file(const VirtualFile self, iostream stream)
- /**
Closes a file opened by a previous call to open_read_write_file(). This
really just deletes the iostream pointer, but it is recommended to use this
interface instead of deleting it explicitly, to help work around compiler
issues.
*/
- close_write_file()
C++ Interface: close_write_file(const VirtualFile self, ostream stream)
- /**
Closes a file opened by a previous call to open_write_file(). This really
just deletes the ostream pointer, but it is recommended to use this
interface instead of deleting it explicitly, to help work around compiler
issues.
*/
- copyFile()
C++ Interface: copy_file(const VirtualFile self, VirtualFile new_file)
- /**
Attempts to copy the contents of this file to the indicated file. Returns
true on success, false on failure.
*/
- copy_file()
C++ Interface: copy_file(const VirtualFile self, VirtualFile new_file)
- /**
Attempts to copy the contents of this file to the indicated file. Returns
true on success, false on failure.
*/
- deleteFile()
C++ Interface: delete_file(const VirtualFile self)
- /**
Attempts to delete this file or directory. This can remove a single file
or an empty directory. It will not remove a nonempty directory. Returns
true on success, false on failure.
*/
- delete_file()
C++ Interface: delete_file(const VirtualFile self)
- /**
Attempts to delete this file or directory. This can remove a single file
or an empty directory. It will not remove a nonempty directory. Returns
true on success, false on failure.
*/
- getClassType()
C++ Interface: get_class_type()
- getFileSize()
C++ Interface: get_file_size(VirtualFile self) get_file_size(VirtualFile self, istream stream)
- /**
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.
*/
- /**
Returns the current size on disk (or wherever it is) of the file before it
has been opened.
*/
- getFileSystem()
C++ Interface: get_file_system(VirtualFile self)
- getFilename()
C++ Interface: get_filename(VirtualFile self)
- getOriginalFilename()
C++ Interface: get_original_filename(VirtualFile self)
- /**
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().
*/
- getSystemInfo()
C++ Interface: get_system_info(const VirtualFile self, SubfileInfo info)
- /**
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 does
not (or it is not known where the file resides), in which case the info is
meaningless.
*/
- getTimestamp()
C++ Interface: get_timestamp(VirtualFile self)
- /**
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.
*/
- get_class_type()
C++ Interface: get_class_type()
- get_file_size()
C++ Interface: get_file_size(VirtualFile self) get_file_size(VirtualFile self, istream stream)
- /**
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.
*/
- /**
Returns the current size on disk (or wherever it is) of the file before it
has been opened.
*/
- get_file_system()
C++ Interface: get_file_system(VirtualFile self)
- get_filename()
C++ Interface: get_filename(VirtualFile self)
- get_original_filename()
C++ Interface: get_original_filename(VirtualFile self)
- /**
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().
*/
- get_system_info()
C++ Interface: get_system_info(const VirtualFile self, SubfileInfo info)
- /**
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 does
not (or it is not known where the file resides), in which case the info is
meaningless.
*/
- get_timestamp()
C++ Interface: get_timestamp(VirtualFile self)
- /**
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.
*/
- hasFile()
C++ Interface: has_file(VirtualFile self)
- /**
Returns true if this file exists, false otherwise.
*/
- has_file()
C++ Interface: has_file(VirtualFile self)
- /**
Returns true if this file exists, false otherwise.
*/
- isDirectory()
C++ Interface: is_directory(VirtualFile self)
- /**
Returns true if this file represents a directory (and scan_directory() may
be called), false otherwise.
*/
- isRegularFile()
C++ Interface: is_regular_file(VirtualFile self)
- /**
Returns true if this file represents a regular file (and read_file() may be
called), false otherwise.
*/
- isWritable()
C++ Interface: is_writable(VirtualFile self)
- /**
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).
*/
- is_directory()
C++ Interface: is_directory(VirtualFile self)
- /**
Returns true if this file represents a directory (and scan_directory() may
be called), false otherwise.
*/
- is_regular_file()
C++ Interface: is_regular_file(VirtualFile self)
- /**
Returns true if this file represents a regular file (and read_file() may be
called), false otherwise.
*/
- is_writable()
C++ Interface: is_writable(VirtualFile self)
- /**
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).
*/
- ls()
C++ Interface: ls(VirtualFile self, ostream out)
- /**
If the file represents a directory, lists its contents.
*/
- lsAll()
C++ Interface: ls_all(VirtualFile self, ostream out)
- /**
If the file represents a directory, recursively lists its contents and
those of all subdirectories.
*/
- ls_all()
C++ Interface: ls_all(VirtualFile self, ostream out)
- /**
If the file represents a directory, recursively lists its contents and
those of all subdirectories.
*/
- openAppendFile()
C++ Interface: open_append_file(const VirtualFile self)
- /**
Works like open_write_file(), but the file is opened in append mode. Like
open_write_file, the returned pointer should eventually be passed to
close_write_file().
*/
- openReadAppendFile()
C++ Interface: open_read_append_file(const VirtualFile self)
- /**
Works like open_read_write_file(), but the file is opened in append mode.
Like open_read_write_file, the returned pointer should eventually be passed
to close_read_write_file().
*/
- openReadFile()
C++ Interface: open_read_file(VirtualFile self, bool auto_unwrap)
- /**
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.
*/
- openReadWriteFile()
C++ Interface: open_read_write_file(const VirtualFile self, bool truncate)
- /**
Opens the file for writing. Returns a newly allocated iostream on success
(which you should eventually delete when you are done writing). Returns
NULL on failure.
*/
- openWriteFile()
C++ Interface: open_write_file(const VirtualFile self, bool auto_wrap, bool truncate)
- /**
Opens the file for writing. Returns a newly allocated ostream on success
(which you should eventually delete when you are done writing). Returns
NULL on failure.
*/
- open_append_file()
C++ Interface: open_append_file(const VirtualFile self)
- /**
Works like open_write_file(), but the file is opened in append mode. Like
open_write_file, the returned pointer should eventually be passed to
close_write_file().
*/
- open_read_append_file()
C++ Interface: open_read_append_file(const VirtualFile self)
- /**
Works like open_read_write_file(), but the file is opened in append mode.
Like open_read_write_file, the returned pointer should eventually be passed
to close_read_write_file().
*/
- open_read_file()
C++ Interface: open_read_file(VirtualFile self, bool auto_unwrap)
- /**
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.
*/
- open_read_write_file()
C++ Interface: open_read_write_file(const VirtualFile self, bool truncate)
- /**
Opens the file for writing. Returns a newly allocated iostream on success
(which you should eventually delete when you are done writing). Returns
NULL on failure.
*/
- open_write_file()
C++ Interface: open_write_file(const VirtualFile self, bool auto_wrap, bool truncate)
- /**
Opens the file for writing. Returns a newly allocated ostream on success
(which you should eventually delete when you are done writing). Returns
NULL on failure.
*/
- readFile()
C++ Interface: read_file(VirtualFile self, bool auto_unwrap)
- /**
Returns the entire contents of the file as a string.
*/
- /**
Fills up the indicated string with the contents of the file, if it is a
regular file. Returns true on success, false otherwise.
*/
- /**
Fills up the indicated pvector with the contents of the file, if it is a
regular file. Returns true on success, false otherwise.
*/
- read_file()
C++ Interface: read_file(VirtualFile self, bool auto_unwrap)
- /**
Returns the entire contents of the file as a string.
*/
- /**
Fills up the indicated string with the contents of the file, if it is a
regular file. Returns true on success, false otherwise.
*/
- /**
Fills up the indicated pvector with the contents of the file, if it is a
regular file. Returns true on success, false otherwise.
*/
- renameFile()
C++ Interface: rename_file(const VirtualFile self, VirtualFile new_file)
- /**
Attempts to move or rename this file or directory. If the original file is
an ordinary file, it will quietly replace any already-existing file in the
new filename (but not a directory). If the original file is a directory,
the new filename must not already exist.
If the file is a directory, the new filename must be within the same mount
point. If the file is an ordinary file, the new filename may be anywhere;
but if it is not within the same mount point then the rename operation is
automatically performed as a two-step copy-and-delete operation.
*/
- rename_file()
C++ Interface: rename_file(const VirtualFile self, VirtualFile new_file)
- /**
Attempts to move or rename this file or directory. If the original file is
an ordinary file, it will quietly replace any already-existing file in the
new filename (but not a directory). If the original file is a directory,
the new filename must not already exist.
If the file is a directory, the new filename must be within the same mount
point. If the file is an ordinary file, the new filename may be anywhere;
but if it is not within the same mount point then the rename operation is
automatically performed as a two-step copy-and-delete operation.
*/
- scanDirectory()
C++ Interface: scan_directory(VirtualFile self)
- /**
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.
*/
- scan_directory()
C++ Interface: scan_directory(VirtualFile self)
- /**
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.
*/
- wasReadSuccessful()
C++ Interface: was_read_successful(VirtualFile self)
- /**
Call this method after a reading the istream returned by open_read_file()
to completion. If it returns true, the file was read completely and
without error; if it returns false, there may have been some errors or a
truncated file read. This is particularly likely if the stream is a
VirtualFileHTTP.
*/
- was_read_successful()
C++ Interface: was_read_successful(VirtualFile self)
- /**
Call this method after a reading the istream returned by open_read_file()
to completion. If it returns true, the file was read completely and
without error; if it returns false, there may have been some errors or a
truncated file read. This is particularly likely if the stream is a
VirtualFileHTTP.
*/
- writeFile()
C++ Interface: write_file(const VirtualFile self, object data, bool auto_wrap)