loaderFileType.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /**
  2. * PANDA 3D SOFTWARE
  3. * Copyright (c) Carnegie Mellon University. All rights reserved.
  4. *
  5. * All use of this software is subject to the terms of the revised BSD
  6. * license. You should have received a copy of this license along
  7. * with this source code in a file named "LICENSE."
  8. *
  9. * @file loaderFileType.h
  10. * @author drose
  11. * @date 2000-06-20
  12. */
  13. #ifndef LOADERFILETYPE_H
  14. #define LOADERFILETYPE_H
  15. #include "pandabase.h"
  16. #include "typedObject.h"
  17. #include "filename.h"
  18. #include "pandaNode.h"
  19. #include "pointerTo.h"
  20. #include "dSearchPath.h"
  21. class LoaderOptions;
  22. class BamCacheRecord;
  23. /**
  24. * This is the base class for a family of scene-graph file types that the
  25. * Loader supports. Each kind of loader that's available should define a
  26. * corresponding LoaderFileType object and register itself.
  27. */
  28. class EXPCL_PANDA_PGRAPH LoaderFileType : public TypedObject {
  29. protected:
  30. LoaderFileType();
  31. public:
  32. virtual ~LoaderFileType();
  33. PUBLISHED:
  34. virtual std::string get_name() const=0;
  35. virtual std::string get_extension() const=0;
  36. virtual std::string get_additional_extensions() const;
  37. virtual bool supports_compressed() const;
  38. virtual bool get_allow_disk_cache(const LoaderOptions &options) const;
  39. virtual bool get_allow_ram_cache(const LoaderOptions &options) const;
  40. virtual bool supports_load() const;
  41. virtual bool supports_save() const;
  42. public:
  43. virtual PT(PandaNode) load_file(const Filename &path, const LoaderOptions &options,
  44. BamCacheRecord *record) const;
  45. virtual bool save_file(const Filename &path, const LoaderOptions &options,
  46. PandaNode *node) const;
  47. protected:
  48. int _no_cache_flags;
  49. public:
  50. static TypeHandle get_class_type() {
  51. return _type_handle;
  52. }
  53. static void init_type() {
  54. TypedObject::init_type();
  55. register_type(_type_handle, "LoaderFileType",
  56. TypedObject::get_class_type());
  57. }
  58. virtual TypeHandle get_type() const {
  59. return get_class_type();
  60. }
  61. virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
  62. private:
  63. static TypeHandle _type_handle;
  64. };
  65. #endif