Panda3D
|
A definition of a single data element appearing within a template record. More...
#include "xFileDataDef.h"
Public Types | |
enum | Type { T_word, T_dword, T_float, T_double, T_char, T_uchar, T_sword, T_sdword, T_string, T_cstring, T_unicode, T_template } |
![]() | |
typedef pmap< const XFileDataDef *, XFileDataObject * > | PrevData |
Public Member Functions | |
XFileDataDef (XFile *x_file, const string &name, Type type, XFileTemplate *xtemplate=NULL) | |
void | add_array_def (const XFileArrayDef &array_def) |
Adds an additional array dimension to the data description. More... | |
virtual void | clear () |
Removes all children from the node, and otherwise resets it to its initial state. More... | |
virtual bool | fill_zero_data (XFileDataObject *object) const |
This is similar to repack_data(), except it is used to fill the initial values for a newly-created template object to zero. More... | |
virtual TypeHandle | force_init_type () |
const XFileArrayDef & | get_array_def (int i) const |
Returns the description of the nth dimension of array elements on this data object. More... | |
Type | get_data_type () const |
Returns the primitive type of this element, or T_template if this represents a nested template object. More... | |
int | get_num_array_defs () const |
Returns the number of dimensions of array elements on this data object, or 0 if the data object is not an array. More... | |
XFileTemplate * | get_template () const |
If get_data_type() returned T_template, this returns the particular template pointer that this object represents. More... | |
virtual TypeHandle | get_type () const |
virtual bool | matches (const XFileNode *other) const |
Returns true if the node, particularly a template node, is structurally equivalent to the other node (which must be of the same type). More... | |
virtual bool | repack_data (XFileDataObject *object, const XFileParseDataList &parse_data_list, PrevData &prev_data, size_t &index, size_t &sub_index) const |
This is called on the template that defines an object, once the data for the object has been parsed. More... | |
virtual void | write_text (ostream &out, int indent_level) const |
Writes a suitable representation of this node to an .x file in text mode. More... | |
![]() | |
XFileNode (XFile *x_file, const string &name) | |
void | add_child (XFileNode *node) |
Adds the indicated node as a child of this node. More... | |
XFileDataNode * | add_Frame (const string &name) |
Creates a new Frame instance, as a child of this node. More... | |
XFileDataNode * | add_FrameTransformMatrix (const LMatrix4d &mat) |
Creates a new FrameTransformMatrix instance, as a child of this node. More... | |
XFileDataNode * | add_Material (const string &name, const LColor &face_color, double power, const LRGBColor &specular_color, const LRGBColor &emissive_color) |
Creates a new Material instance, as a child of this node. More... | |
XFileDataNode * | add_Mesh (const string &name) |
Creates a new Mesh instance, as a child of this node. More... | |
XFileDataNode * | add_MeshMaterialList (const string &name) |
Creates a new MeshMaterialList instance, as a child of this node. More... | |
XFileDataNode * | add_MeshNormals (const string &name) |
Creates a new MeshNormals instance, as a child of this node. More... | |
XFileDataNode * | add_MeshTextureCoords (const string &name) |
Creates a new MeshTextureCoords instance, as a child of this node. More... | |
XFileDataNode * | add_MeshVertexColors (const string &name) |
Creates a new MeshVertexColors instance, as a child of this node. More... | |
XFileDataNode * | add_TextureFilename (const string &name, const Filename &filename) |
Creates a new TextureFilename instance, as a child of this node. More... | |
XFileNode * | find_child (const string &name) const |
Returns the child with the indicated name, if any, or NULL if none. More... | |
int | find_child_index (const string &name) const |
Returns the index number of the child with the indicated name, if any, or -1 if none. More... | |
int | find_child_index (const XFileNode *child) const |
Returns the index number of the indicated child, or -1 if none. More... | |
XFileNode * | find_descendent (const string &name) const |
Returns the first child or descendent found with the indicated name after a depth-first search, if any, or NULL if none. More... | |
XFileNode * | get_child (int n) const |
Returns the nth child of this node. More... | |
virtual const WindowsGuid & | get_guid () const |
If has_guid() returned true, returns the particular GUID associated with this node. More... | |
int | get_num_children () const |
Returns the list of children of this node. More... | |
int | get_num_objects () const |
Returns the list of child objects of this node. More... | |
XFileDataNode * | get_object (int n) const |
Returns the nth child object of this node. More... | |
XFile * | get_x_file () const |
virtual bool | has_guid () const |
Returns true if this node has a GUID associated. More... | |
virtual bool | is_object () const |
Returns true if this node represents a data object that is the instance of some template, or false otherwise. More... | |
virtual bool | is_reference () const |
Returns true if this node represents an indirect reference to an object defined previously in the file. More... | |
virtual bool | is_standard_object (const string &template_name) const |
Returns true if this node represents an instance of the standard template with the indicated name, or false otherwise. More... | |
virtual bool | is_template_def () const |
Returns true if this node represents the definition of some template. More... | |
![]() | |
TypedObject (const TypedObject ©) | |
TypedObject * | as_typed_object () |
Returns the object, upcast (if necessary) to a TypedObject pointer. More... | |
const TypedObject * | as_typed_object () const |
Returns the object, upcast (if necessary) to a TypedObject pointer. More... | |
int | get_best_parent_from_Set (const std::set< int > &) const |
int | get_type_index () const |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More... | |
bool | is_exact_type (TypeHandle handle) const |
Returns true if the current object is the indicated type exactly. More... | |
bool | is_of_type (TypeHandle handle) const |
Returns true if the current object is or derives from the indicated type. More... | |
void | operator= (const TypedObject ©) |
![]() | |
Namable (const string &initial_name="") | |
Namable (const Namable ©) | |
void | clear_name () |
Resets the Namable's name to empty. More... | |
const string & | get_name () const |
bool | has_name () const |
Returns true if the Namable has a nonempty name set, false if the name is empty. More... | |
Namable & | operator= (const Namable &other) |
void | output (ostream &out) const |
Outputs the Namable. More... | |
void | set_name (const string &name) |
![]() | |
int | get_ref_count () const |
Returns the current reference count. More... | |
WeakReferenceList * | get_weak_list () const |
Returns the WeakReferenceList associated with this ReferenceCount object. More... | |
bool | has_weak_list () const |
Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. More... | |
void | local_object () |
This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. More... | |
void | ref () const |
Explicitly increments the reference count. More... | |
bool | test_ref_count_integrity () const |
Does some easy checks to make sure that the reference count isn't completely bogus. More... | |
bool | test_ref_count_nonzero () const |
Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More... | |
virtual bool | unref () const |
Explicitly decrements the reference count. More... | |
void | weak_ref (WeakPointerToVoid *ptv) |
Adds the indicated PointerToVoid as a weak reference to this object. More... | |
void | weak_unref (WeakPointerToVoid *ptv) |
Removes the indicated PointerToVoid as a weak reference to this object. More... | |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
static string | make_nice_name (const string &str) |
Transforms the indicated egg name to a name that is acceptable for a node in the X File format. More... | |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
This function is declared non-inline to work around a compiler bug in g++ 2.96. More... | |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
A definition of a single data element appearing within a template record.
This class represents the definition* of the data element (e.g. DWORD nVertices); see XFileDataObject for its *value* (e.g. 12).
Definition at line 35 of file xFileDataDef.h.
void XFileDataDef::add_array_def | ( | const XFileArrayDef & | array_def | ) |
Adds an additional array dimension to the data description.
Definition at line 56 of file xFileDataDef.cxx.
References write_text().
Referenced by clear().
|
virtual |
Removes all children from the node, and otherwise resets it to its initial state.
Reimplemented from XFileNode.
Definition at line 44 of file xFileDataDef.cxx.
References add_array_def(), and XFileNode::clear().
|
virtual |
This is similar to repack_data(), except it is used to fill the initial values for a newly-created template object to zero.
Reimplemented from XFileNode.
Definition at line 210 of file xFileDataDef.cxx.
References XFileNode::fill_zero_data(), and matches().
Referenced by repack_data().
|
inline |
Returns the description of the nth dimension of array elements on this data object.
Definition at line 73 of file xFileDataDef.I.
Referenced by get_num_array_defs(), and matches().
|
inline |
Returns the primitive type of this element, or T_template if this represents a nested template object.
Definition at line 38 of file xFileDataDef.I.
References get_template().
Referenced by matches().
|
inline |
Returns the number of dimensions of array elements on this data object, or 0 if the data object is not an array.
Definition at line 62 of file xFileDataDef.I.
References get_array_def().
Referenced by get_template(), and matches().
|
inline |
If get_data_type() returned T_template, this returns the particular template pointer that this object represents.
Definition at line 50 of file xFileDataDef.I.
References get_num_array_defs().
Referenced by get_data_type(), and matches().
|
virtual |
Returns true if the node, particularly a template node, is structurally equivalent to the other node (which must be of the same type).
This checks data element types, but does not compare data element names.
Reimplemented from XFileNode.
Definition at line 257 of file xFileDataDef.cxx.
References XFileDataObject::add_element(), get_array_def(), get_data_type(), get_num_array_defs(), get_template(), XFileArrayDef::matches(), XFileTemplate::matches(), and XFileNode::matches().
Referenced by fill_zero_data().
|
virtual |
This is called on the template that defines an object, once the data for the object has been parsed.
It is responsible for identifying which component of the template owns each data element, and packing the data elements appropriately back into the object.
It returns true on success, or false on an error (e.g. not enough data elements, mismatched data type).
Reimplemented from XFileNode.
Definition at line 150 of file xFileDataDef.cxx.
References fill_zero_data(), and XFileNode::repack_data().
Referenced by write_text().
|
virtual |
Writes a suitable representation of this node to an .x file in text mode.
Reimplemented from XFileNode.
Definition at line 67 of file xFileDataDef.cxx.
References Namable::has_name(), and repack_data().
Referenced by add_array_def().