Changeset 925 for code/branches/core2/src/util/MultiTypeString.cc
- Timestamp:
- Mar 26, 2008, 1:36:35 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core2/src/util/MultiTypeString.cc
r871 r925 46 46 else if (this->type_ == MT_string) 47 47 return (this->string_ == mts.string_); 48 else if (this->type_ == MT_xmlelement) 49 return (&this->xmlelement_ == &mts.xmlelement_); 48 50 } 49 51 … … 59 61 else if (this->type_ == MT_string) 60 62 return (this->string_ != mts.string_); 63 else if (this->type_ == MT_xmlelement) 64 return (&this->xmlelement_ != &mts.xmlelement_); 61 65 } 62 66 … … 64 68 } 65 69 70 MultiTypeString::operator orxonox::BaseObject*() const 71 { return (this->type_ == MT_void) ? (orxonox::BaseObject*)this->value_.void_ : (orxonox::BaseObject*)ConvertValueAndReturn<MultiTypeString, void*>(*this); } 72 MultiTypeString::operator void*() const 73 { return (this->type_ == MT_void) ? this->value_.void_ : ConvertValueAndReturn<MultiTypeString, void*>(*this); } 66 74 MultiTypeString::operator int() const 67 75 { return (this->type_ == MT_int) ? this->value_.int_ : ConvertValueAndReturn<MultiTypeString, int>(*this); } … … 92 100 MultiTypeString::operator const char*() const 93 101 { return ((this->type_ == MT_constchar) ? this->string_ : ConvertValueAndReturn<MultiTypeString, std::string>(*this)).c_str(); } 102 MultiTypeString::operator orxonox::Element() const 103 { return (this->type_ == MT_xmlelement) ? this->xmlelement_ : ConvertValueAndReturn<MultiTypeString, orxonox::Element>(*this); } 94 104 95 105 void MultiTypeString::setValue(const MultiTypeString& mts) … … 101 111 std::string MultiTypeString::toString() const 102 112 { 113 std::string output; 114 103 115 if (this->type_ == MT_constchar) 104 116 return this->string_; 105 117 else if (this->type_ == MT_string) 106 118 return this->string_; 119 else if (this->type_ == MT_xmlelement) 120 ConvertValue(&output, this->xmlelement_); 107 121 else 108 122 return MultiTypePrimitive::toString(); 123 124 return output; 109 125 } 110 126 … … 115 131 else if (this->type_ == MT_string) 116 132 this->string_ = value; 133 else if (this->type_ == MT_xmlelement) 134 return ConvertValue(&this->xmlelement_, value, orxonox::Element()); 117 135 else 118 136 return MultiTypePrimitive::fromString(value);
Note: See TracChangeset
for help on using the changeset viewer.