- Timestamp:
- Sep 11, 2008, 4:40:01 PM (16 years ago)
- Location:
- code/branches/core3/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core3/src/orxonox/Orxonox.cc
r1766 r1768 89 89 static bool convert(orxonox::Radian* output, const char* input) 90 90 { 91 //std::string asdf("asfd"); 92 //std::cout << asdf; 91 93 float temp; 92 94 convertValue(&temp, input); … … 94 96 } 95 97 }; 98 99 class FooBar { }; 96 100 97 101 … … 217 221 //convertValue(&str, 4.0f); 218 222 219 220 using ::operator<<; 223 //using ::operator<<; 221 224 using std::string; 222 225 int a = 3; 223 Radian asdf; 224 COUT(3) << asdf; 226 FooBar asdf; 227 std::string asdf2; 228 std::cout << asdf2; 229 ConvertValue(&asdf2, asdf); 230 //COUT(3) << asdf; 225 231 226 232 TestConv(1, int, (3), float, 3.0); … … 232 238 TestConv(7, const char*, ("4.3"), float, 4.3f); 233 239 TestConv(8, const char*, ("4,3"), Vector2, Vector2(4,3)); 234 TestConv(9, const char*, ("4.4"), Radian, Radian(4.4));240 //TestConv(9, const char*, ("4.4"), Radian, Radian(4.4)); 235 241 TestConv(100, int, (3), const char*, "3"); 236 242 TestConv(101, Vector3, (1, 2, 3), float, 3.0); -
code/branches/core3/src/util/ArgReader.cc
r1766 r1768 82 82 CmdLineArg arg; 83 83 84 int a = ImplicitConversion<FooBar, const char*>::exists; 84 //std::cout << errorString_; 85 86 int a = conversionTests::ImplicitConversion<FooBar, const char*>::exists; 85 87 int val1; 86 88 long long val2 = conversion_cast<long long>(val1); -
code/branches/core3/src/util/Convert.h
r1766 r1768 50 50 #endif 51 51 52 ///////////////////////////////////53 // Explicit Conversion Functions //54 ///////////////////////////////////55 56 57 52 /////////////////////////////////////////////// 58 53 // Static detection for conversion functions // … … 96 91 return *(new conversionTests::VeryBigStruct()); 97 92 } 98 }99 100 namespace conversionTests101 {102 // Part of the msvc hack. See above in the namespace for more explanations.103 using namespace separate_namespace;104 93 105 94 // These operators simply accept anything but have lower priority than specialisations … … 111 100 template <class Any> 112 101 conversionTests::VeryBigStruct operator>>(std::istream& instream, const Any anything); 102 } 103 104 namespace conversionTests 105 { 106 // Part of the msvc hack. See above in the namespace for more explanations. 107 using namespace separate_namespace; 113 108 114 109 template <class FromType, class ToType> … … 144 139 { 145 140 IStringStreamOperator(); IStringStreamOperator(const IStringStreamOperator&); ~IStringStreamOperator(); 146 static std::istr ingstream istream_; // helper object to perform the '>>' operation141 static std::istream istream_; // helper object to perform the '>>' operation 147 142 static Type object; // helper object to handle private c'tor and d'tor 148 143 public: … … 154 149 { 155 150 OStringStreamOperator(); OStringStreamOperator(const OStringStreamOperator&); ~OStringStreamOperator(); 156 static std::ostr ingstream ostream_; // helper object to perform the '<<' operation151 static std::ostream ostream_; // helper object to perform the '<<' operation 157 152 static Type object; // helper object to handle private c'tor and d'tor 158 153 public: … … 169 164 Usage: ImplicitConversion<FromType, ToType>::exists 170 165 */ 171 template <class FromType, class ToType>172 struct ImplicitConversion173 { enum { exists = conversionTests::ImplicitConversion<FromType, ToType>::exists }; };166 //template <class FromType, class ToType> 167 //struct ImplicitConversion 168 //{ enum { exists = conversionTests::asdf::ImplicitConversion<FromType, ToType>::exists }; }; 174 169 175 170 /** … … 179 174 Usage: ExplicitConversion<FromType, ToType>::exists 180 175 */ 181 template <class FromType, class ToType>182 struct ExplicitConversion183 { enum { exists = conversionTests::ExplicitConversion<FromType, ToType>::exists }; };176 //template <class FromType, class ToType> 177 //struct ExplicitConversion 178 //{ enum { exists = conversionTests::asdf::ExplicitConversion<FromType, ToType>::exists }; }; 184 179 185 180 /** … … 189 184 Usage: IStringStreamConversion<FromType, ToType>::exists 190 185 */ 191 template <class Type>192 struct IStringStreamOperator193 { enum { exists = conversionTests::IStringStreamOperator<Type>::exists }; };186 //template <class Type> 187 //struct IStringStreamOperator 188 //{ enum { exists = conversionTests::asdf::IStringStreamOperator<Type>::exists }; }; 194 189 195 190 /** … … 199 194 Usage: OStringStreamConversion<FromType, ToType>::exists 200 195 */ 201 template <class Type>202 struct OStringStreamOperator203 { enum { exists = conversionTests::OStringStreamOperator<Type>::exists }; };196 //template <class Type> 197 //struct OStringStreamOperator 198 //{ enum { exists = conversionTests::asdf::OStringStreamOperator<Type>::exists }; }; 204 199 205 200 … … 286 281 static bool convert(std::string* output, const FromType& input) 287 282 { 288 const bool probe = OStringStreamOperator<FromType>::exists;283 const bool probe = conversionTests::OStringStreamOperator<FromType>::exists; 289 284 return convert(output, input, StringStreamPossible<probe>()); 290 285 } … … 328 323 static bool convert(ToType* output, const std::string& input) 329 324 { 330 const bool probe = IStringStreamOperator<ToType>::exists;325 const bool probe = conversionTests::IStringStreamOperator<ToType>::exists; 331 326 return convert(output, input, StringStreamPossible<probe>()); 332 327 } … … 381 376 inline bool convert(ToType* output, const FromType& input, ExplicitPossible<false>) 382 377 { 383 const bool probe = ImplicitConversion<FromType, ToType>::exists;378 const bool probe = conversionTests::ImplicitConversion<FromType, ToType>::exists; 384 379 return convert(output, input, ImplicitPossible<probe>()); 385 380 } … … 398 393 { 399 394 // check for explicit conversion via function overloading 400 const bool probe = ExplicitConversion<FromType, ToType>::exists;395 const bool probe = conversionTests::ExplicitConversion<FromType, ToType>::exists; 401 396 return conversion::convert(output, input, conversion::ExplicitPossible<probe>()); 402 397 } -
code/branches/core3/src/util/Math.h
r1766 r1768 70 70 71 71 // Vector2 to std::string 72 inline bool explicitConversion(std::string* output, const orxonox::Vector2& input)73 {74 std::ostringstream ostream;75 if (ostream << input.x << "," << input.y)76 {77 (*output) = ostream.str();78 return true;79 }80 return false;81 }72 //inline bool explicitConversion(std::string* output, const orxonox::Vector2& input) 73 //{ 74 // std::ostringstream ostream; 75 // if (ostream << input.x << "," << input.y) 76 // { 77 // (*output) = ostream.str(); 78 // return true; 79 // } 80 // return false; 81 //} 82 82 83 83 // Vector3 to std::string -
code/branches/core3/src/util/MultiType.h
r1729 r1768 129 129 130 130 virtual void toString(std::ostream& outstream) const = 0; 131 //virtual void toString(std::ostream& outstream) const = 0; 132 //inline friend virtual std::ostream& operator <<(std::ostream& outstream, const MT_ValueBase& mtb); 131 133 132 134 MT_Type type_; … … 238 240 template <class T> operator T*() const { return ((T*)this->operator void*()); } 239 241 242 inline friend std::ostream& operator<<(std::ostream& outstream, const MultiType& mt) { if (mt.value_) { mt.value_->toString(outstream); } return outstream; } 243 240 244 inline void getValue(char* value) const { if (this->value_) { (*value) = (*this->value_); } } 241 245 inline void getValue(unsigned char* value) const { if (this->value_) { (*value) = (*this->value_); } } … … 318 322 }; 319 323 320 _UtilExport inline std::ostream& operator<<(std::ostream& outstream, const MultiType& mt) { if (mt.value_) { mt.value_->toString(outstream); } return outstream; }324 //_UtilExport inline std::ostream& operator<<(std::ostream& outstream, const MultiType& mt) { if (mt.value_) { mt.value_->toString(outstream); } return outstream; } 321 325 322 326 template <> inline bool MultiType::isType<char>() const { return (this->value_ && this->value_->type_ == MT_char); } -
code/branches/core3/src/util/MultiTypeValue.h
r1727 r1768 91 91 inline operator orxonox::Degree() const { return getConvertedValue<T, orxonox::Degree> (this->value_); } 92 92 93 inline void toString(std::ostream& outstream) const { outstream << this->value_; } 93 inline void toString(std::ostream& outstream) const { std::operator <<(outstream, conversion_cast<std::string>(this->value_)); } 94 //inline friend std::ostream& operator <<(std::ostream& outstream, const MT_Value& mtv) { outstream << conversion_cast<std::string>(this->value_); return outsream; } 94 95 95 96 T value_;
Note: See TracChangeset
for help on using the changeset viewer.