Panda3D
vrmlNode.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 vrmlNode.h
10  * @author drose
11  * @date 1999-06-23
12  */
13 
14 #ifndef VRMLNODE_H
15 #define VRMLNODE_H
16 
17 #include "pandatoolbase.h"
18 
19 #include "vrmlNodeType.h"
20 #include "pvector.h"
21 #include "pmap.h"
22 
23 class VrmlNode {
24 public:
25  VrmlNode(const VrmlNodeType *type);
26  ~VrmlNode();
27 
28  const VrmlFieldValue &get_value(const char *field_name) const;
29 
30  void output(std::ostream &out, int indent) const;
31 
32  class Field {
33  public:
34  Field() { }
35  Field(const VrmlNodeType::NameTypeRec *type, const VrmlFieldValue &value) :
36  _type(type), _value(value) { }
37  const VrmlNodeType::NameTypeRec *_type;
38  VrmlFieldValue _value;
39  };
40 
41  typedef std::vector<Field> Fields;
42  Fields _fields;
43 
44  int _use_count;
45 
46  const VrmlNodeType *_type;
47 };
48 
49 inline std::ostream &operator << (std::ostream &out, const VrmlNode &node) {
50  node.output(out, 0);
51  return out;
52 }
53 
54 class Declaration {
55 public:
56  SFNodeRef _node;
57 
58  void output(std::ostream &out, int indent) const;
59 };
60 
61 inline std::ostream &operator << (std::ostream &out, const Declaration &dec) {
62  dec.output(out, 0);
63  return out;
64 }
65 
67 
68 std::ostream &operator << (std::ostream &out, const VrmlScene &scene);
69 
70 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is our own Panda specialization on the default STL vector.
Definition: pvector.h:42
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
Definition: indent.cxx:20
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.