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