Panda3D
Loading...
Searching...
No Matches
xFileDataNode.cxx
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 xFileDataNode.cxx
10 * @author drose
11 * @date 2004-10-08
12 */
13
14#include "xFileDataNode.h"
15#include "indent.h"
16
17TypeHandle XFileDataNode::_type_handle;
18
19/**
20 *
21 */
22XFileDataNode::
23XFileDataNode(XFile *x_file, const std::string &name,
24 XFileTemplate *xtemplate) :
25 XFileNode(x_file, name),
26 _template(xtemplate)
27{
28}
29
30/**
31 * Returns true if this node represents a data object that is the instance of
32 * some template, or false otherwise. This also returns true for references
33 * to objects (which are generally treated just like the objects themselves).
34 *
35 * If this returns true, the node must be of type XFileDataNode (it is either
36 * an XFileDataNodeTemplate or an XFileDataNodeReference).
37 */
39is_object() const {
40 return true;
41}
42
43/**
44 * Returns true if this node represents an instance of the standard template
45 * with the indicated name, or false otherwise. If this returns true, the
46 * object must be of type XFileDataNode.
47 */
49is_standard_object(const std::string &template_name) const {
50 if (_template->is_standard() &&
51 _template->get_name() == template_name) {
52 return true;
53 }
54
55 return false;
56}
57
58/**
59 * Returns a string that represents the type of object this data object
60 * represents.
61 */
62std::string XFileDataNode::
63get_type_name() const {
64 return _template->get_name();
65}
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
virtual bool is_object() const
Returns true if this node represents a data object that is the instance of some template,...
virtual std::string get_type_name() const
Returns a string that represents the type of object this data object represents.
virtual bool is_standard_object(const std::string &template_name) const
Returns true if this node represents an instance of the standard template with the indicated name,...
A single node of an X file.
Definition xFileNode.h:40
A template definition in the X file.
This represents the complete contents of an X file (file.x) in memory.
Definition xFile.h:32
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.