00001 // Filename: virtualFileComposite.cxx00002 // Created by: drose (03Aug02)00003 //00004 ////////////////////////////////////////////////////////////////////00005 //00006 // PANDA 3D SOFTWARE00007 // Copyright (c) Carnegie Mellon University. All rights reserved.00008 //00009 // All use of this software is subject to the terms of the revised BSD00010 // license. You should have received a copy of this license along00011 // with this source code in a file named "LICENSE."00012 //00013 ////////////////////////////////////////////////////////////////////00014
00015 #include "virtualFileComposite.h"00016
00017 TypeHandle VirtualFileComposite::_type_handle;
00018
00019
00020 ////////////////////////////////////////////////////////////////////00021 // Function: VirtualFileComposite::get_file_system00022 // Access: Published, Virtual00023 // Description: Returns the VirtualFileSystem this file is associated00024 // with.00025 ////////////////////////////////////////////////////////////////////00026 VirtualFileSystem *VirtualFileComposite::00027get_file_system() const {
00028 return _file_system;
00029 }
00030
00031 ////////////////////////////////////////////////////////////////////00032 // Function: VirtualFileComposite::get_filename00033 // Access: Published, Virtual00034 // Description: Returns the full pathname to this file within the00035 // virtual file system.00036 ////////////////////////////////////////////////////////////////////00037 FilenameVirtualFileComposite::00038get_filename() const {
00039 return _filename;
00040 }
00041
00042 ////////////////////////////////////////////////////////////////////00043 // Function: VirtualFileComposite::has_file00044 // Access: Published, Virtual00045 // Description: Returns true if this file exists, false otherwise.00046 ////////////////////////////////////////////////////////////////////00047 boolVirtualFileComposite::00048has_file() const {
00049 returntrue;
00050 }
00051
00052 ////////////////////////////////////////////////////////////////////00053 // Function: VirtualFileComposite::is_directory00054 // Access: Published, Virtual00055 // Description: Returns true if this file represents a directory (and00056 // scan_directory() may be called), false otherwise.00057 ////////////////////////////////////////////////////////////////////00058 boolVirtualFileComposite::00059is_directory() const {
00060 returntrue;
00061 }
00062
00063 ////////////////////////////////////////////////////////////////////00064 // Function: VirtualFileComposite::scan_local_directory00065 // Access: Protected, Virtual00066 // Description: Fills file_list up with the list of files that are00067 // within this directory, excluding those whose00068 // basenames are listed in mount_points. Returns true00069 // if successful, false if the file is not a directory00070 // or the directory cannot be read.00071 ////////////////////////////////////////////////////////////////////00072 boolVirtualFileComposite::00073scan_local_directory(VirtualFileList *file_list,
00074 constov_set<string> &mount_points) const {
00075 bool any_ok = false;
00076 Components::const_iterator ci;
00077 for (ci = _components.begin(); ci != _components.end(); ++ci) {
00078 if ((*ci)->scan_local_directory(file_list, mount_points)) {
00079 any_ok = true;
00080 }
00081 }
00082
00083 return any_ok;
00084 }