eggComment.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // Filename: eggComment.h
  2. // Created by: drose (20Jan99)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001, 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://www.panda3d.org/license.txt .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. #ifndef EGGCOMMENT_H
  19. #define EGGCOMMENT_H
  20. #include <pandabase.h>
  21. #include "eggNode.h"
  22. #include <string>
  23. ///////////////////////////////////////////////////////////////////
  24. // Class : EggComment
  25. // Description : A comment that appears in an egg file within a
  26. // <Comment> entry.
  27. ////////////////////////////////////////////////////////////////////
  28. class EXPCL_PANDAEGG EggComment : public EggNode {
  29. public:
  30. INLINE EggComment(const string &node_name, const string &comment);
  31. INLINE EggComment(const EggComment &copy);
  32. // You can use the string operators to directly set and manipulate
  33. // the comment.
  34. INLINE EggComment &operator = (const string &comment);
  35. INLINE EggComment &operator = (const EggComment &copy);
  36. INLINE operator const string & () const;
  37. // Or, you can set and get it explicitly.
  38. INLINE void set_comment(const string &comment);
  39. INLINE string get_comment() const;
  40. virtual void write(ostream &out, int indent_level) const;
  41. private:
  42. string _comment;
  43. public:
  44. static TypeHandle get_class_type() {
  45. return _type_handle;
  46. }
  47. static void init_type() {
  48. EggNode::init_type();
  49. register_type(_type_handle, "EggComment",
  50. EggNode::get_class_type());
  51. }
  52. virtual TypeHandle get_type() const {
  53. return get_class_type();
  54. }
  55. virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
  56. private:
  57. static TypeHandle _type_handle;
  58. };
  59. #include "eggComment.I"
  60. #endif