2
0

virtualFileSimple.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // Filename: virtualFileSimple.h
  2. // Created by: drose (03Aug02)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
  8. //
  9. // All use of this software is subject to the terms of the Panda 3d
  10. // Software license. You should have received a copy of this license
  11. // along with this source code; you will also find a current copy of
  12. // the license at http://etc.cmu.edu/panda3d/docs/license/ .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. #ifndef VIRTUALFILESIMPLE_H
  19. #define VIRTUALFILESIMPLE_H
  20. #include "pandabase.h"
  21. #include "virtualFile.h"
  22. ////////////////////////////////////////////////////////////////////
  23. // Class : VirtualFileSimple
  24. // Description : A simple file or directory within the
  25. // VirtualFileSystem: this maps to exactly one file on
  26. // one mount point. Most directories, and all regular
  27. // files, are of this kind.
  28. ////////////////////////////////////////////////////////////////////
  29. class EXPCL_PANDAEXPRESS VirtualFileSimple : public VirtualFile {
  30. public:
  31. INLINE VirtualFileSimple(VirtualFileMount *mount,
  32. const Filename &local_filename);
  33. virtual VirtualFileSystem *get_file_system() const;
  34. virtual Filename get_filename() const;
  35. virtual bool is_directory() const;
  36. virtual bool is_regular_file() const;
  37. virtual istream *open_read_file() const;
  38. protected:
  39. virtual bool scan_local_directory(VirtualFileList *file_list,
  40. const ov_set<string> &mount_points) const;
  41. private:
  42. VirtualFileMount *_mount;
  43. Filename _local_filename;
  44. public:
  45. virtual TypeHandle get_type() const {
  46. return get_class_type();
  47. }
  48. virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
  49. PUBLISHED:
  50. static TypeHandle get_class_type() {
  51. return _type_handle;
  52. }
  53. public:
  54. static void init_type() {
  55. VirtualFile::init_type();
  56. register_type(_type_handle, "VirtualFileSimple",
  57. VirtualFile::get_class_type());
  58. }
  59. private:
  60. static TypeHandle _type_handle;
  61. };
  62. #include "virtualFileSimple.I"
  63. #endif