Panda3D
|
00001 // Filename: dcParameter.h 00002 // Created by: drose (15Jun04) 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 DCPARAMETER_H 00016 #define DCPARAMETER_H 00017 00018 #include "dcbase.h" 00019 #include "dcField.h" 00020 #include "dcNumericRange.h" 00021 00022 class DCSimpleParameter; 00023 class DCClassParameter; 00024 class DCArrayParameter; 00025 class DCTypedef; 00026 class HashGenerator; 00027 00028 //////////////////////////////////////////////////////////////////// 00029 // Class : DCParameter 00030 // Description : Represents the type specification for a single 00031 // parameter within a field specification. This may be 00032 // a simple type, or it may be a class or an array 00033 // reference. 00034 // 00035 // This may also be a typedef reference to another type, 00036 // which has the same properties as the referenced type, 00037 // but a different name. 00038 //////////////////////////////////////////////////////////////////// 00039 class EXPCL_DIRECT DCParameter : public DCField { 00040 protected: 00041 DCParameter(); 00042 DCParameter(const DCParameter ©); 00043 public: 00044 virtual ~DCParameter(); 00045 00046 PUBLISHED: 00047 virtual DCParameter *as_parameter(); 00048 virtual const DCParameter *as_parameter() const; 00049 virtual DCSimpleParameter *as_simple_parameter(); 00050 virtual const DCSimpleParameter *as_simple_parameter() const; 00051 virtual DCClassParameter *as_class_parameter(); 00052 virtual const DCClassParameter *as_class_parameter() const; 00053 virtual DCSwitchParameter *as_switch_parameter(); 00054 virtual const DCSwitchParameter *as_switch_parameter() const; 00055 virtual DCArrayParameter *as_array_parameter(); 00056 virtual const DCArrayParameter *as_array_parameter() const; 00057 00058 virtual DCParameter *make_copy() const=0; 00059 virtual bool is_valid() const=0; 00060 00061 const DCTypedef *get_typedef() const; 00062 00063 public: 00064 void set_typedef(const DCTypedef *dtypedef); 00065 virtual DCParameter *append_array_specification(const DCUnsignedIntRange &size); 00066 00067 virtual void output(ostream &out, bool brief) const; 00068 virtual void write(ostream &out, bool brief, int indent_level) const; 00069 virtual void output_instance(ostream &out, bool brief, const string &prename, 00070 const string &name, const string &postname) const=0; 00071 virtual void write_instance(ostream &out, bool brief, int indent_level, 00072 const string &prename, const string &name, 00073 const string &postname) const; 00074 void output_typedef_name(ostream &out, bool brief, const string &prename, 00075 const string &name, const string &postname) const; 00076 void write_typedef_name(ostream &out, bool brief, int indent_level, 00077 const string &prename, const string &name, 00078 const string &postname) const; 00079 virtual void generate_hash(HashGenerator &hashgen) const; 00080 00081 private: 00082 const DCTypedef *_typedef; 00083 }; 00084 00085 #endif