14 #ifndef XFILEDATAOBJECT_H 15 #define XFILEDATAOBJECT_H 42 INLINE
void operator = (
const std::string &string_value);
43 INLINE
void operator = (
const LVecBase2d &vec);
44 INLINE
void operator = (
const LVecBase3d &vec);
45 INLINE
void operator = (
const LVecBase4d &vec);
48 INLINE
void set(
int int_value);
49 INLINE
void set(
double double_value);
50 INLINE
void set(
const std::string &string_value);
51 INLINE
void set(
const LVecBase2d &vec);
52 INLINE
void set(
const LVecBase3d &vec);
53 INLINE
void set(
const LVecBase4d &vec);
54 INLINE
void set(
const LMatrix4d &mat);
57 INLINE
double d()
const;
58 INLINE std::string
s()
const;
59 INLINE LVecBase2d
vec2()
const;
60 INLINE LVecBase3d
vec3()
const;
61 INLINE LVecBase4d
vec4()
const;
62 INLINE LMatrix4d
mat4()
const;
64 INLINE
int size()
const;
91 virtual void write_data(std::ostream &out,
int indent_level,
92 const char *separator)
const;
95 virtual void set_int_value(
int int_value);
96 virtual void set_double_value(
double double_value);
97 virtual void set_string_value(
const std::string &string_value);
98 void store_double_array(
int num_elements,
const double *values);
100 virtual int get_int_value()
const;
101 virtual double get_double_value()
const;
102 virtual std::string get_string_value()
const;
103 void get_double_array(
int num_elements,
double *values)
const;
105 virtual int get_num_elements()
const;
115 static void init_type() {
116 ReferenceCount::init_type();
118 ReferenceCount::get_class_type());
121 return get_class_type();
123 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
129 INLINE std::ostream &operator << (std::ostream &out,
const XFileDataObject &data_object);
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual void output_data(std::ostream &out) const
Writes a suitable representation of this node to an .x file in text mode.
std::string s() const
Unambiguously returns the object's representation as a string, or empty string if the object has no s...
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
int i() const
Unambiguously returns the object's representation as an integer, or 0 if the object has no integer re...
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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_MeshFace(XFile *x_file)
Appends a new MeshFace instance.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A definition of a single data element appearing within a template record.
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.
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.
XFileDataObject & add_IndexedColor(XFile *x_file, int index, const LColor &color)
Appends a new IndexedColor instance.
LVecBase4d vec4() const
Returns the object's representation as an LVecBase4d.
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.
virtual std::string get_type_name() const
Returns a string that represents the type of object this data object represents.
int size() const
Returns the number of nested data objects within this object.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A base class for all things that want to be reference-counted.
LVecBase2d vec2() const
Returns the object's representation as an LVecBase2d.
LMatrix4d mat4() const
Returns the object's representation as an LMatrix4d.
XFileDataObject & add_string(const std::string &string_value)
Appends a new string value to the data object, if it makes sense to do so.
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.
virtual bool is_complex_object() const
Returns true if this kind of data object is a complex object that can hold nested data elements,...
double d() const
Unambiguously returns the object's representation as a double, or 0.0 if the object has no double rep...
TypeHandle is the identifier used to differentiate C++ class types.
LVecBase3d vec3() const
Returns the object's representation as an LVecBase3d.
const XFileDataObject & operator [](int n) const
Returns the nth nested object within this object.
The abstract base class for a number of different types of data elements that may be stored in the X ...