Panda3D
eggComment.h
Go to the documentation of this file.
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 eggComment.h
10  * @author drose
11  * @date 1999-01-20
12  */
13 
14 #ifndef EGGCOMMENT_H
15 #define EGGCOMMENT_H
16 
17 #include "pandabase.h"
18 
19 #include "eggNode.h"
20 
21 /**
22  * A comment that appears in an egg file within a <Comment> entry.
23  */
24 class EXPCL_PANDA_EGG EggComment : public EggNode {
25 PUBLISHED:
26  INLINE explicit EggComment(const std::string &node_name, const std::string &comment);
27  INLINE EggComment(const EggComment &copy);
28 
29  // You can use the string operators to directly set and manipulate the
30  // comment.
31 
32  INLINE EggComment &operator = (const std::string &comment);
33  INLINE EggComment &operator = (const EggComment &copy);
34 
35  INLINE operator const std::string & () const;
36 
37  // Or, you can set and get it explicitly.
38 
39  INLINE void set_comment(const std::string &comment);
40  INLINE std::string get_comment() const;
41 
42  virtual void write(std::ostream &out, int indent_level) const;
43 
44 private:
45  std::string _comment;
46 
47 
48 public:
49 
50  static TypeHandle get_class_type() {
51  return _type_handle;
52  }
53  static void init_type() {
54  EggNode::init_type();
55  register_type(_type_handle, "EggComment",
56  EggNode::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 
63 private:
64  static TypeHandle _type_handle;
65 };
66 
67 #include "eggComment.I"
68 
69 #endif
A comment that appears in an egg file within a <Comment> entry.
Definition: eggComment.h:24
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A base class for things that may be directly added into the egg hierarchy.
Definition: eggNode.h:35
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.