14#ifndef VIRTUALFILEMOUNT_H
15#define VIRTUALFILEMOUNT_H
31class EXPCL_PANDA_EXPRESS VirtualFileMount :
public TypedReferenceCount {
33 INLINE VirtualFileMount();
34 virtual ~VirtualFileMount();
43 bool implicit_pz_file,
46 virtual bool has_file(
const Filename &file)
const=0;
52 virtual bool is_directory(
const Filename &file)
const=0;
53 virtual bool is_regular_file(
const Filename &file)
const=0;
57 vector_uchar &result)
const;
59 const unsigned char *data,
size_t data_size);
61 virtual std::istream *open_read_file(
const Filename &file)
const=0;
62 std::istream *open_read_file(
const Filename &file,
bool do_uncompress)
const;
74 virtual std::streamsize get_file_size(
const Filename &file, std::istream *stream)
const=0;
75 virtual std::streamsize get_file_size(
const Filename &file)
const=0;
76 virtual time_t get_timestamp(
const Filename &file)
const=0;
79 virtual bool scan_directory(vector_string &contents,
86 virtual void output(std::ostream &out)
const;
87 virtual void write(std::ostream &out)
const;
90 VirtualFileSystem *_file_system;
97 return get_class_type();
99 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
103 static void init_type() {
104 TypedReferenceCount::init_type();
106 TypedReferenceCount::get_class_type());
112 friend class VirtualFileSystem;
The name of a file, such as a texture file or an Egg file.
This class records a particular byte sub-range within an existing file on disk.
TypeHandle is the identifier used to differentiate C++ class types.
The abstract base class for a mount definition used within a VirtualFileSystem.
virtual std::iostream * open_read_write_file(const Filename &file, bool truncate)
Opens the file for writing.
int get_mount_flags() const
Returns the set of flags passed by the user to the VirtualFileSystem::mount() command.
virtual bool atomic_read_contents(const Filename &file, std::string &contents) const
See Filename::atomic_read_contents().
virtual bool is_writable(const Filename &file) const
Returns true if the named file or directory may be written to, false otherwise.
const Filename & get_mount_point() const
Returns the name of the directory within the virtual file system that this mount object is attached t...
virtual bool delete_file(const Filename &file)
Attempts to delete the indicated file or directory within the mount.
virtual bool read_file(const Filename &file, bool do_uncompress, vector_uchar &result) const
Fills up the indicated pvector with the contents of the file, if it is a regular file.
virtual void close_write_file(std::ostream *stream)
Closes a file opened by a previous call to open_write_file().
virtual void close_read_write_file(std::iostream *stream)
Closes a file opened by a previous call to open_read_write_file().
virtual bool copy_file(const Filename &orig_filename, const Filename &new_filename)
Attempts to copy the contents of the indicated file to the indicated file.
virtual bool write_file(const Filename &file, bool do_compress, const unsigned char *data, size_t data_size)
Writes the indicated data to the file, if it is a writable file.
VirtualFileSystem * get_file_system() const
Returns the file system this mount object is attached to.
virtual std::ostream * open_write_file(const Filename &file, bool truncate)
Opens the file for writing.
virtual bool create_file(const Filename &file)
Attempts to create the indicated file within the mount, if it does not already exist.
virtual std::ostream * open_append_file(const Filename &file)
Works like open_write_file(), but the file is opened in append mode.
virtual bool get_system_info(const Filename &file, SubfileInfo &info)
Populates the SubfileInfo structure with the data representing where the file actually resides on dis...
virtual PointerTo< VirtualFile > make_virtual_file(const Filename &local_filename, const Filename &original_filename, bool implicit_pz_file, int open_flags)
Constructs and returns a new VirtualFile instance that corresponds to the indicated filename within t...
virtual bool atomic_compare_and_exchange_contents(const Filename &file, std::string &orig_contents, const std::string &old_contents, const std::string &new_contents)
See Filename::atomic_compare_and_exchange_contents().
virtual std::iostream * open_read_append_file(const Filename &file)
Works like open_read_write_file(), but the file is opened in append mode.
virtual bool rename_file(const Filename &orig_filename, const Filename &new_filename)
Attempts to rename the contents of the indicated file to the indicated file.
virtual void close_read_file(std::istream *stream) const
Closes a file opened by a previous call to open_read_file().
virtual bool make_directory(const Filename &file)
Attempts to create the indicated file within the mount, if it does not already exist.
A hierarchy of directories and files that appears to be one continuous file system,...
bool mount(Multifile *multifile, const Filename &mount_point, int flags)
Mounts the indicated Multifile at the given mount point.
The abstract base class for a file or directory within the VirtualFileSystem.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.