Panda3D
virtualFileComposite.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 virtualFileComposite.h
10  * @author drose
11  * @date 2002-08-03
12  */
13 
14 #ifndef VIRTUALFILECOMPOSITE_H
15 #define VIRTUALFILECOMPOSITE_H
16 
17 #include "pandabase.h"
18 
19 #include "virtualFile.h"
20 
21 /**
22  * A composite directory within the VirtualFileSystem: this maps to more than
23  * one directory on different mount points. The resulting directory appears
24  * to be the union of all the individual simple directories.
25  */
26 class EXPCL_PANDA_EXPRESS VirtualFileComposite : public VirtualFile {
27 public:
28  INLINE VirtualFileComposite(VirtualFileSystem *file_system,
29  const Filename &filename);
30 
31  INLINE void add_component(VirtualFile *file);
32 
33  virtual VirtualFileSystem *get_file_system() const;
34  virtual Filename get_filename() const;
35 
36  virtual bool has_file() const;
37  virtual bool is_directory() const;
38 
39 protected:
40  virtual bool scan_local_directory(VirtualFileList *file_list,
41  const ov_set<std::string> &mount_points) const;
42 
43 private:
44  VirtualFileSystem *_file_system;
45  Filename _filename;
46  typedef pvector< PT(VirtualFile) > Components;
47  Components _components;
48 
49 public:
50  virtual TypeHandle get_type() const {
51  return get_class_type();
52  }
53  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
54 
55 PUBLISHED:
56  static TypeHandle get_class_type() {
57  return _type_handle;
58  }
59 
60 public:
61  static void init_type() {
62  VirtualFile::init_type();
63  register_type(_type_handle, "VirtualFileComposite",
64  VirtualFile::get_class_type());
65  }
66 
67 private:
68  static TypeHandle _type_handle;
69 };
70 
71 #include "virtualFileComposite.I"
72 
73 #endif
A hierarchy of directories and files that appears to be one continuous file system,...
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
The abstract base class for a file or directory within the VirtualFileSystem.
Definition: virtualFile.h:35
A specialization of ordered_vector that emulates a standard STL set: one copy of each element is allo...
This is our own Panda specialization on the default STL vector.
Definition: pvector.h:42
A list of VirtualFiles, as returned by VirtualFile::scan_directory().
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:39
virtual bool is_directory() const
Returns true if this file represents a directory (and scan_directory() may be called),...
Definition: virtualFile.cxx:41
virtual bool has_file() const
Returns true if this file exists, false otherwise.
Definition: virtualFile.cxx:32
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
A composite directory within the VirtualFileSystem: this maps to more than one directory on different...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.