Panda3D
 All Classes Functions Variables Enumerations
virtualFileMountMultifile.h
1 // Filename: virtualFileMountMultifile.h
2 // Created by: drose (03Aug02)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef VIRTUALFILEMOUNTMULTIFILE_H
16 #define VIRTUALFILEMOUNTMULTIFILE_H
17 
18 #include "pandabase.h"
19 
20 #include "virtualFileMount.h"
21 #include "multifile.h"
22 #include "pointerTo.h"
23 
24 ////////////////////////////////////////////////////////////////////
25 // Class : VirtualFileMountMultifile
26 // Description : Maps a Multifile's contents into the
27 // VirtualFileSystem.
28 ////////////////////////////////////////////////////////////////////
29 class EXPCL_PANDAEXPRESS VirtualFileMountMultifile : public VirtualFileMount {
30 PUBLISHED:
31  INLINE VirtualFileMountMultifile(Multifile *multifile);
32  virtual ~VirtualFileMountMultifile();
33 
34  INLINE Multifile *get_multifile() const;
35 
36 public:
37  virtual bool has_file(const Filename &file) const;
38  virtual bool is_directory(const Filename &file) const;
39  virtual bool is_regular_file(const Filename &file) const;
40 
41  virtual bool read_file(const Filename &file, bool do_uncompress,
42  pvector<unsigned char> &result) const;
43 
44  virtual istream *open_read_file(const Filename &file) const;
45  virtual streamsize get_file_size(const Filename &file, istream *stream) const;
46  virtual streamsize get_file_size(const Filename &file) const;
47  virtual time_t get_timestamp(const Filename &file) const;
48  virtual bool get_system_info(const Filename &file, SubfileInfo &info);
49 
50  virtual bool scan_directory(vector_string &contents,
51  const Filename &dir) const;
52 
53  virtual void output(ostream &out) const;
54 
55 private:
56  PT(Multifile) _multifile;
57 
58 
59 public:
60  virtual TypeHandle get_type() const {
61  return get_class_type();
62  }
63  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
64  static TypeHandle get_class_type() {
65  return _type_handle;
66  }
67  static void init_type() {
68  VirtualFileMount::init_type();
69  register_type(_type_handle, "VirtualFileMountMultifile",
70  VirtualFileMount::get_class_type());
71  }
72 
73 private:
74  static TypeHandle _type_handle;
75 };
76 
77 #include "virtualFileMountMultifile.I"
78 
79 #endif
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:44
virtual bool read_file(const Filename &file, bool do_uncompress, pvector< unsigned char > &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...
The abstract base class for a mount definition used within a VirtualFileSystem.
A file that contains a set of files.
Definition: multifile.h:34
This class records a particular byte sub-range within an existing file on disk.
Definition: subfileInfo.h:29
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
Maps a Multifile&#39;s contents into the VirtualFileSystem.