Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/express/virtualFile.h

Go to the documentation of this file.
00001 // Filename: virtualFile.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 VIRTUALFILE_H
00020 #define VIRTUALFILE_H
00021 
00022 #include "pandabase.h"
00023 
00024 #include "filename.h"
00025 #include "pointerTo.h"
00026 #include "typedReferenceCount.h"
00027 #include "ordered_vector.h"
00028 
00029 class VirtualFileMount;
00030 class VirtualFileList;
00031 class VirtualFileSystem;
00032 
00033 ////////////////////////////////////////////////////////////////////
00034 //       Class : VirtualFile
00035 // Description : The abstract base class for a file or directory
00036 //               within the VirtualFileSystem.
00037 ////////////////////////////////////////////////////////////////////
00038 class EXPCL_PANDAEXPRESS VirtualFile : public TypedReferenceCount {
00039 public:
00040   INLINE VirtualFile();
00041 
00042 PUBLISHED:
00043   virtual VirtualFileSystem *get_file_system() const=0;
00044   virtual Filename get_filename() const=0;
00045 
00046   virtual bool is_directory() const;
00047   virtual bool is_regular_file() const;
00048 
00049   PT(VirtualFileList) scan_directory() const;
00050 
00051   void output(ostream &out) const;
00052   void ls(ostream &out = cout) const;
00053   void ls_all(ostream &out = cout) const;
00054 
00055   INLINE string read_file() const;
00056   virtual istream *open_read_file() const;
00057 
00058 public:
00059   bool read_file(string &result) const;
00060 
00061 
00062 protected:
00063   virtual bool scan_local_directory(VirtualFileList *file_list, 
00064                                     const ov_set<string> &mount_points) const;
00065 
00066 private:
00067   void r_ls_all(ostream &out, const Filename &root) const;
00068 
00069 
00070 public:
00071   virtual TypeHandle get_type() const {
00072     return get_class_type();
00073   }
00074   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00075   static TypeHandle get_class_type() {
00076     return _type_handle;
00077   }
00078   static void init_type() {
00079     TypedReferenceCount::init_type();
00080     register_type(_type_handle, "VirtualFile",
00081                   TypedReferenceCount::get_class_type());
00082   }
00083 
00084 private:
00085   static TypeHandle _type_handle;
00086 
00087   friend class VirtualFileComposite;
00088 };
00089 
00090 INLINE ostream &operator << (ostream &out, const VirtualFile &file);
00091 
00092 #include "virtualFile.I"
00093 
00094 #endif

Generated on Fri May 2 00:38:47 2003 for Panda by doxygen1.3