Changeset 853 for code/branches/core/src/util
- Timestamp:
- Mar 5, 2008, 6:38:09 PM (16 years ago)
- Location:
- code/branches/core/src/util
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core/src/util/Convert.h
r848 r853 397 397 bool operator()(orxonox::Vector2* output, const std::string& input) const 398 398 { 399 SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', ' (', ')', '\0');399 SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0'); 400 400 401 401 if (tokens.size() >= 2) … … 420 420 bool operator()(orxonox::Vector3* output, const std::string& input) const 421 421 { 422 SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', ' (', ')', '\0');422 SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0'); 423 423 424 424 if (tokens.size() >= 3) … … 445 445 bool operator()(orxonox::Vector4* output, const std::string& input) const 446 446 { 447 SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', ' (', ')', '\0');447 SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0'); 448 448 449 449 if (tokens.size() >= 4) … … 472 472 bool operator()(orxonox::Quaternion* output, const std::string& input) const 473 473 { 474 SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', ' (', ')', '\0');474 SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0'); 475 475 476 476 if (tokens.size() >= 4) … … 499 499 bool operator()(orxonox::ColourValue* output, const std::string& input) const 500 500 { 501 SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', ' (', ')', '\0');501 SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0'); 502 502 503 503 if (tokens.size() >= 4) -
code/branches/core/src/util/MultiTypeMath.cc
r848 r853 44 44 else if (type == MT_degree) 45 45 this->degree_ = orxonox::Degree(0); 46 }47 48 MultiTypeMath::MultiTypeMath(const MultiTypeMath& mtm) : MultiTypeString(mtm)49 {50 this->type_ = mtm.type_;51 this->value_ = mtm.value_;52 }53 54 MultiTypeMath& MultiTypeMath::operator=(const MultiTypeMath& mtm)55 {56 this->type_ = mtm.type_;57 this->value_ = mtm.value_;58 return *this;59 46 } 60 47 … … 103 90 MultiTypeMath::operator orxonox::Vector2() const 104 91 { 105 return (this->type_ == MT_vector2) ? this->vector2_ : ConvertValueAndReturn<MultiType Primitive, orxonox::Vector2>(*this);92 return (this->type_ == MT_vector2) ? this->vector2_ : ConvertValueAndReturn<MultiTypeMath, orxonox::Vector2>(*this); 106 93 } 107 94 108 95 MultiTypeMath::operator orxonox::Vector3() const 109 96 { 110 return (this->type_ == MT_vector3) ? this->vector3_ : ConvertValueAndReturn<MultiTypePrimitive, orxonox::Vector3>(*this); 97 std::cout << "4_2: Convert MultiTypeMath to Vector3:" << std::endl; 98 std::cout << " MultiTypeMath has type " << this->getType() << std::endl; 99 std::cout << MT_vector3 << std::endl; 100 std::cout << MT_string << std::endl; 101 std::cout << MT_vector2 << std::endl; 102 std::cout << MT_int << std::endl; 103 std::cout << MT_uint << std::endl; 104 std::cout << MT_null << std::endl; 105 if (this->type_ == MT_vector3) 106 { 107 std::cout << " MultiTypeMath contains already a Vector3" << std::endl; 108 std::cout << " Returnvalue is " << this->vector3_ << std::endl; 109 } 110 else 111 { 112 std::cout << " MultiTypeMath doesn't contain a Vector3" << std::endl; 113 std::cout << " Returnvalue is " << ConvertValueAndReturn<MultiTypeMath, orxonox::Vector3>(*this) << std::endl; 114 std::cout << " Returnvalue was " << ConvertValueAndReturn<MultiTypePrimitive, orxonox::Vector3>(*this) << std::endl; 115 } 116 return (this->type_ == MT_vector3) ? this->vector3_ : ConvertValueAndReturn<MultiTypeMath, orxonox::Vector3>(*this); 111 117 } 112 118 113 119 MultiTypeMath::operator orxonox::Quaternion() const 114 120 { 115 return (this->type_ == MT_quaternion) ? this->quaternion_ : ConvertValueAndReturn<MultiType Primitive, orxonox::Quaternion>(*this);121 return (this->type_ == MT_quaternion) ? this->quaternion_ : ConvertValueAndReturn<MultiTypeMath, orxonox::Quaternion>(*this); 116 122 } 117 123 118 124 MultiTypeMath::operator orxonox::ColourValue() const 119 125 { 120 return (this->type_ == MT_colourvalue) ? this->colourvalue_ : ConvertValueAndReturn<MultiType Primitive, orxonox::ColourValue>(*this);126 return (this->type_ == MT_colourvalue) ? this->colourvalue_ : ConvertValueAndReturn<MultiTypeMath, orxonox::ColourValue>(*this); 121 127 } 122 128 123 129 MultiTypeMath::operator orxonox::Radian() const 124 130 { 125 return (this->type_ == MT_radian) ? this->radian_ : ConvertValueAndReturn<MultiType Primitive, orxonox::Radian>(*this);131 return (this->type_ == MT_radian) ? this->radian_ : ConvertValueAndReturn<MultiTypeMath, orxonox::Radian>(*this); 126 132 } 127 133 128 134 MultiTypeMath::operator orxonox::Degree() const 129 135 { 130 return (this->type_ == MT_degree) ? this->degree_ : ConvertValueAndReturn<MultiType Primitive, orxonox::Degree>(*this);136 return (this->type_ == MT_degree) ? this->degree_ : ConvertValueAndReturn<MultiTypeMath, orxonox::Degree>(*this); 131 137 } 132 138 133 139 void MultiTypeMath::setValue(const MultiTypeMath& mtm) 134 140 { 135 this->type_ = mtm.type_; 136 this->value_ = mtm.value_; 141 std::cout << "4_3: setValue in MultiTypeMath with other Multitype as parameter: " << mtm << std::endl; 142 143 MultiTypeString::setValue(mtm); 144 this->vector2_ = mtm.vector2_; 145 this->vector3_ = mtm.vector3_; 146 this->quaternion_ = mtm.quaternion_; 147 this->colourvalue_ = mtm.colourvalue_; 148 this->radian_ = mtm.radian_; 149 this->degree_ = mtm.degree_; 137 150 } 138 151 -
code/branches/core/src/util/MultiTypeMath.h
r848 r853 59 59 inline MultiTypeMath(const orxonox::Radian& value) { this->setValue(value); } 60 60 inline MultiTypeMath(const orxonox::Degree& value) { this->setValue(value); } 61 MultiTypeMath(const MultiTypeMath& mtm);61 inline MultiTypeMath(const MultiTypeMath& mtm) { this->setValue(mtm); } 62 62 63 63 using MultiTypeString::operator=; … … 68 68 inline MultiTypeMath& operator=(const orxonox::Radian& value) { this->setValue(value); return *this; } 69 69 inline MultiTypeMath& operator=(const orxonox::Degree& value) { this->setValue(value); return *this; } 70 MultiTypeMath& operator=(const MultiTypeMath& mtm);70 inline MultiTypeMath& operator=(const MultiTypeMath& mtm) { this->setValue(mtm); return *this; } 71 71 72 72 using MultiTypeString::operator==; … … 97 97 using MultiTypeString::setValue; 98 98 inline void setValue(const orxonox::Vector2& value) { this->type_ = MT_vector2; this->vector2_ = value; } 99 inline void setValue(const orxonox::Vector3& value) { this->type_ = MT_vector3; this->vector3_ = value; }99 inline void setValue(const orxonox::Vector3& value) { std::cout << "4_4: setValue Vector3: " << value << std::endl; this->type_ = MT_vector3; this->vector3_ = value; } 100 100 inline void setValue(const orxonox::ColourValue& value) { this->type_ = MT_colourvalue; this->colourvalue_ = value; } 101 101 inline void setValue(const orxonox::Quaternion& value) { this->type_ = MT_quaternion; this->quaternion_ = value; } -
code/branches/core/src/util/MultiTypePrimitive.cc
r848 r853 32 32 MultiTypePrimitive::MultiTypePrimitive(MultiType type) 33 33 { 34 std::cout << "4_5: Created MultiTypePrimitive with type " << type << std::endl; 34 35 this->type_ = type; 35 36 … … 60 61 else 61 62 this->value_.int_ = 0; 62 }63 64 MultiTypePrimitive::MultiTypePrimitive(const MultiTypePrimitive& mtp)65 {66 this->type_ = mtp.type_;67 this->value_ = mtp.value_;68 }69 70 MultiTypePrimitive& MultiTypePrimitive::operator=(const MultiTypePrimitive& mtp)71 {72 this->type_ = mtp.type_;73 this->value_ = mtp.value_;74 return *this;75 63 } 76 64 … … 203 191 void MultiTypePrimitive::setValue(const MultiTypePrimitive& mtp) 204 192 { 193 std::cout << "4_3: setValue in MultiTypePrimitive with other Multitype as parameter: " << mtp << std::endl; 205 194 this->type_ = mtp.type_; 206 195 this->value_ = mtp.value_; -
code/branches/core/src/util/MultiTypePrimitive.h
r848 r853 52 52 inline MultiTypePrimitive(long double value) { this->setValue(value); } 53 53 inline MultiTypePrimitive(bool value) { this->setValue(value); } 54 MultiTypePrimitive(const MultiTypePrimitive& mtp);54 inline MultiTypePrimitive(const MultiTypePrimitive& mtp) { this->setValue(mtp); } 55 55 56 56 inline MultiTypePrimitive& operator=(MultiType value) { this->type_ = MT_null; return *this; } … … 67 67 inline MultiTypePrimitive& operator=(long double value) { this->setValue(value); return *this; } 68 68 inline MultiTypePrimitive& operator=(bool value) { this->setValue(value); return *this; } 69 MultiTypePrimitive& operator=(const MultiTypePrimitive& mtp);69 inline MultiTypePrimitive& operator=(const MultiTypePrimitive& mtp) { this->setValue(mtp); return *this; } 70 70 71 71 inline bool operator==(int value) const { return (this->value_.int_ == value); } -
code/branches/core/src/util/MultiTypeString.cc
r848 r853 38 38 } 39 39 40 MultiTypeString::MultiTypeString(const MultiTypeString& mts) : MultiTypePrimitive(mts)41 {42 this->type_ = mts.type_;43 this->value_ = mts.value_;44 }45 46 MultiTypeString& MultiTypeString::operator=(const MultiTypeString& mts)47 {48 this->type_ = mts.type_;49 this->value_ = mts.value_;50 return *this;51 }52 53 40 bool MultiTypeString::operator==(const MultiTypeString& mts) const 54 41 { … … 79 66 MultiTypeString::operator std::string() const 80 67 { 81 return (this->type_ == MT_string) ? this->string_ : ConvertValueAndReturn<MultiType Primitive, std::string>(*this);68 return (this->type_ == MT_string) ? this->string_ : ConvertValueAndReturn<MultiTypeString, std::string>(*this); 82 69 } 83 70 84 71 MultiTypeString::operator const char*() const 85 72 { 86 return ( this->type_ == MT_constchar) ? this->string_.c_str() : ConvertValueAndReturn<MultiTypePrimitive, const char*>(*this);73 return ((this->type_ == MT_constchar) ? this->string_ : ConvertValueAndReturn<MultiTypeString, std::string>(*this)).c_str(); 87 74 } 88 75 89 76 void MultiTypeString::setValue(const MultiTypeString& mts) 90 77 { 91 this->type_ = mts.type_;92 this-> value_ = mts.value_;78 MultiTypePrimitive::setValue(mts); 79 this->string_ = mts.string_; 93 80 } 94 81 -
code/branches/core/src/util/MultiTypeString.h
r848 r853 31 31 32 32 #include <string> 33 33 #include <iostream> 34 34 #include "UtilPrereqs.h" 35 35 … … 52 52 inline MultiTypeString(long double value) : MultiTypePrimitive(value) {} 53 53 inline MultiTypeString(bool value) : MultiTypePrimitive(value) {} 54 inline MultiTypeString(const char* value) { this->setValue(value); }55 inline MultiTypeString(const std::string& value) { this->setValue(value); }56 MultiTypeString(const MultiTypeString& mtp);54 inline MultiTypeString(const char* value) { this->setValue(value); } 55 inline MultiTypeString(const std::string& value) { this->setValue(value); std::cout << "4_1: Created MultiTypeString with value " << value << " and type " << this->getType() << std::endl; } 56 inline MultiTypeString(const MultiTypeString& mts) { this->setValue(mts); } 57 57 58 58 using MultiTypePrimitive::operator=; 59 inline MultiTypeString& operator=(const char* value) { this->setValue(value); return *this; }60 inline MultiTypeString& operator=(const std::string& value) { this->setValue(value); return *this; }61 MultiTypeString& operator=(const MultiTypeString& mtp);59 inline MultiTypeString& operator=(const char* value) { this->setValue(value); return *this; } 60 inline MultiTypeString& operator=(const std::string& value) { this->setValue(value); return *this; } 61 inline MultiTypeString& operator=(const MultiTypeString& mts) { this->setValue(mts); return *this; } 62 62 63 63 using MultiTypePrimitive::operator==; 64 64 inline bool operator==(const char* value) const { return (this->string_ == std::string(value)); } 65 65 inline bool operator==(const std::string& value) const { return (this->string_ == value); } 66 bool operator==(const MultiTypeString& mt p) const;66 bool operator==(const MultiTypeString& mts) const; 67 67 68 68 using MultiTypePrimitive::operator!=; 69 69 inline bool operator!=(const char* value) const { return (this->string_ != std::string(value)); } 70 70 inline bool operator!=(const std::string& value) const { return (this->string_ != value); } 71 bool operator!=(const MultiTypeString& mt p) const;71 bool operator!=(const MultiTypeString& mts) const; 72 72 73 73 operator std::string() const; … … 77 77 inline void setValue(const char* value) { this->type_ = MT_string; this->string_ = std::string(value); } 78 78 inline void setValue(const std::string& value) { this->type_ = MT_string; this->string_ = value; } 79 void setValue(const MultiTypeString& mt p);79 void setValue(const MultiTypeString& mts); 80 80 81 81 inline const std::string getString() const { return this->string_; }
Note: See TracChangeset
for help on using the changeset viewer.