eggFilenameNode.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // Filename: eggFilenameNode.h
  2. // Created by: drose (11Feb99)
  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 EGGFILENAMENODE_H
  19. #define EGGFILENAMENODE_H
  20. #include "pandabase.h"
  21. #include "eggNode.h"
  22. #include "filename.h"
  23. ////////////////////////////////////////////////////////////////////
  24. // Class : EggFilenameNode
  25. // Description : This is an egg node that contains a filename. It
  26. // references a physical file relative to the directory
  27. // the egg file was loaded in. It is a base class for
  28. // EggTexture and EggExternalReference.
  29. ////////////////////////////////////////////////////////////////////
  30. class EXPCL_PANDAEGG EggFilenameNode : public EggNode {
  31. PUBLISHED:
  32. INLINE EggFilenameNode();
  33. INLINE EggFilenameNode(const string &node_name, const Filename &filename);
  34. INLINE EggFilenameNode(const EggFilenameNode &copy);
  35. INLINE EggFilenameNode &operator = (const EggFilenameNode &copy);
  36. virtual string get_default_extension() const;
  37. INLINE const Filename &get_filename() const;
  38. INLINE void set_filename(const Filename &filename);
  39. INLINE const Filename &get_fullpath() const;
  40. INLINE void set_fullpath(const Filename &fullpath);
  41. public:
  42. class IndirectOrderByBasename {
  43. public:
  44. bool operator () (const EggFilenameNode *a, const EggFilenameNode *b) const {
  45. return a->get_filename().get_basename() < b->get_filename().get_basename();
  46. }
  47. };
  48. protected:
  49. Filename _filename;
  50. Filename _fullpath;
  51. public:
  52. static TypeHandle get_class_type() {
  53. return _type_handle;
  54. }
  55. static void init_type() {
  56. EggNode::init_type();
  57. register_type(_type_handle, "EggFilenameNode",
  58. EggNode::get_class_type());
  59. }
  60. virtual TypeHandle get_type() const {
  61. return get_class_type();
  62. }
  63. virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
  64. private:
  65. static TypeHandle _type_handle;
  66. };
  67. #include "eggFilenameNode.I"
  68. #endif