virtualFileMountSystem.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // Filename: virtualFileMountSystem.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 VIRTUALFILEMOUNTSYSTEM_H
  19. #define VIRTUALFILEMOUNTSYSTEM_H
  20. #include "pandabase.h"
  21. #include "virtualFileMount.h"
  22. ////////////////////////////////////////////////////////////////////
  23. // Class : VirtualFileMountSystem
  24. // Description : Maps an actual OS directory into the
  25. // VirtualFileSystem.
  26. ////////////////////////////////////////////////////////////////////
  27. class EXPCL_PANDAEXPRESS VirtualFileMountSystem : public VirtualFileMount {
  28. public:
  29. INLINE VirtualFileMountSystem(VirtualFileSystem *file_system,
  30. const Filename &physical_filename,
  31. const Filename &mount_point,
  32. int mount_flags);
  33. virtual bool has_file(const Filename &file) const;
  34. virtual bool is_directory(const Filename &file) const;
  35. virtual bool is_regular_file(const Filename &file) const;
  36. virtual istream *open_read_file(const Filename &file) const;
  37. virtual off_t get_file_size(const Filename &file, istream *stream) const;
  38. virtual off_t get_file_size(const Filename &file) const;
  39. virtual time_t get_timestamp(const Filename &file) const;
  40. virtual bool scan_directory(vector_string &contents,
  41. const Filename &dir) const;
  42. public:
  43. virtual TypeHandle get_type() const {
  44. return get_class_type();
  45. }
  46. virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
  47. static TypeHandle get_class_type() {
  48. return _type_handle;
  49. }
  50. static void init_type() {
  51. VirtualFileMount::init_type();
  52. register_type(_type_handle, "VirtualFileMountSystem",
  53. VirtualFileMount::get_class_type());
  54. }
  55. private:
  56. static TypeHandle _type_handle;
  57. };
  58. #include "virtualFileMountSystem.I"
  59. #endif