Changeset 220 for osgVisual/trunk/src
- Timestamp:
- Feb 2, 2011, 10:14:57 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
osgVisual/trunk/src/util/visual_util.cpp
r218 r220 536 536 } 537 537 538 intutil::strToDouble(std::string s)538 double util::strToDouble(std::string s) 539 539 { 540 540 double tmp; 541 541 std::stringstream sstr(s); 542 sstr >> tmp; 543 return tmp; 544 } 545 546 double util::strToInt(std::string s) 542 if (!(sstr >> tmp)) 543 { 544 OSG_ALWAYS << __FUNCTION__ << "Warning:Unable to convert "<< s <<" to double, using 0.0 as default!" << std::endl; 545 return 0.0; 546 } 547 else 548 return tmp; 549 } 550 551 int util::strToInt(std::string s) 547 552 { 548 553 int tmp; 549 554 std::stringstream sstr(s); 550 sstr >> tmp; 551 return tmp; 555 if (!(sstr >> tmp)) 556 { 557 OSG_ALWAYS << __FUNCTION__ << "Warning:Unable to convert "<< s <<" to int, using 0 as default!" << std::endl; 558 return 0; 559 } 560 else 561 return tmp; 552 562 } 553 563
Note: See TracChangeset
for help on using the changeset viewer.