Panda3D

xFileDataObjectInteger.cxx

00001 // Filename: xFileDataObjectInteger.cxx
00002 // Created by:  drose (07Oct04)
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 "xFileDataObjectInteger.h"
00016 #include "string_utils.h"
00017 #include "indent.h"
00018 
00019 TypeHandle XFileDataObjectInteger::_type_handle;
00020 
00021 ////////////////////////////////////////////////////////////////////
00022 //     Function: XFileDataObjectInteger::Constructor
00023 //       Access: Public
00024 //  Description: 
00025 ////////////////////////////////////////////////////////////////////
00026 XFileDataObjectInteger::
00027 XFileDataObjectInteger(const XFileDataDef *data_def, int value) :
00028   XFileDataObject(data_def),
00029   _value(value)
00030 {
00031 }
00032 
00033 ////////////////////////////////////////////////////////////////////
00034 //     Function: XFileDataObjectInteger::output_data
00035 //       Access: Public, Virtual
00036 //  Description: Writes a suitable representation of this node to an
00037 //               .x file in text mode.
00038 ////////////////////////////////////////////////////////////////////
00039 void XFileDataObjectInteger::
00040 output_data(ostream &out) const {
00041   out << _value;
00042 }
00043 
00044 ////////////////////////////////////////////////////////////////////
00045 //     Function: XFileDataObjectInteger::write_data
00046 //       Access: Public, Virtual
00047 //  Description: Writes a suitable representation of this node to an
00048 //               .x file in text mode.
00049 ////////////////////////////////////////////////////////////////////
00050 void XFileDataObjectInteger::
00051 write_data(ostream &out, int indent_level, const char *separator) const {
00052   indent(out, indent_level)
00053     << _value << separator << "\n";
00054 }
00055 
00056 ////////////////////////////////////////////////////////////////////
00057 //     Function: XFileDataObjectInt::set_int_value
00058 //       Access: Protected, Virtual
00059 //  Description: Sets the object's value as an integer, if this is
00060 //               legal.
00061 ////////////////////////////////////////////////////////////////////
00062 void XFileDataObjectInteger::
00063 set_int_value(int int_value) {
00064   _value = int_value;
00065 }
00066 
00067 ////////////////////////////////////////////////////////////////////
00068 //     Function: XFileDataObjectInteger::get_int_value
00069 //       Access: Protected, Virtual
00070 //  Description: Returns the object's representation as an integer, if
00071 //               it has one.
00072 ////////////////////////////////////////////////////////////////////
00073 int XFileDataObjectInteger::
00074 get_int_value() const {
00075   return _value;
00076 }
00077 
00078 ////////////////////////////////////////////////////////////////////
00079 //     Function: XFileDataObjectInteger::get_double_value
00080 //       Access: Protected, Virtual
00081 //  Description: Returns the object's representation as a double, if
00082 //               it has one.
00083 ////////////////////////////////////////////////////////////////////
00084 double XFileDataObjectInteger::
00085 get_double_value() const {
00086   return _value;
00087 }
00088 
00089 ////////////////////////////////////////////////////////////////////
00090 //     Function: XFileDataObjectInteger::get_string_value
00091 //       Access: Protected, Virtual
00092 //  Description: Returns the object's representation as a string, if
00093 //               it has one.
00094 ////////////////////////////////////////////////////////////////////
00095 string XFileDataObjectInteger::
00096 get_string_value() const {
00097   return format_string(_value);
00098 }
 All Classes Functions Variables Enumerations