Changeset 1320
- Timestamp:
- May 19, 2008, 2:18:55 AM (17 years ago)
- Location:
- code/branches/console/src/util
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/console/src/util/MultiTypeMath.cc
r1319 r1320 216 216 } 217 217 218 void MultiTypeMath::assimilate(const MultiTypeMath& mtm)219 { 220 if (this->type_ == MT_vector2) 221 this->vector2_ = mtm.operator orxonox::Vector2();222 else if (this->type_ == MT_vector3) 223 this->vector3_ = mtm.operator orxonox::Vector3();224 else if (this->type_ == MT_vector4) 225 this->vector4_ = mtm.operator orxonox::Vector4();226 else if (this->type_ == MT_colourvalue) 227 this->colourvalue_ = mtm;228 else if (this->type_ == MT_quaternion) 229 this->quaternion_ = mtm;230 else if (this->type_ == MT_radian) 231 this->radian_ = mtm.operator orxonox::Radian();232 else if (this->type_ == MT_degree) 233 this->degree_ = mtm.operator orxonox::Degree();234 else 235 MultiTypeString::assimilate(mtm);218 bool MultiTypeMath::assimilate(const MultiTypeMath& mtm, const MultiTypeMath& defvalue) 219 { 220 if (this->type_ == MT_vector2) 221 return ConvertValue(&this->vector2_, mtm, defvalue.vector2_); 222 else if (this->type_ == MT_vector3) 223 return ConvertValue(&this->vector3_, mtm, defvalue.vector3_); 224 else if (this->type_ == MT_vector4) 225 return ConvertValue(&this->vector4_, mtm, defvalue.vector4_); 226 else if (this->type_ == MT_colourvalue) 227 return ConvertValue(&this->colourvalue_, mtm, defvalue.colourvalue_); 228 else if (this->type_ == MT_quaternion) 229 return ConvertValue(&this->quaternion_, mtm, defvalue.quaternion_); 230 else if (this->type_ == MT_radian) 231 return ConvertValue(&this->radian_, mtm, defvalue.radian_); 232 else if (this->type_ == MT_degree) 233 return ConvertValue(&this->degree_, mtm, defvalue.degree_); 234 else 235 return MultiTypeString::assimilate(mtm, defvalue); 236 236 } 237 237 -
code/branches/console/src/util/MultiTypeMath.h
r1319 r1320 164 164 virtual bool fromString(const std::string value); 165 165 166 virtual void assimilate(const MultiTypeMath& mtm);166 virtual bool assimilate(const MultiTypeMath& mtm, const MultiTypeMath& defvalue = MultiTypeMath()); 167 167 168 168 protected: -
code/branches/console/src/util/MultiTypePrimitive.cc
r1319 r1320 266 266 } 267 267 268 void MultiTypePrimitive::assimilate(const MultiTypePrimitive& mtp)268 bool MultiTypePrimitive::assimilate(const MultiTypePrimitive& mtp, const MultiTypePrimitive& defvalue) 269 269 { 270 270 if (this->type_ == MT_void) 271 this->value_.void_ = mtp;271 return ConvertValue(&this->value_.void_, mtp, defvalue.value_.void_); 272 272 else if (this->type_ == MT_int) 273 this->value_.int_ = mtp;273 return ConvertValue(&this->value_.int_, mtp, defvalue.value_.int_); 274 274 else if (this->type_ == MT_uint) 275 this->value_.uint_ = mtp;275 return ConvertValue(&this->value_.uint_, mtp, defvalue.value_.uint_); 276 276 else if (this->type_ == MT_char) 277 this->value_.char_ = mtp;277 return ConvertValue(&this->value_.char_, mtp, defvalue.value_.char_); 278 278 else if (this->type_ == MT_uchar) 279 this->value_.uchar_ = mtp;279 return ConvertValue(&this->value_.uchar_, mtp, defvalue.value_.uchar_); 280 280 else if (this->type_ == MT_short) 281 this->value_.short_ = mtp;281 return ConvertValue(&this->value_.short_, mtp, defvalue.value_.short_); 282 282 else if (this->type_ == MT_ushort) 283 this->value_.ushort_ = mtp;283 return ConvertValue(&this->value_.ushort_, mtp, defvalue.value_.ushort_); 284 284 else if (this->type_ == MT_long) 285 this->value_.long_ = mtp;285 return ConvertValue(&this->value_.long_, mtp, defvalue.value_.long_); 286 286 else if (this->type_ == MT_ulong) 287 this->value_.ulong_ = mtp;287 return ConvertValue(&this->value_.ulong_, mtp, defvalue.value_.ulong_); 288 288 else if (this->type_ == MT_float) 289 this->value_.float_ = mtp;289 return ConvertValue(&this->value_.float_, mtp, defvalue.value_.float_); 290 290 else if (this->type_ == MT_double) 291 this->value_.double_ = mtp;291 return ConvertValue(&this->value_.double_, mtp, defvalue.value_.double_); 292 292 else if (this->type_ == MT_longdouble) 293 this->value_.longdouble_ = mtp;293 return ConvertValue(&this->value_.longdouble_, mtp, defvalue.value_.longdouble_); 294 294 else if (this->type_ == MT_bool) 295 this->value_.bool_ = mtp; 295 return ConvertValue(&this->value_.bool_, mtp, defvalue.value_.bool_); 296 else 297 return false; 298 296 299 } 297 300 -
code/branches/console/src/util/MultiTypePrimitive.h
r1319 r1320 187 187 virtual bool fromString(const std::string value); 188 188 189 virtual void assimilate(const MultiTypePrimitive& mtp);189 virtual bool assimilate(const MultiTypePrimitive& mtp, const MultiTypePrimitive& defvalue = MultiTypePrimitive()); 190 190 191 191 protected: -
code/branches/console/src/util/MultiTypeString.cc
r1319 r1320 136 136 } 137 137 138 void MultiTypeString::assimilate(const MultiTypeString& mts)138 bool MultiTypeString::assimilate(const MultiTypeString& mts, const MultiTypeString& defvalue) 139 139 { 140 140 if (this->type_ == MT_constchar) 141 this->string_ = mts.toString();141 return ConvertValue(&this->string_, mts, defvalue.string_); 142 142 else if (this->type_ == MT_string) 143 this->string_ = mts.toString();143 return ConvertValue(&this->string_, mts, defvalue.string_); 144 144 else 145 MultiTypePrimitive::assimilate(mts);145 return MultiTypePrimitive::assimilate(mts, defvalue); 146 146 } 147 147 -
code/branches/console/src/util/MultiTypeString.h
r1319 r1320 117 117 virtual bool fromString(const std::string value); 118 118 119 virtual void assimilate(const MultiTypeString& mts);119 virtual bool assimilate(const MultiTypeString& mts, const MultiTypeString& defvalue = MultiTypeString()); 120 120 121 121 protected:
Note: See TracChangeset
for help on using the changeset viewer.