Panda3D
virtualFileComposite.cxx
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.cxx
10  * @author drose
11  * @date 2002-08-03
12  */
13 
14 #include "virtualFileComposite.h"
15 
16 TypeHandle VirtualFileComposite::_type_handle;
17 
18 
19 /**
20  * Returns the VirtualFileSystem this file is associated with.
21  */
23 get_file_system() const {
24  return _file_system;
25 }
26 
27 /**
28  * Returns the full pathname to this file within the virtual file system.
29  */
31 get_filename() const {
32  return _filename;
33 }
34 
35 /**
36  * Returns true if this file exists, false otherwise.
37  */
39 has_file() const {
40  return true;
41 }
42 
43 /**
44  * Returns true if this file represents a directory (and scan_directory() may
45  * be called), false otherwise.
46  */
48 is_directory() const {
49  return true;
50 }
51 
52 /**
53  * Fills file_list up with the list of files that are within this directory,
54  * excluding those whose basenames are listed in mount_points. Returns true
55  * if successful, false if the file is not a directory or the directory cannot
56  * be read.
57  */
58 bool VirtualFileComposite::
59 scan_local_directory(VirtualFileList *file_list,
60  const ov_set<std::string> &mount_points) const {
61  bool any_ok = false;
62  Components::const_iterator ci;
63  for (ci = _components.begin(); ci != _components.end(); ++ci) {
64  if ((*ci)->scan_local_directory(file_list, mount_points)) {
65  any_ok = true;
66  }
67  }
68 
69  return any_ok;
70 }
virtual bool has_file() const
Returns true if this file exists, false otherwise.
A hierarchy of directories and files that appears to be one continuous file system,...
virtual bool is_directory() const
Returns true if this file represents a directory (and scan_directory() may be called),...
virtual Filename get_filename() const
Returns the full pathname to this file within the virtual file system.
A specialization of ordered_vector that emulates a standard STL set: one copy of each element is allo...
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 VirtualFileSystem * get_file_system() const
Returns the VirtualFileSystem this file is associated with.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.