14 #ifndef VIRTUALFILESIMPLE_H 15 #define VIRTUALFILESIMPLE_H 30 bool implicit_pz_file,
36 virtual Filename get_filename()
const;
42 INLINE
bool is_implicit_pz_file()
const;
57 virtual std::streamsize
get_file_size(std::istream *stream)
const;
66 virtual bool read_file(vector_uchar &result,
bool auto_unwrap)
const;
67 virtual bool write_file(
const unsigned char *data,
size_t data_size,
bool auto_wrap);
76 bool _implicit_pz_file;
80 return get_class_type();
82 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
90 static void init_type() {
91 VirtualFile::init_type();
93 VirtualFile::get_class_type());
bool write_file(const std::string &data, bool auto_wrap)
Writes the entire contents of the file as a string, if it is writable.
virtual std::ostream * open_append_file()
Works like open_write_file(), but the file is opened in append mode.
A hierarchy of directories and files that appears to be one continuous file system,...
virtual std::ostream * open_write_file(bool auto_wrap, bool truncate)
Opens the file for writing.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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...
virtual bool copy_file(VirtualFile *new_file)
Attempts to copy the contents of this file to the indicated file.
virtual time_t get_timestamp() const
Returns a time_t value that represents the time the file was last modified, to within whatever precis...
The abstract base class for a file or directory within the VirtualFileSystem.
A specialization of ordered_vector that emulates a standard STL set: one copy of each element is allo...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual bool get_system_info(SubfileInfo &info)
Populates the SubfileInfo structure with the data representing where the file actually resides on dis...
virtual std::iostream * open_read_write_file(bool truncate)
Opens the file for writing.
A list of VirtualFiles, as returned by VirtualFile::scan_directory().
virtual void close_read_file(std::istream *stream) const
Closes a file opened by a previous call to open_read_file().
virtual bool atomic_read_contents(std::string &contents) const
See Filename::atomic_read_contents().
virtual void close_read_write_file(std::iostream *stream)
Closes a file opened by a previous call to open_read_write_file().
The name of a file, such as a texture file or an Egg file.
virtual bool is_directory() const
Returns true if this file represents a directory (and scan_directory() may be called),...
virtual std::iostream * open_read_append_file()
Works like open_read_write_file(), but the file is opened in append mode.
virtual bool delete_file()
Attempts to delete this file or directory.
std::string read_file(bool auto_unwrap) const
Returns the entire contents of the file as a string.
virtual bool has_file() const
Returns true if this file exists, false otherwise.
virtual std::istream * open_read_file(bool auto_unwrap) const
Opens the file for reading.
The abstract base class for a mount definition used within a VirtualFileSystem.
virtual bool rename_file(VirtualFile *new_file)
Attempts to move or rename this file or directory.
This class records a particular byte sub-range within an existing file on disk.
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.
TypeHandle is the identifier used to differentiate C++ class types.
virtual bool is_regular_file() const
Returns true if this file represents a regular file (and read_file() may be called),...
A simple file or directory within the VirtualFileSystem: this maps to exactly one file on one mount p...
virtual void close_write_file(std::ostream *stream)
Closes a file opened by a previous call to open_write_file().
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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().