00001 // Filename: virtualFileMount.h 00002 // Created by: drose (03Aug02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef VIRTUALFILEMOUNT_H 00020 #define VIRTUALFILEMOUNT_H 00021 00022 #include "pandabase.h" 00023 00024 #include "filename.h" 00025 #include "pointerTo.h" 00026 #include "typedObject.h" 00027 00028 class VirtualFileSystem; 00029 00030 //////////////////////////////////////////////////////////////////// 00031 // Class : VirtualFileMount 00032 // Description : The abstract base class for a mount definition used 00033 // within a VirtualFileSystem. Normally users don't 00034 // need to monkey with this class directly. 00035 //////////////////////////////////////////////////////////////////// 00036 class EXPCL_PANDAEXPRESS VirtualFileMount : public TypedObject { 00037 public: 00038 INLINE VirtualFileMount(VirtualFileSystem *file_system, 00039 const Filename &physical_filename, 00040 const Filename &mount_point, 00041 int mount_flags); 00042 virtual ~VirtualFileMount(); 00043 00044 INLINE VirtualFileSystem *get_file_system() const; 00045 INLINE const Filename &get_physical_filename() const; 00046 INLINE const Filename &get_mount_point() const; 00047 INLINE int get_mount_flags() const; 00048 00049 virtual bool has_file(const Filename &file) const=0; 00050 virtual bool is_directory(const Filename &file) const=0; 00051 virtual bool is_regular_file(const Filename &file) const=0; 00052 00053 virtual istream *open_read_file(const Filename &file) const=0; 00054 virtual bool scan_directory(vector_string &contents, 00055 const Filename &dir) const=0; 00056 00057 00058 virtual void output(ostream &out) const; 00059 virtual void write(ostream &out) const; 00060 00061 protected: 00062 VirtualFileSystem *_file_system; 00063 Filename _physical_filename; 00064 Filename _mount_point; 00065 int _mount_flags; 00066 00067 00068 public: 00069 virtual TypeHandle get_type() const { 00070 return get_class_type(); 00071 } 00072 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00073 static TypeHandle get_class_type() { 00074 return _type_handle; 00075 } 00076 static void init_type() { 00077 TypedObject::init_type(); 00078 register_type(_type_handle, "VirtualFileMount", 00079 TypedObject::get_class_type()); 00080 } 00081 00082 private: 00083 static TypeHandle _type_handle; 00084 }; 00085 00086 INLINE ostream &operator << (ostream &out, const VirtualFileMount &mount); 00087 00088 #include "virtualFileMount.I" 00089 00090 #endif