Changeset 854
- Timestamp:
- Mar 5, 2008, 7:38:28 PM (17 years ago)
- Location:
- code/branches/core/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core/src/orxonox/core/XMLPort.h
r853 r854 108 108 if (loading) 109 109 { 110 std::cout << "3_1: load param " << this->paramname_ << std::endl;111 110 std::string attribute = xmlelement.GetAttribute(this->paramname_); 112 std::cout << "3_2: attribute " << attribute << std::endl;113 111 if (attribute.size() > 0) 114 112 { 115 113 SubString tokens(attribute, ",", SubString::WhiteSpaces, false, '\\', '"', '(', ')', '\0'); 116 std::cout << "3_3: tokens: " << tokens.size() << " params: " << this->loadfunction_->getParamCount() << std::endl;117 114 if ((unsigned int)tokens.size() >= (unsigned int)this->loadfunction_->getParamCount()) 118 115 { 119 116 if (this->loadfunction_->getParamCount() == 1) 120 117 { 121 std::cout << "3_4 start: load with whole attribute as input" << std::endl;122 118 (*this->loadfunction_)(object, MultiTypeMath(attribute)); 123 std::cout << "3_5 end" << std::endl;124 119 } 125 120 else 126 121 { 127 std::cout << "3_4: load with tokens as input" << std::endl;128 122 MultiTypeMath param1, param2, param3, param4, param5; 129 123 if (tokens.size() >= 1) param1 = tokens[0]; -
code/branches/core/src/util/Convert.h
r853 r854 226 226 return ConvertValue(output, input.getString()); 227 227 else 228 return false;228 return ConvertValue(output, (MultiTypePrimitive)input); 229 229 } 230 230 }; … … 240 240 return ConvertValue(output, input.getString()); 241 241 else 242 return false;242 return ConvertValue(output, (MultiTypePrimitive)input); 243 243 } 244 244 }; … … 264 264 return ConvertValue(output, input.getDegree()); 265 265 else 266 return false;266 return ConvertValue(output, (MultiTypeString)input); 267 267 } 268 268 }; … … 286 286 return ConvertValue(output, input.getDegree()); 287 287 else 288 return false;288 return ConvertValue(output, (MultiTypeString)input); 289 289 } 290 290 }; … … 397 397 bool operator()(orxonox::Vector2* output, const std::string& input) const 398 398 { 399 SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0'); 399 unsigned int opening_parenthesis, closing_parenthesis = input.find(')'); 400 if ((opening_parenthesis = input.find('(')) == std::string::npos) { opening_parenthesis = 0; } else { opening_parenthesis++; } 401 402 SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis), ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0'); 400 403 401 404 if (tokens.size() >= 2) … … 420 423 bool operator()(orxonox::Vector3* output, const std::string& input) const 421 424 { 422 SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0'); 425 unsigned int opening_parenthesis, closing_parenthesis = input.find(')'); 426 if ((opening_parenthesis = input.find('(')) == std::string::npos) { opening_parenthesis = 0; } else { opening_parenthesis++; } 427 428 SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis), ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0'); 423 429 424 430 if (tokens.size() >= 3) … … 445 451 bool operator()(orxonox::Vector4* output, const std::string& input) const 446 452 { 447 SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0'); 453 unsigned int opening_parenthesis, closing_parenthesis = input.find(')'); 454 if ((opening_parenthesis = input.find('(')) == std::string::npos) { opening_parenthesis = 0; } else { opening_parenthesis++; } 455 456 SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis), ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0'); 448 457 449 458 if (tokens.size() >= 4) … … 472 481 bool operator()(orxonox::Quaternion* output, const std::string& input) const 473 482 { 474 SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0'); 483 unsigned int opening_parenthesis, closing_parenthesis = input.find(')'); 484 if ((opening_parenthesis = input.find('(')) == std::string::npos) { opening_parenthesis = 0; } else { opening_parenthesis++; } 485 486 SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis), ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0'); 475 487 476 488 if (tokens.size() >= 4) … … 499 511 bool operator()(orxonox::ColourValue* output, const std::string& input) const 500 512 { 501 SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0'); 513 unsigned int opening_parenthesis, closing_parenthesis = input.find(')'); 514 if ((opening_parenthesis = input.find('(')) == std::string::npos) { opening_parenthesis = 0; } else { opening_parenthesis++; } 515 516 SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis), ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0'); 502 517 503 518 if (tokens.size() >= 4) -
code/branches/core/src/util/MultiTypeMath.cc
r853 r854 95 95 MultiTypeMath::operator orxonox::Vector3() const 96 96 { 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 else111 {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 97 return (this->type_ == MT_vector3) ? this->vector3_ : ConvertValueAndReturn<MultiTypeMath, orxonox::Vector3>(*this); 117 98 } -
code/branches/core/src/util/MultiTypeMath.h
r853 r854 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) { std::cout << "4_4: setValue Vector3: " << value << std::endl;this->type_ = MT_vector3; this->vector3_ = value; }99 inline void setValue(const orxonox::Vector3& value) { 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
r853 r854 32 32 MultiTypePrimitive::MultiTypePrimitive(MultiType type) 33 33 { 34 std::cout << "4_5: Created MultiTypePrimitive with type " << type << std::endl;35 34 this->type_ = type; 36 35 … … 191 190 void MultiTypePrimitive::setValue(const MultiTypePrimitive& mtp) 192 191 { 193 std::cout << "4_3: setValue in MultiTypePrimitive with other Multitype as parameter: " << mtp << std::endl;194 192 this->type_ = mtp.type_; 195 193 this->value_ = mtp.value_; -
code/branches/core/src/util/MultiTypeString.h
r853 r854 53 53 inline MultiTypeString(bool value) : MultiTypePrimitive(value) {} 54 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;}55 inline MultiTypeString(const std::string& value) { this->setValue(value); } 56 56 inline MultiTypeString(const MultiTypeString& mts) { this->setValue(mts); } 57 57
Note: See TracChangeset
for help on using the changeset viewer.