Changeset 848 for code/branches/core/src/util/MultiTypeString.cc
- Timestamp:
- Mar 5, 2008, 1:29:47 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core/src/util/MultiTypeString.cc
r797 r848 28 28 29 29 #include "MultiTypeString.h" 30 #include "Convert.h" 30 31 31 32 MultiTypeString::MultiTypeString(MultiType type) : MultiTypePrimitive(type) … … 76 77 } 77 78 79 MultiTypeString::operator std::string() const 80 { 81 return (this->type_ == MT_string) ? this->string_ : ConvertValueAndReturn<MultiTypePrimitive, std::string>(*this); 82 } 83 84 MultiTypeString::operator const char*() const 85 { 86 return (this->type_ == MT_constchar) ? this->string_.c_str() : ConvertValueAndReturn<MultiTypePrimitive, const char*>(*this); 87 } 88 78 89 void MultiTypeString::setValue(const MultiTypeString& mts) 79 90 { 80 91 this->type_ = mts.type_; 81 92 this->value_ = mts.value_; 93 } 94 95 std::string MultiTypeString::toString() const 96 { 97 if (this->type_ == MT_constchar) 98 return this->string_; 99 else if (this->type_ == MT_string) 100 return this->string_; 101 else 102 return MultiTypePrimitive::toString(); 103 } 104 105 bool MultiTypeString::fromString(const std::string value) 106 { 107 if (this->type_ == MT_constchar) 108 this->string_ = value; 109 else if (this->type_ == MT_string) 110 this->string_ = value; 111 else 112 return MultiTypePrimitive::fromString(value); 113 114 return true; 82 115 } 83 116
Note: See TracChangeset
for help on using the changeset viewer.