15 #ifndef XFILEDATAOBJECT_H
16 #define XFILEDATAOBJECT_H
18 #include "pandatoolbase.h"
19 #include "referenceCount.h"
20 #include "pointerTo.h"
36 virtual ~XFileDataObject();
45 INLINE
void operator = (
const string &string_value);
51 INLINE
void set(
int int_value);
52 INLINE
void set(
double double_value);
53 INLINE
void set(
const string &string_value);
60 INLINE
double d()
const;
61 INLINE
string s()
const;
67 INLINE
int size()
const;
68 INLINE
const XFileDataObject &
operator [] (
int n)
const;
69 INLINE
const XFileDataObject &
operator [] (
const string &name)
const;
72 INLINE XFileDataObject &
operator [] (
const string &name);
77 XFileDataObject &
add_int(
int int_value);
78 XFileDataObject &
add_double(
double double_value);
79 XFileDataObject &
add_string(
const string &string_value);
94 virtual void write_data(ostream &out,
int indent_level,
95 const char *separator)
const;
98 virtual void set_int_value(
int int_value);
99 virtual void set_double_value(
double double_value);
100 virtual void set_string_value(
const string &string_value);
101 void store_double_array(
int num_elements,
const double *values);
103 virtual int get_int_value()
const;
104 virtual double get_double_value()
const;
105 virtual string get_string_value()
const;
106 void get_double_array(
int num_elements,
double *values)
const;
108 virtual int get_num_elements()
const;
109 virtual XFileDataObject *get_element(
int n);
110 virtual XFileDataObject *get_element(
const string &name);
118 static void init_type() {
119 ReferenceCount::init_type();
120 register_type(_type_handle,
"XFileDataObject",
121 ReferenceCount::get_class_type());
124 return get_class_type();
126 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
132 INLINE ostream &operator << (ostream &out,
const XFileDataObject &data_object);
134 #include "xFileDataObject.I"
LVecBase4d vec4() const
Returns the object's representation as an LVecBase4d.
This is a 4-by-4 transform matrix.
virtual void write_data(ostream &out, int indent_level, const char *separator) const
Writes a suitable representation of this node to an .x file in text mode.
virtual bool add_element(XFileDataObject *element)
Adds the indicated element as a nested data element, if this data object type supports it...
XFileDataObject & add_int(int int_value)
Appends a new integer value to the data object, if it makes sense to do so.
This is the base class for all two-component vectors and points.
LVecBase3d vec3() const
Returns the object's representation as an LVecBase3d.
virtual string get_type_name() const
Returns a string that represents the type of object this data object represents.
virtual void output_data(ostream &out) const
Writes a suitable representation of this node to an .x file in text mode.
string s() const
Unambiguously returns the object's representation as a string, or empty string if the object has no s...
LMatrix4d mat4() const
Returns the object's representation as an LMatrix4d.
XFileDataObject & add_MeshFace(XFile *x_file)
Appends a new MeshFace instance.
This is the base class for all three-component vectors and points.
int size() const
Returns the number of nested data objects within this object.
A definition of a single data element appearing within a template record.
const XFileDataDef * get_data_def() const
Returns the data object that this object is represented by, if any, or NULL if there is none...
XFileDataObject & add_Vector(XFile *x_file, const LVecBase3d &vector)
Appends a new Vector instance.
XFileDataObject & add_Coords2d(XFile *x_file, const LVecBase2d &coords)
Appends a new Coords2d instance.
const XFileDataObject & operator[](int n) const
Returns the nth nested object within this object.
XFileDataObject & add_IndexedColor(XFile *x_file, int index, const LColor &color)
Appends a new IndexedColor instance.
LVecBase2d vec2() const
Returns the object's representation as an LVecBase2d.
void set(int int_value)
Stores the indicated integer value into the object, if it makes sense to do so.
XFileDataObject & add_double(double double_value)
Appends a new floating-point value to the data object, if it makes sense to do so.
XFileDataObject & add_string(const string &string_value)
Appends a new string value to the data object, if it makes sense to do so.
virtual bool is_complex_object() const
Returns true if this kind of data object is a complex object that can hold nested data elements...
This is the base class for all three-component vectors and points.
This is the base class for all three-component vectors and points.
A base class for all things that want to be reference-counted.
void operator=(int int_value)
Stores the indicated integer value into the object, if it makes sense to do so.
This represents the complete contents of an X file (file.x) in memory.
TypeHandle is the identifier used to differentiate C++ class types.
The abstract base class for a number of different types of data elements that may be stored in the X ...
int i() const
Unambiguously returns the object's representation as an integer, or 0 if the object has no integer re...
double d() const
Unambiguously returns the object's representation as a double, or 0.0 if the object has no double rep...