Panda3D
 All Classes Functions Variables Enumerations
xFileTemplate.h
00001 // Filename: xFileTemplate.h
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 #ifndef XFILETEMPLATE_H
00016 #define XFILETEMPLATE_H
00017 
00018 #include "pandatoolbase.h"
00019 #include "xFileNode.h"
00020 #include "windowsGuid.h"
00021 
00022 class XFileDataDef;
00023 
00024 ////////////////////////////////////////////////////////////////////
00025 //       Class : XFileTemplate
00026 // Description : A template definition in the X file.  This defines
00027 //               the data structures that may be subsequently read.
00028 ////////////////////////////////////////////////////////////////////
00029 class XFileTemplate : public XFileNode {
00030 public:
00031   XFileTemplate(XFile *x_file, const string &name, const WindowsGuid &guid);
00032   virtual ~XFileTemplate();
00033 
00034   virtual bool has_guid() const;
00035   virtual const WindowsGuid &get_guid() const;
00036 
00037   virtual bool is_template_def() const;
00038 
00039   virtual void clear();
00040   virtual void write_text(ostream &out, int indent_level) const;
00041 
00042   INLINE bool is_standard() const;
00043 
00044   INLINE void set_open(bool open);
00045   INLINE bool get_open() const;
00046 
00047   INLINE void add_option(XFileTemplate *option);
00048   INLINE int get_num_options() const;
00049   INLINE XFileTemplate *get_option(int n) const;
00050 
00051   virtual bool matches(const XFileNode *other) const;
00052   
00053 private:
00054   WindowsGuid _guid;
00055   bool _is_standard;
00056   bool _open;
00057 
00058   typedef pvector< PT(XFileTemplate) > Options;
00059   Options _options;
00060   
00061 public:
00062   static TypeHandle get_class_type() {
00063     return _type_handle;
00064   }
00065   static void init_type() {
00066     XFileNode::init_type();
00067     register_type(_type_handle, "XFileTemplate",
00068                   XFileNode::get_class_type());
00069   }
00070   virtual TypeHandle get_type() const {
00071     return get_class_type();
00072   }
00073   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00074 
00075 private:
00076   static TypeHandle _type_handle;
00077 
00078   friend class XFile;
00079 };
00080 
00081 #include "xFileTemplate.I"
00082 
00083 #endif
00084   
00085 
00086 
 All Classes Functions Variables Enumerations