Changeset 1435 for code/branches/console/src/util
- Timestamp:
- May 27, 2008, 1:17:33 AM (17 years ago)
- Location:
- code/branches/console/src/util
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/console/src/util/MultiTypeMath.cc
r1320 r1435 72 72 } 73 73 74 bool MultiTypeMath::operator==(const MultiTypeString& mts) const 75 { 76 return MultiTypeString::operator==(mts); 77 } 78 79 bool MultiTypeMath::operator==(const MultiTypePrimitive& mtp) const 80 { 81 return MultiTypePrimitive::operator==(mtp); 82 } 83 74 84 bool MultiTypeMath::operator!=(const MultiTypeMath& mtm) const 75 85 { … … 93 103 94 104 return true; 105 } 106 107 bool MultiTypeMath::operator!=(const MultiTypeString& mts) const 108 { 109 return MultiTypeString::operator!=(mts); 110 } 111 112 bool MultiTypeMath::operator!=(const MultiTypePrimitive& mtp) const 113 { 114 return MultiTypePrimitive::operator!=(mtp); 95 115 } 96 116 … … 152 172 } 153 173 174 void MultiTypeMath::setValue(const MultiTypeString& mts) 175 { 176 MultiTypeString::setValue(mts); 177 } 178 179 void MultiTypeMath::setValue(const MultiTypePrimitive& mtp) 180 { 181 MultiTypePrimitive::setValue(mtp); 182 } 183 154 184 std::string MultiTypeMath::getTypename() const 155 185 { … … 218 248 bool MultiTypeMath::assimilate(const MultiTypeMath& mtm, const MultiTypeMath& defvalue) 219 249 { 220 if (this->type_ == MT_vector2) 250 if (this->type_ == MT_void) 251 return ConvertValue(&this->value_.void_, mtm, defvalue.value_.void_); 252 else if (this->type_ == MT_int) 253 return ConvertValue(&this->value_.int_, mtm, defvalue.value_.int_); 254 else if (this->type_ == MT_uint) 255 return ConvertValue(&this->value_.uint_, mtm, defvalue.value_.uint_); 256 else if (this->type_ == MT_char) 257 return ConvertValue(&this->value_.char_, mtm, defvalue.value_.char_); 258 else if (this->type_ == MT_uchar) 259 return ConvertValue(&this->value_.uchar_, mtm, defvalue.value_.uchar_); 260 else if (this->type_ == MT_short) 261 return ConvertValue(&this->value_.short_, mtm, defvalue.value_.short_); 262 else if (this->type_ == MT_ushort) 263 return ConvertValue(&this->value_.ushort_, mtm, defvalue.value_.ushort_); 264 else if (this->type_ == MT_long) 265 return ConvertValue(&this->value_.long_, mtm, defvalue.value_.long_); 266 else if (this->type_ == MT_ulong) 267 return ConvertValue(&this->value_.ulong_, mtm, defvalue.value_.ulong_); 268 else if (this->type_ == MT_float) 269 return ConvertValue(&this->value_.float_, mtm, defvalue.value_.float_); 270 else if (this->type_ == MT_double) 271 return ConvertValue(&this->value_.double_, mtm, defvalue.value_.double_); 272 else if (this->type_ == MT_longdouble) 273 return ConvertValue(&this->value_.longdouble_, mtm, defvalue.value_.longdouble_); 274 else if (this->type_ == MT_bool) 275 return ConvertValue(&this->value_.bool_, mtm, defvalue.value_.bool_); 276 else if (this->type_ == MT_constchar) 277 return ConvertValue(&this->string_, mtm, defvalue.string_); 278 else if (this->type_ == MT_string) 279 return ConvertValue(&this->string_, mtm, defvalue.string_); 280 else if (this->type_ == MT_vector2) 221 281 return ConvertValue(&this->vector2_, mtm, defvalue.vector2_); 222 282 else if (this->type_ == MT_vector3) … … 233 293 return ConvertValue(&this->degree_, mtm, defvalue.degree_); 234 294 else 235 return MultiTypeString::assimilate(mtm, defvalue);295 return false; 236 296 } 237 297 -
code/branches/console/src/util/MultiTypeMath.h
r1320 r1435 69 69 inline MultiTypeMath(const orxonox::Degree& value) { this->setValue(value); } 70 70 inline MultiTypeMath(const MultiTypeMath& mtm) { this->setValue(mtm); } 71 inline MultiTypeMath(const MultiTypeString& mts) { this->setValue(mts); } 72 inline MultiTypeMath(const MultiTypePrimitive& mtp) { this->setValue(mtp); } 71 73 virtual inline ~MultiTypeMath() {} 72 74 … … 80 82 inline MultiTypeMath& operator=(const orxonox::Degree& value) { this->setValue(value); return *this; } 81 83 inline MultiTypeMath& operator=(const MultiTypeMath& mtm) { this->setValue(mtm); return *this; } 84 inline MultiTypeMath& operator=(const MultiTypeString& mts) { this->setValue(mts); return *this; } 85 inline MultiTypeMath& operator=(const MultiTypePrimitive mtp) { this->setValue(mtp); return *this; } 82 86 83 87 using MultiTypeString::operator==; … … 90 94 inline bool operator==(const orxonox::Degree& value) const { return (this->degree_ == value); } 91 95 bool operator==(const MultiTypeMath& mtm) const; 96 bool operator==(const MultiTypeString& mts) const; 97 bool operator==(const MultiTypePrimitive& mtp) const; 92 98 93 99 using MultiTypeString::operator!=; … … 100 106 inline bool operator!=(const orxonox::Degree& value) const { return (this->degree_ != value); } 101 107 bool operator!=(const MultiTypeMath& mtm) const; 108 bool operator!=(const MultiTypeString& mts) const; 109 bool operator!=(const MultiTypePrimitive& mtp) const; 102 110 103 111 virtual operator void*() const; … … 133 141 inline void setValue(const orxonox::Degree& value) { this->type_ = MT_degree; this->degree_ = value; } 134 142 void setValue(const MultiTypeMath& mtm); 143 void setValue(const MultiTypeString& mts); 144 void setValue(const MultiTypePrimitive& mtp); 135 145 136 146 inline orxonox::Vector2 getVector2() const { return this->vector2_; } -
code/branches/console/src/util/MultiTypeString.cc
r1320 r1435 33 33 MultiTypeString::MultiTypeString(MultiType type) : MultiTypePrimitive(type) 34 34 { 35 // Nothing to do for string and xml-element35 // Nothing to do for string 36 36 } 37 37 … … 49 49 } 50 50 51 bool MultiTypeString::operator==(const MultiTypePrimitive& mtp) const 52 { 53 return MultiTypePrimitive::operator==(mtp); 54 } 55 51 56 bool MultiTypeString::operator!=(const MultiTypeString& mts) const 52 57 { … … 60 65 61 66 return true; 67 } 68 69 bool MultiTypeString::operator!=(const MultiTypePrimitive& mtp) const 70 { 71 return MultiTypePrimitive::operator!=(mtp); 62 72 } 63 73 … … 97 107 MultiTypePrimitive::setValue(mts); 98 108 this->string_ = mts.string_; 109 } 110 111 void MultiTypeString::setValue(const MultiTypePrimitive& mtp) 112 { 113 MultiTypePrimitive::setValue(mtp); 99 114 } 100 115 … … 138 153 bool MultiTypeString::assimilate(const MultiTypeString& mts, const MultiTypeString& defvalue) 139 154 { 140 if (this->type_ == MT_constchar) 155 if (this->type_ == MT_void) 156 return ConvertValue(&this->value_.void_, mts, defvalue.value_.void_); 157 else if (this->type_ == MT_int) 158 return ConvertValue(&this->value_.int_, mts, defvalue.value_.int_); 159 else if (this->type_ == MT_uint) 160 return ConvertValue(&this->value_.uint_, mts, defvalue.value_.uint_); 161 else if (this->type_ == MT_char) 162 return ConvertValue(&this->value_.char_, mts, defvalue.value_.char_); 163 else if (this->type_ == MT_uchar) 164 return ConvertValue(&this->value_.uchar_, mts, defvalue.value_.uchar_); 165 else if (this->type_ == MT_short) 166 return ConvertValue(&this->value_.short_, mts, defvalue.value_.short_); 167 else if (this->type_ == MT_ushort) 168 return ConvertValue(&this->value_.ushort_, mts, defvalue.value_.ushort_); 169 else if (this->type_ == MT_long) 170 return ConvertValue(&this->value_.long_, mts, defvalue.value_.long_); 171 else if (this->type_ == MT_ulong) 172 return ConvertValue(&this->value_.ulong_, mts, defvalue.value_.ulong_); 173 else if (this->type_ == MT_float) 174 return ConvertValue(&this->value_.float_, mts, defvalue.value_.float_); 175 else if (this->type_ == MT_double) 176 return ConvertValue(&this->value_.double_, mts, defvalue.value_.double_); 177 else if (this->type_ == MT_longdouble) 178 return ConvertValue(&this->value_.longdouble_, mts, defvalue.value_.longdouble_); 179 else if (this->type_ == MT_bool) 180 return ConvertValue(&this->value_.bool_, mts, defvalue.value_.bool_); 181 else if (this->type_ == MT_constchar) 141 182 return ConvertValue(&this->string_, mts, defvalue.string_); 142 183 else if (this->type_ == MT_string) 143 184 return ConvertValue(&this->string_, mts, defvalue.string_); 144 185 else 145 return MultiTypePrimitive::assimilate(mts, defvalue);186 return false; 146 187 } 147 188 -
code/branches/console/src/util/MultiTypeString.h
r1325 r1435 61 61 inline MultiTypeString(long double value) : MultiTypePrimitive(value) {} 62 62 inline MultiTypeString(bool value) : MultiTypePrimitive(value) {} 63 inline MultiTypeString(const char* value) { this->setValue(value); } 64 inline MultiTypeString(const std::string& value) { this->setValue(value); } 65 inline MultiTypeString(const MultiTypeString& mts) { this->setValue(mts); } 63 inline MultiTypeString(const char* value) { this->setValue(value); } 64 inline MultiTypeString(const std::string& value) { this->setValue(value); } 65 inline MultiTypeString(const MultiTypeString& mts) { this->setValue(mts); } 66 inline MultiTypeString(const MultiTypePrimitive& mtp) { this->setValue(mtp); } 66 67 virtual inline ~MultiTypeString() {} 67 68 68 69 using MultiTypePrimitive::operator=; 69 inline MultiTypeString& operator=(const char* value) { this->setValue(value); return *this; } 70 inline MultiTypeString& operator=(const std::string& value) { this->setValue(value); return *this; } 71 inline MultiTypeString& operator=(const MultiTypeString& mts) { this->setValue(mts); return *this; } 70 inline MultiTypeString& operator=(const char* value) { this->setValue(value); return *this; } 71 inline MultiTypeString& operator=(const std::string& value) { this->setValue(value); return *this; } 72 inline MultiTypeString& operator=(const MultiTypeString& mts) { this->setValue(mts); return *this; } 73 inline MultiTypeString& operator=(const MultiTypePrimitive& mtp) { this->setValue(mtp); return *this; } 72 74 73 75 using MultiTypePrimitive::operator==; 74 76 inline bool operator==(const char* value) const { return (this->string_ == std::string(value)); } 75 77 inline bool operator==(const std::string& value) const { return (this->string_ == value); } 76 bool operator==(const MultiTypeString& mts) const; 78 bool operator==(const MultiTypeString& mts) const; 79 bool operator==(const MultiTypePrimitive& mtp) const; 77 80 78 81 using MultiTypePrimitive::operator!=; 79 82 inline bool operator!=(const char* value) const { return (this->string_ != std::string(value)); } 80 83 inline bool operator!=(const std::string& value) const { return (this->string_ != value); } 81 bool operator!=(const MultiTypeString& mts) const; 84 bool operator!=(const MultiTypeString& mts) const; 85 bool operator!=(const MultiTypePrimitive& mtp) const; 82 86 83 87 virtual operator void*() const; … … 100 104 inline void setValue(const char* value) { this->type_ = MT_string; this->string_ = std::string(value); } 101 105 inline void setValue(const std::string& value) { this->type_ = MT_string; this->string_ = value; } 102 void setValue(const MultiTypeString& mts); 106 void setValue(const MultiTypeString& mts); 107 void setValue(const MultiTypePrimitive& mtp); 103 108 104 109 inline std::string getString() const { return this->string_; }
Note: See TracChangeset
for help on using the changeset viewer.