Go to the documentation of this file.
98 nassertr(xtemplate !=
nullptr, *
this);
115 nassertr(xtemplate !=
nullptr, *
this);
130 nassertr(xtemplate !=
nullptr, *
this);
136 (*node)[
"index"] = index;
137 (*node)[
"indexColor"] = LCAST(
double, color);
148 nassertr(xtemplate !=
nullptr, *
this);
174 out <<
"(" << get_type() <<
"::output_data() not implemented.)";
181 write_data(std::ostream &out,
int indent_level,
const char *)
const {
183 <<
"(" << get_type() <<
"::write_data() not implemented.)\n";
189 void XFileDataObject::
190 set_int_value(
int int_value) {
198 void XFileDataObject::
199 set_double_value(
double double_value) {
201 <<
get_type_name() <<
" does not support floating-point values.\n";
207 void XFileDataObject::
208 set_string_value(
const string &string_value) {
218 void XFileDataObject::
219 store_double_array(
int num_elements,
const double *values) {
220 if (get_num_elements() != num_elements) {
223 << num_elements <<
" values.\n";
227 for (
int i = 0;
i < num_elements;
i++) {
228 get_element(
i)->set_double_value(values[
i]);
236 int XFileDataObject::
237 get_int_value()
const {
244 double XFileDataObject::
245 get_double_value()
const {
252 string XFileDataObject::
253 get_string_value()
const {
262 void XFileDataObject::
263 get_double_array(
int num_elements,
double *values)
const {
264 if (get_num_elements() != num_elements) {
267 << num_elements <<
" values.\n";
271 for (
int i = 0;
i < num_elements;
i++) {
280 int XFileDataObject::
281 get_num_elements()
const {
291 <<
"Looking for [" << n <<
"] within data object of type "
292 <<
get_type_name() <<
", does not support nested objects.\n";
301 get_element(
const string &name) {
303 <<
"Looking for [\"" << name <<
"\"] within data object of type "
304 <<
get_type_name() <<
", does not support nested objects.\n";
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual void write_data(std::ostream &out, int indent_level, const char *separator) const
Writes a suitable representation of this node to an .x file in text mode.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_name
Returns the name of the type.
XFileDataObject & add_string(const std::string &string_value)
Appends a new string value to the data object, if it makes sense to do so.
XFileDataObject & add_MeshFace(XFile *x_file)
Appends a new MeshFace instance.
The abstract base class for a number of different types of data elements that may be stored in the X ...
An integer-valued data element.
virtual std::string get_type_name() const
Returns a string that represents the type of object this data object represents.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
XFileDataObject & add_Vector(XFile *x_file, const LVecBase3d &vector)
Appends a new Vector instance.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This represents the complete contents of an X file (file.x) in memory.
const XFileDataDef * get_data_def() const
Returns the data object that this object is represented by, if any, or NULL if there is none.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
An string-valued data element.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A template definition in the X file.
XFileDataObject & add_Coords2d(XFile *x_file, const LVecBase2d &coords)
Appends a new Coords2d instance.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a node which contains all of the data elements defined by a template.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static XFileTemplate * find_standard_template(const std::string &name)
Returns the standard template associated with the indicated name, if any, or NULL if none.
XFileDataObject & add_int(int int_value)
Appends a new integer value to the data object, if it makes sense to do so.
XFileDataObject & add_IndexedColor(XFile *x_file, int index, const LColor &color)
Appends a new IndexedColor instance.
virtual void output_data(std::ostream &out) const
Writes a suitable representation of this node to an .x file in text mode.
void set(int int_value)
Stores the indicated integer value into the object, if it makes sense to do so.
An double-valued data element.
int i() const
Unambiguously returns the object's representation as an integer, or 0 if the object has no integer re...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual bool is_complex_object() const
Returns true if this kind of data object is a complex object that can hold nested data elements,...
virtual bool add_element(XFileDataObject *element)
Adds the indicated element as a nested data element, if this data object type supports it.
XFileDataObject & add_double(double double_value)
Appends a new floating-point value to the data object, if it makes sense to do so.
void zero_fill()
Fills the data node with zero-valued elements appropriate to the template.