Changeset 947 for code/branches/core2/src/util
- Timestamp:
- Mar 28, 2008, 10:13:58 PM (17 years ago)
- Location:
- code/branches/core2/src/util
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core2/src/util/MultiTypeMath.cc
r933 r947 144 144 } 145 145 146 std::string MultiTypeMath::getTypename() const 147 { 148 if (this->type_ == MT_vector2) 149 return "Vector2"; 150 else if (this->type_ == MT_vector3) 151 return "Vector3"; 152 else if (this->type_ == MT_colourvalue) 153 return "ColourValue"; 154 else if (this->type_ == MT_quaternion) 155 return "Quaternion"; 156 else if (this->type_ == MT_radian) 157 return "Radian"; 158 else if (this->type_ == MT_degree) 159 return "Degree"; 160 else 161 return MultiTypeString::getTypename(); 162 } 163 146 164 std::string MultiTypeMath::toString() const 147 165 { -
code/branches/core2/src/util/MultiTypeMath.h
r933 r947 145 145 inline void getValue(orxonox::Degree* variable) const { (*variable) = orxonox::Degree (this->degree_); } 146 146 147 virtual std::string getTypename() const; 148 147 149 virtual std::string toString() const; 148 150 virtual bool fromString(const std::string value); -
code/branches/core2/src/util/MultiTypePrimitive.cc
r933 r947 167 167 } 168 168 169 std::string MultiTypePrimitive::getTypename() const 170 { 171 if (this->type_ == MT_void) 172 return "pointer"; 173 else if (this->type_ == MT_int) 174 return "int"; 175 else if (this->type_ == MT_uint) 176 return "unsigned int"; 177 else if (this->type_ == MT_char) 178 return "char"; 179 else if (this->type_ == MT_uchar) 180 return "unsigned char"; 181 else if (this->type_ == MT_short) 182 return "short"; 183 else if (this->type_ == MT_ushort) 184 return "unsigned short"; 185 else if (this->type_ == MT_long) 186 return "long"; 187 else if (this->type_ == MT_ulong) 188 return "unsigned long"; 189 else if (this->type_ == MT_float) 190 return "float"; 191 else if (this->type_ == MT_double) 192 return "double"; 193 else if (this->type_ == MT_longdouble) 194 return "long double"; 195 else if (this->type_ == MT_bool) 196 return "bool"; 197 else 198 return "unknown"; 199 } 200 169 201 std::string MultiTypePrimitive::toString() const 170 202 { -
code/branches/core2/src/util/MultiTypePrimitive.h
r933 r947 181 181 inline bool isA(MultiType type) const { return (this->type_ == type); } 182 182 183 virtual std::string getTypename() const; 184 183 185 virtual std::string toString() const; 184 186 virtual bool fromString(const std::string value); -
code/branches/core2/src/util/MultiTypeString.cc
r933 r947 104 104 } 105 105 106 std::string MultiTypeString::getTypename() const 107 { 108 if (this->type_ == MT_constchar) 109 return "string"; 110 else if (this->type_ == MT_string) 111 return "string"; 112 else if (this->type_ == MT_xmlelement) 113 return "XML-element"; 114 else 115 return MultiTypePrimitive::getTypename(); 116 } 117 106 118 std::string MultiTypeString::toString() const 107 119 { -
code/branches/core2/src/util/MultiTypeString.h
r933 r947 115 115 inline void getValue(orxonox::Element* variable) const { (*variable) = this->xmlelement_; } 116 116 117 virtual std::string getTypename() const; 118 117 119 virtual std::string toString() const; 118 120 virtual bool fromString(const std::string value); -
code/branches/core2/src/util/String.cc
r931 r947 25 25 * 26 26 */ 27 28 #include <cctype> 27 29 28 30 #include "String.h" … … 116 118 void lowercase(std::string* str) 117 119 { 118 static unsigned const char difference_between_A_and_a = 'A' - 'a'; 119 120 for (std::string::iterator it = (*str).begin(); it != (*str).end(); ++it) 121 if ((*it) >= 'A' && (*it) <= 'Z') 122 (*it) -= difference_between_A_and_a; 120 for (unsigned int i = 0; i < str->size(); ++i) 121 { 122 (*str)[i] = tolower((*str)[i]); 123 } 123 124 } 124 125 … … 141 142 void uppercase(std::string* str) 142 143 { 143 static unsigned const char difference_between_A_and_a = 'A' - 'a'; 144 145 for (std::string::iterator it = (*str).begin(); it != (*str).end(); ++it) 146 if ((*it) >= 'a' && (*it) <= 'z') 147 (*it) += difference_between_A_and_a; 144 for (unsigned int i = 0; i < str->size(); ++i) 145 { 146 (*str)[i] = toupper((*str)[i]); 147 } 148 148 } 149 149
Note: See TracChangeset
for help on using the changeset viewer.