Panda3D

xFileTemplate.I

00001 // Filename: xFileTemplate.I
00002 // Created by:  drose (03Oct04)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 
00016 ////////////////////////////////////////////////////////////////////
00017 //     Function: XFileTemplate::is_standard
00018 //       Access: Public
00019 //  Description: Returns true if this particular template is one of
00020 //               the "standard" templates defined by
00021 //               standardTemplates.x in this directory (and compiled
00022 //               into the binary), or false if it is a user-custom
00023 //               template.
00024 ////////////////////////////////////////////////////////////////////
00025 INLINE bool XFileTemplate::
00026 is_standard() const {
00027   return _is_standard;
00028 }
00029 
00030 ////////////////////////////////////////////////////////////////////
00031 //     Function: XFileTemplate::set_open
00032 //       Access: Public
00033 //  Description: Sets whether the template is considered "open" or
00034 //               not.  If it is open (this flag is true), the set of
00035 //               options is ignored and the instances of this
00036 //               template may include any types of children.  If it is
00037 //               closed (false), only the named types may be added.
00038 ////////////////////////////////////////////////////////////////////
00039 INLINE void XFileTemplate::
00040 set_open(bool open) {
00041   _open = open;
00042 }
00043 
00044 ////////////////////////////////////////////////////////////////////
00045 //     Function: XFileTemplate::get_open
00046 //       Access: Public
00047 //  Description: Returns whether the template is considered "open" or
00048 //               not.  If it is open (this flag is true), the set of
00049 //               options is ignored and the instances of this
00050 //               template may include any types of children.  If it is
00051 //               closed (false), only the named types may be added.
00052 ////////////////////////////////////////////////////////////////////
00053 INLINE bool XFileTemplate::
00054 get_open() const {
00055   return _open;
00056 }
00057 
00058 ////////////////////////////////////////////////////////////////////
00059 //     Function: XFileTemplate::add_option
00060 //       Access: Public
00061 //  Description: Adds a new type to the list of allowable types of
00062 //               child nodes for an instance of this template.
00063 ////////////////////////////////////////////////////////////////////
00064 INLINE void XFileTemplate::
00065 add_option(XFileTemplate *option) {
00066   _options.push_back(option);
00067 }
00068 
00069 ////////////////////////////////////////////////////////////////////
00070 //     Function: XFileTemplate::get_num_options
00071 //       Access: Public
00072 //  Description: Returns the number of templates on the options
00073 //               list.
00074 ////////////////////////////////////////////////////////////////////
00075 INLINE int XFileTemplate::
00076 get_num_options() const {
00077   return _options.size();
00078 }
00079 
00080 ////////////////////////////////////////////////////////////////////
00081 //     Function: XFileTemplate::get_option
00082 //       Access: Public
00083 //  Description: Returns the nth template on the options list.
00084 ////////////////////////////////////////////////////////////////////
00085 INLINE XFileTemplate *XFileTemplate::
00086 get_option(int n) const {
00087   nassertr(n >= 0 && n < (int)_options.size(), NULL);
00088   return _options[n];
00089 }
 All Classes Functions Variables Enumerations