Panda3D
|
A template definition in the X file. More...
#include "xFileTemplate.h"
Public Member Functions | |
XFileTemplate (XFile *x_file, const string &name, const WindowsGuid &guid) | |
void | add_option (XFileTemplate *option) |
Adds a new type to the list of allowable types of child nodes for an instance of this template. | |
virtual void | clear () |
Removes all children from the node, and otherwise resets it to its initial state. | |
virtual TypeHandle | force_init_type () |
virtual const WindowsGuid & | get_guid () const |
Returns the GUID associated with this template. | |
int | get_num_options () const |
Returns the number of templates on the options list. | |
bool | get_open () const |
Returns whether the template is considered "open" or not. | |
XFileTemplate * | get_option (int n) const |
Returns the nth template on the options list. | |
virtual TypeHandle | get_type () const |
virtual bool | has_guid () const |
Returns true if this node has a GUID associated. | |
bool | is_standard () const |
Returns true if this particular template is one of the "standard" templates defined by standardTemplates.x in this directory (and compiled into the binary), or false if it is a user-custom template. | |
virtual bool | is_template_def () const |
Returns true if this node represents the definition of some template. | |
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). | |
void | set_open (bool open) |
Sets whether the template is considered "open" or not. | |
virtual void | write_text (ostream &out, int indent_level) const |
Writes a suitable representation of this node to an .x file in text mode. | |
Static Public Member Functions | |
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. | |
Friends | |
class | XFile |
A template definition in the X file.
This defines the data structures that may be subsequently read.
Definition at line 29 of file xFileTemplate.h.
void XFileTemplate::add_option | ( | XFileTemplate * | option | ) | [inline] |
Adds a new type to the list of allowable types of child nodes for an instance of this template.
Definition at line 65 of file xFileTemplate.I.
void XFileTemplate::clear | ( | void | ) | [virtual] |
Removes all children from the node, and otherwise resets it to its initial state.
Reimplemented from XFileNode.
Definition at line 89 of file xFileTemplate.cxx.
const WindowsGuid & XFileTemplate::get_guid | ( | ) | const [virtual] |
Returns the GUID associated with this template.
Reimplemented from XFileNode.
Definition at line 60 of file xFileTemplate.cxx.
Referenced by write_text().
int XFileTemplate::get_num_options | ( | ) | const [inline] |
Returns the number of templates on the options list.
Definition at line 76 of file xFileTemplate.I.
bool XFileTemplate::get_open | ( | ) | const [inline] |
Returns whether the template is considered "open" or not.
If it is open (this flag is true), the set of options is ignored and the instances of this template may include any types of children. If it is closed (false), only the named types may be added.
Definition at line 54 of file xFileTemplate.I.
Referenced by write_text().
XFileTemplate * XFileTemplate::get_option | ( | int | n | ) | const [inline] |
Returns the nth template on the options list.
Definition at line 86 of file xFileTemplate.I.
bool XFileTemplate::has_guid | ( | ) | const [virtual] |
Returns true if this node has a GUID associated.
Reimplemented from XFileNode.
Definition at line 50 of file xFileTemplate.cxx.
static void XFileTemplate::init_type | ( | ) | [inline, static] |
This function is declared non-inline to work around a compiler bug in g++ 2.96.
Making it inline seems to cause problems in the optimizer.
Reimplemented from XFileNode.
Definition at line 65 of file xFileTemplate.h.
bool XFileTemplate::is_standard | ( | ) | const [inline] |
Returns true if this particular template is one of the "standard" templates defined by standardTemplates.x in this directory (and compiled into the binary), or false if it is a user-custom template.
Definition at line 26 of file xFileTemplate.I.
bool XFileTemplate::is_template_def | ( | ) | const [virtual] |
Returns true if this node represents the definition of some template.
This is the template definition, not an actual data object that represents an instance of the template. If the file strictly uses standard templates, the presence of template definitions is optional.
If this returns true, the node must be of type XFileTemplate.
Reimplemented from XFileNode.
Definition at line 78 of file xFileTemplate.cxx.
bool XFileTemplate::matches | ( | const XFileNode * | other | ) | const [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 144 of file xFileTemplate.cxx.
References XFileNode::matches().
Referenced by XFile::find_template(), and XFileDataDef::matches().
void XFileTemplate::set_open | ( | bool | open | ) | [inline] |
Sets whether the template is considered "open" or not.
If it is open (this flag is true), the set of options is ignored and the instances of this template may include any types of children. If it is closed (false), only the named types may be added.
Definition at line 40 of file xFileTemplate.I.
void XFileTemplate::write_text | ( | ostream & | out, |
int | indent_level | ||
) | const [virtual] |
Writes a suitable representation of this node to an .x file in text mode.
Reimplemented from XFileNode.
Definition at line 101 of file xFileTemplate.cxx.
References get_guid(), and get_open().