Panda3D
 All Classes Functions Variables Enumerations
virtualFileComposite.cxx
1 // Filename: virtualFileComposite.cxx
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 #include "virtualFileComposite.h"
16 
17 TypeHandle VirtualFileComposite::_type_handle;
18 
19 
20 ////////////////////////////////////////////////////////////////////
21 // Function: VirtualFileComposite::get_file_system
22 // Access: Published, Virtual
23 // Description: Returns the VirtualFileSystem this file is associated
24 // with.
25 ////////////////////////////////////////////////////////////////////
27 get_file_system() const {
28  return _file_system;
29 }
30 
31 ////////////////////////////////////////////////////////////////////
32 // Function: VirtualFileComposite::get_filename
33 // Access: Published, Virtual
34 // Description: Returns the full pathname to this file within the
35 // virtual file system.
36 ////////////////////////////////////////////////////////////////////
38 get_filename() const {
39  return _filename;
40 }
41 
42 ////////////////////////////////////////////////////////////////////
43 // Function: VirtualFileComposite::has_file
44 // Access: Published, Virtual
45 // Description: Returns true if this file exists, false otherwise.
46 ////////////////////////////////////////////////////////////////////
48 has_file() const {
49  return true;
50 }
51 
52 ////////////////////////////////////////////////////////////////////
53 // Function: VirtualFileComposite::is_directory
54 // Access: Published, Virtual
55 // Description: Returns true if this file represents a directory (and
56 // scan_directory() may be called), false otherwise.
57 ////////////////////////////////////////////////////////////////////
59 is_directory() const {
60  return true;
61 }
62 
63 ////////////////////////////////////////////////////////////////////
64 // Function: VirtualFileComposite::scan_local_directory
65 // Access: Protected, Virtual
66 // Description: Fills file_list up with the list of files that are
67 // within this directory, excluding those whose
68 // basenames are listed in mount_points. Returns true
69 // if successful, false if the file is not a directory
70 // or the directory cannot be read.
71 ////////////////////////////////////////////////////////////////////
72 bool VirtualFileComposite::
73 scan_local_directory(VirtualFileList *file_list,
74  const ov_set<string> &mount_points) const {
75  bool any_ok = false;
76  Components::const_iterator ci;
77  for (ci = _components.begin(); ci != _components.end(); ++ci) {
78  if ((*ci)->scan_local_directory(file_list, mount_points)) {
79  any_ok = true;
80  }
81  }
82 
83  return any_ok;
84 }
A hierarchy of directories and files that appears to be one continuous file system, even though the files may originate from several different sources that may not be related to the actual OS&#39;s file system.
virtual bool is_directory() const
Returns true if this file represents a directory (and scan_directory() may be called), false otherwise.
virtual Filename get_filename() const
Returns the full pathname to this file within the virtual file system.
virtual VirtualFileSystem * get_file_system() const
Returns the VirtualFileSystem this file is associated with.
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:44
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
virtual bool has_file() const
Returns true if this file exists, false otherwise.