Panda3D

xFileDataNode.cxx

00001 // Filename: xFileDataNode.cxx
00002 // Created by:  drose (08Oct04)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #include "xFileDataNode.h"
00016 #include "indent.h"
00017 
00018 TypeHandle XFileDataNode::_type_handle;
00019 
00020 ////////////////////////////////////////////////////////////////////
00021 //     Function: XFileDataNode::Constructor
00022 //       Access: Public
00023 //  Description:
00024 ////////////////////////////////////////////////////////////////////
00025 XFileDataNode::
00026 XFileDataNode(XFile *x_file, const string &name,
00027               XFileTemplate *xtemplate) :
00028   XFileNode(x_file, name),
00029   _template(xtemplate)
00030 {
00031 }
00032 
00033 ////////////////////////////////////////////////////////////////////
00034 //     Function: XFileDataNode::is_object
00035 //       Access: Public, Virtual
00036 //  Description: Returns true if this node represents a data object
00037 //               that is the instance of some template, or false
00038 //               otherwise.  This also returns true for references to
00039 //               objects (which are generally treated just like the
00040 //               objects themselves).
00041 //
00042 //               If this returns true, the node must be of type
00043 //               XFileDataNode (it is either an XFileDataNodeTemplate
00044 //               or an XFileDataNodeReference).
00045 ////////////////////////////////////////////////////////////////////
00046 bool XFileDataNode::
00047 is_object() const {
00048   return true;
00049 }
00050 
00051 ////////////////////////////////////////////////////////////////////
00052 //     Function: XFileDataNode::is_standard_object
00053 //       Access: Public, Virtual
00054 //  Description: Returns true if this node represents an instance of
00055 //               the standard template with the indicated name, or
00056 //               false otherwise.  If this returns true, the object
00057 //               must be of type XFileDataNode.
00058 ////////////////////////////////////////////////////////////////////
00059 bool XFileDataNode::
00060 is_standard_object(const string &template_name) const {
00061   if (_template->is_standard() &&
00062       _template->get_name() == template_name) {
00063     return true;
00064   }
00065 
00066   return false;
00067 }
00068 
00069 ////////////////////////////////////////////////////////////////////
00070 //     Function: XFileDataNode::get_type_name
00071 //       Access: Public, Virtual
00072 //  Description: Returns a string that represents the type of object
00073 //               this data object represents.
00074 ////////////////////////////////////////////////////////////////////
00075 string XFileDataNode::
00076 get_type_name() const {
00077   return _template->get_name();
00078 }
 All Classes Functions Variables Enumerations