Panda3D
xFileTemplate.I
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file xFileTemplate.I
10  * @author drose
11  * @date 2004-10-03
12  */
13 
14 /**
15  * Returns true if this particular template is one of the "standard" templates
16  * defined by standardTemplates.x in this directory (and compiled into the
17  * binary), or false if it is a user-custom template.
18  */
19 INLINE bool XFileTemplate::
20 is_standard() const {
21  return _is_standard;
22 }
23 
24 /**
25  * Sets whether the template is considered "open" or not. If it is open (this
26  * flag is true), the set of options is ignored and the instances of this
27  * template may include any types of children. If it is closed (false), only
28  * the named types may be added.
29  */
30 INLINE void XFileTemplate::
31 set_open(bool open) {
32  _open = open;
33 }
34 
35 /**
36  * Returns whether the template is considered "open" or not. If it is open
37  * (this flag is true), the set of options is ignored and the instances of
38  * this template may include any types of children. If it is closed (false),
39  * only the named types may be added.
40  */
41 INLINE bool XFileTemplate::
42 get_open() const {
43  return _open;
44 }
45 
46 /**
47  * Adds a new type to the list of allowable types of child nodes for an
48  * instance of this template.
49  */
50 INLINE void XFileTemplate::
52  _options.push_back(option);
53 }
54 
55 /**
56  * Returns the number of templates on the options list.
57  */
58 INLINE int XFileTemplate::
59 get_num_options() const {
60  return _options.size();
61 }
62 
63 /**
64  * Returns the nth template on the options list.
65  */
67 get_option(int n) const {
68  nassertr(n >= 0 && n < (int)_options.size(), nullptr);
69  return _options[n];
70 }
void add_option(XFileTemplate *option)
Adds a new type to the list of allowable types of child nodes for an instance of this template.
Definition: xFileTemplate.I:51
XFileTemplate * get_option(int n) const
Returns the nth template on the options list.
Definition: xFileTemplate.I:67
void set_open(bool open)
Sets whether the template is considered "open" or not.
Definition: xFileTemplate.I:31
bool is_standard() const
Returns true if this particular template is one of the "standard" templates defined by standardTempla...
Definition: xFileTemplate.I:20
int get_num_options() const
Returns the number of templates on the options list.
Definition: xFileTemplate.I:59
A template definition in the X file.
Definition: xFileTemplate.h:27
bool get_open() const
Returns whether the template is considered "open" or not.
Definition: xFileTemplate.I:42