00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "interrogateType.h"
00016 #include "indexRemapper.h"
00017 #include "interrogate_datafile.h"
00018
00019 #include <algorithm>
00020
00021
00022
00023
00024
00025
00026 InterrogateType::
00027 InterrogateType(InterrogateModuleDef *def) :
00028 InterrogateComponent(def)
00029 {
00030 _flags = 0;
00031 _outer_class = 0;
00032 _atomic_token = AT_not_atomic;
00033 _wrapped_type = 0;
00034 _destructor = 0;
00035
00036 _cpptype = (CPPType *)NULL;
00037 _cppscope = (CPPScope *)NULL;
00038 }
00039
00040
00041
00042
00043
00044
00045 InterrogateType::
00046 InterrogateType(const InterrogateType ©) {
00047 (*this) = copy;
00048 }
00049
00050
00051
00052
00053
00054
00055 void InterrogateType::Derivation::
00056 output(ostream &out) const {
00057 out << _flags << " " << _base << " " << _upcast << " " << _downcast;
00058 }
00059
00060
00061
00062
00063
00064
00065 void InterrogateType::Derivation::
00066 input(istream &in) {
00067 in >> _flags >> _base >> _upcast >> _downcast;
00068 }
00069
00070
00071
00072
00073
00074
00075 void InterrogateType::EnumValue::
00076 output(ostream &out) const {
00077 idf_output_string(out, _name);
00078 idf_output_string(out, _scoped_name);
00079 out << _value;
00080 }
00081
00082
00083
00084
00085
00086
00087 void InterrogateType::EnumValue::
00088 input(istream &in) {
00089 idf_input_string(in, _name);
00090 idf_input_string(in, _scoped_name);
00091 in >> _value;
00092 }
00093
00094
00095
00096
00097
00098
00099 void InterrogateType::
00100 operator = (const InterrogateType ©) {
00101 InterrogateComponent::operator = (copy);
00102 _flags = copy._flags;
00103 _scoped_name = copy._scoped_name;
00104 _true_name = copy._true_name;
00105 _comment = copy._comment;
00106 _outer_class = copy._outer_class;
00107 _atomic_token = copy._atomic_token;
00108 _wrapped_type = copy._wrapped_type;
00109 _constructors = copy._constructors;
00110 _destructor = copy._destructor;
00111 _elements = copy._elements;
00112 _methods = copy._methods;
00113 _make_seqs = copy._make_seqs;
00114 _casts = copy._casts;
00115 _derivations = copy._derivations;
00116 _enum_values = copy._enum_values;
00117 _nested_types = copy._nested_types;
00118
00119 _cpptype = copy._cpptype;
00120 _cppscope = copy._cppscope;
00121 }
00122
00123
00124
00125
00126
00127
00128
00129
00130 void InterrogateType::
00131 merge_with(const InterrogateType &other) {
00132
00133
00134
00135 if (is_fully_defined()) {
00136
00137 _flags |= (other._flags & F_global);
00138
00139 } else {
00140
00141 int old_flags = (_flags & F_global);
00142 (*this) = other;
00143 _flags |= old_flags;
00144 }
00145 }
00146
00147
00148
00149
00150
00151
00152
00153 void InterrogateType::
00154 output(ostream &out) const {
00155 InterrogateComponent::output(out);
00156
00157 out << _flags << " ";
00158 idf_output_string(out, _scoped_name);
00159 idf_output_string(out, _true_name);
00160 out << _outer_class << " "
00161 << (int)_atomic_token << " "
00162 << _wrapped_type << " ";
00163 idf_output_vector(out, _constructors);
00164 out << _destructor << " ";
00165 idf_output_vector(out, _elements);
00166 idf_output_vector(out, _methods);
00167 idf_output_vector(out, _make_seqs);
00168 idf_output_vector(out, _casts);
00169 idf_output_vector(out, _derivations);
00170 idf_output_vector(out, _enum_values);
00171 idf_output_vector(out, _nested_types);
00172 idf_output_string(out, _comment, '\n');
00173 }
00174
00175
00176
00177
00178
00179
00180
00181 void InterrogateType::
00182 input(istream &in) {
00183 InterrogateComponent::input(in);
00184
00185 in >> _flags;
00186 idf_input_string(in, _scoped_name);
00187 idf_input_string(in, _true_name);
00188
00189 in >> _outer_class;
00190 int token;
00191 in >> token;
00192 _atomic_token = (AtomicToken)token;
00193 in >> _wrapped_type;
00194
00195 idf_input_vector(in, _constructors);
00196 in >> _destructor;
00197
00198 idf_input_vector(in, _elements);
00199 idf_input_vector(in, _methods);
00200 idf_input_vector(in, _make_seqs);
00201 idf_input_vector(in, _casts);
00202 idf_input_vector(in, _derivations);
00203 idf_input_vector(in, _enum_values);
00204 idf_input_vector(in, _nested_types);
00205 idf_input_string(in, _comment);
00206 }
00207
00208
00209
00210
00211
00212
00213
00214
00215 void InterrogateType::
00216 remap_indices(const IndexRemapper &remap) {
00217 _outer_class = remap.map_from(_outer_class);
00218 _wrapped_type = remap.map_from(_wrapped_type);
00219
00220 Functions::iterator fi;
00221 for (fi = _constructors.begin(); fi != _constructors.end(); ++fi) {
00222 (*fi) = remap.map_from(*fi);
00223 }
00224 _destructor = remap.map_from(_destructor);
00225
00226 Elements::iterator ei;
00227 for (ei = _elements.begin(); ei != _elements.end(); ++ei) {
00228 (*ei) = remap.map_from(*ei);
00229 }
00230
00231 for (fi = _methods.begin(); fi != _methods.end(); ++fi) {
00232 (*fi) = remap.map_from(*fi);
00233 }
00234 for (fi = _casts.begin(); fi != _casts.end(); ++fi) {
00235 (*fi) = remap.map_from(*fi);
00236 }
00237
00238 MakeSeqs::iterator si;
00239 for (si = _make_seqs.begin(); si != _make_seqs.end(); ++si) {
00240 (*si) = remap.map_from(*si);
00241 }
00242
00243 Derivations::iterator di;
00244 for (di = _derivations.begin(); di != _derivations.end(); ++di) {
00245 (*di)._base = remap.map_from((*di)._base);
00246 (*di)._upcast = remap.map_from((*di)._upcast);
00247 (*di)._downcast = remap.map_from((*di)._downcast);
00248 }
00249
00250 Types::iterator ti;
00251 for (ti = _nested_types.begin(); ti != _nested_types.end(); ++ti) {
00252 (*ti) = remap.map_from(*ti);
00253 }
00254
00255 }
00256
00257
00258
00259
00260
00261 EXPCL_DTOOLCONFIG RunTimeTypeDictionary & GetRunTimeDictionary()
00262 {
00263 static RunTimeTypeDictionary dict;
00264 return dict;
00265 };
00266
00267
00268
00269
00270 EXPCL_DTOOLCONFIG RunTimeTypeList & GetRunTimeTypeList()
00271 {
00272 static RunTimeTypeList list;
00273 return list;
00274 };
00275