Changeset 1001 for code/branches/core2/src/util/MultiTypeString.cc
- Timestamp:
- Apr 8, 2008, 1:51:25 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core2/src/util/MultiTypeString.cc
r960 r1001 43 43 else if (this->type_ == MT_string) 44 44 return (this->string_ == mts.string_); 45 else if (this->type_ == MT_xmlelement)46 return (&this->xmlelement_ == &mts.xmlelement_);47 45 } 48 46 … … 58 56 else if (this->type_ == MT_string) 59 57 return (this->string_ != mts.string_); 60 else if (this->type_ == MT_xmlelement)61 return (&this->xmlelement_ != &mts.xmlelement_);62 58 } 63 59 … … 66 62 67 63 MultiTypeString::operator void*() const 68 { return (this->type_ == MT_void) ? this->value_.void_ : ConvertValueAndReturn<MultiTypeString, void*>(*this, 0); }64 { return (this->type_ == MT_void) ? this->value_.void_ : getConvertedValue<MultiTypeString, void*>(*this, 0); } 69 65 MultiTypeString::operator int() const 70 { return (this->type_ == MT_int) ? this->value_.int_ : ConvertValueAndReturn<MultiTypeString, int>(*this, 0); }66 { return (this->type_ == MT_int) ? this->value_.int_ : getConvertedValue<MultiTypeString, int>(*this, 0); } 71 67 MultiTypeString::operator unsigned int() const 72 { return (this->type_ == MT_uint) ? this->value_.uint_ : ConvertValueAndReturn<MultiTypeString, unsigned int>(*this, 0); }68 { return (this->type_ == MT_uint) ? this->value_.uint_ : getConvertedValue<MultiTypeString, unsigned int>(*this, 0); } 73 69 MultiTypeString::operator char() const 74 { return (this->type_ == MT_char) ? this->value_.char_ : ConvertValueAndReturn<MultiTypeString, char>(*this, 0); }70 { return (this->type_ == MT_char) ? this->value_.char_ : getConvertedValue<MultiTypeString, char>(*this, 0); } 75 71 MultiTypeString::operator unsigned char() const 76 { return (this->type_ == MT_uchar) ? this->value_.uchar_ : ConvertValueAndReturn<MultiTypeString, unsigned char>(*this, 0); }72 { return (this->type_ == MT_uchar) ? this->value_.uchar_ : getConvertedValue<MultiTypeString, unsigned char>(*this, 0); } 77 73 MultiTypeString::operator short() const 78 { return (this->type_ == MT_short) ? this->value_.short_ : ConvertValueAndReturn<MultiTypeString, short>(*this, 0); }74 { return (this->type_ == MT_short) ? this->value_.short_ : getConvertedValue<MultiTypeString, short>(*this, 0); } 79 75 MultiTypeString::operator unsigned short() const 80 { return (this->type_ == MT_ushort) ? this->value_.ushort_ : ConvertValueAndReturn<MultiTypeString, unsigned short>(*this, 0); }76 { return (this->type_ == MT_ushort) ? this->value_.ushort_ : getConvertedValue<MultiTypeString, unsigned short>(*this, 0); } 81 77 MultiTypeString::operator long() const 82 { return (this->type_ == MT_long) ? this->value_.long_ : ConvertValueAndReturn<MultiTypeString, long>(*this, 0); }78 { return (this->type_ == MT_long) ? this->value_.long_ : getConvertedValue<MultiTypeString, long>(*this, 0); } 83 79 MultiTypeString::operator unsigned long() const 84 { return (this->type_ == MT_ulong) ? this->value_.ulong_ : ConvertValueAndReturn<MultiTypeString, unsigned long>(*this, 0); }80 { return (this->type_ == MT_ulong) ? this->value_.ulong_ : getConvertedValue<MultiTypeString, unsigned long>(*this, 0); } 85 81 MultiTypeString::operator float() const 86 { return (this->type_ == MT_float) ? this->value_.float_ : ConvertValueAndReturn<MultiTypeString, float>(*this, 0); }82 { return (this->type_ == MT_float) ? this->value_.float_ : getConvertedValue<MultiTypeString, float>(*this, 0); } 87 83 MultiTypeString::operator double() const 88 { return (this->type_ == MT_double) ? this->value_.double_ : ConvertValueAndReturn<MultiTypeString, double>(*this, 0); }84 { return (this->type_ == MT_double) ? this->value_.double_ : getConvertedValue<MultiTypeString, double>(*this, 0); } 89 85 MultiTypeString::operator long double() const 90 { return (this->type_ == MT_longdouble) ? this->value_.longdouble_ : ConvertValueAndReturn<MultiTypeString, long double>(*this, 0); }86 { return (this->type_ == MT_longdouble) ? this->value_.longdouble_ : getConvertedValue<MultiTypeString, long double>(*this, 0); } 91 87 MultiTypeString::operator bool() const 92 { return (this->type_ == MT_bool) ? this->value_.bool_ : ConvertValueAndReturn<MultiTypeString, bool>(*this, 0); }88 { return (this->type_ == MT_bool) ? this->value_.bool_ : getConvertedValue<MultiTypeString, bool>(*this, 0); } 93 89 MultiTypeString::operator std::string() const 94 { return (this->type_ == MT_string) ? this->string_ : ConvertValueAndReturn<MultiTypeString, std::string>(*this); }90 { return (this->type_ == MT_string) ? this->string_ : getConvertedValue<MultiTypeString, std::string>(*this); } 95 91 MultiTypeString::operator const char*() const 96 { return ((this->type_ == MT_constchar) ? this->string_ : ConvertValueAndReturn<MultiTypeString, std::string>(*this)).c_str(); } 97 MultiTypeString::operator orxonox::Element() const 98 { return (this->type_ == MT_xmlelement) ? this->xmlelement_ : ConvertValueAndReturn<MultiTypeString, orxonox::Element>(*this); } 92 { return ((this->type_ == MT_constchar) ? this->string_ : getConvertedValue<MultiTypeString, std::string>(*this)).c_str(); } 99 93 100 94 void MultiTypeString::setValue(const MultiTypeString& mts) … … 110 104 else if (this->type_ == MT_string) 111 105 return "string"; 112 else if (this->type_ == MT_xmlelement)113 return "XML-element";114 106 else 115 107 return MultiTypePrimitive::getTypename(); … … 124 116 else if (this->type_ == MT_string) 125 117 return this->string_; 126 else if (this->type_ == MT_xmlelement)127 ConvertValue(&output, this->xmlelement_);128 118 else 129 119 return MultiTypePrimitive::toString(); … … 138 128 else if (this->type_ == MT_string) 139 129 this->string_ = value; 140 else if (this->type_ == MT_xmlelement)141 return ConvertValue(&this->xmlelement_, value, orxonox::Element());142 130 else 143 131 return MultiTypePrimitive::fromString(value);
Note: See TracChangeset
for help on using the changeset viewer.