Panda3D
Loading...
Searching...
No Matches
virtualFileMountMultifile.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file virtualFileMountMultifile.h
10 * @author drose
11 * @date 2002-08-03
12 */
13
14#ifndef VIRTUALFILEMOUNTMULTIFILE_H
15#define VIRTUALFILEMOUNTMULTIFILE_H
16
17#include "pandabase.h"
18
19#include "virtualFileMount.h"
20#include "multifile.h"
21#include "pointerTo.h"
22
23/**
24 * Maps a Multifile's contents into the VirtualFileSystem.
25 */
26class EXPCL_PANDA_EXPRESS VirtualFileMountMultifile : public VirtualFileMount {
27PUBLISHED:
28 INLINE VirtualFileMountMultifile(Multifile *multifile);
29 virtual ~VirtualFileMountMultifile();
30
31 INLINE Multifile *get_multifile() const;
32
33public:
34 virtual bool has_file(const Filename &file) const;
35 virtual bool is_directory(const Filename &file) const;
36 virtual bool is_regular_file(const Filename &file) const;
37
38 virtual bool read_file(const Filename &file, bool do_uncompress,
39 vector_uchar &result) const;
40
41 virtual std::istream *open_read_file(const Filename &file) const;
42 virtual std::streamsize get_file_size(const Filename &file, std::istream *stream) const;
43 virtual std::streamsize get_file_size(const Filename &file) const;
44 virtual time_t get_timestamp(const Filename &file) const;
45 virtual bool get_system_info(const Filename &file, SubfileInfo &info);
46
47 virtual bool scan_directory(vector_string &contents,
48 const Filename &dir) const;
49
50 virtual void output(std::ostream &out) const;
51
52private:
53 PT(Multifile) _multifile;
54
55
56public:
57 virtual TypeHandle get_type() const {
58 return get_class_type();
59 }
60 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
61 static TypeHandle get_class_type() {
62 return _type_handle;
63 }
64 static void init_type() {
65 VirtualFileMount::init_type();
66 register_type(_type_handle, "VirtualFileMountMultifile",
67 VirtualFileMount::get_class_type());
68 }
69
70private:
71 static TypeHandle _type_handle;
72};
73
75
76#endif
The name of a file, such as a texture file or an Egg file.
Definition filename.h:44
A file that contains a set of files.
Definition multifile.h:37
This class records a particular byte sub-range within an existing file on disk.
Definition subfileInfo.h:26
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
Multifile * get_multifile() const
Returns the Multifile pointer that this mount object is based on.
virtual bool is_regular_file(const Filename &file) const
Returns true if the indicated file exists within the mount system and is a regular file.
virtual bool has_file(const Filename &file) const
Returns true if the indicated file exists within the mount system.
virtual std::istream * open_read_file(const Filename &file) const
Opens the file for reading, if it exists.
virtual bool is_directory(const Filename &file) const
Returns true if the indicated file exists within the mount system and is a directory.
virtual time_t get_timestamp(const Filename &file) const
Returns a time_t value that represents the time the file was last modified, to within whatever precis...
virtual std::streamsize get_file_size(const Filename &file, std::istream *stream) const
Returns the current size on disk (or wherever it is) of the already-open file.
virtual bool scan_directory(vector_string &contents, const Filename &dir) const
Fills the given vector up with the list of filenames that are local to this directory,...
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 bool get_system_info(const Filename &file, SubfileInfo &info)
Populates the SubfileInfo structure with the data representing where the file actually resides on dis...
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.