Changes in uspace/lib/cpp/src/string.cpp [c735afb:bc56f30] in mainline
- File:
-
- 1 edited
-
uspace/lib/cpp/src/string.cpp (modified) (35 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/cpp/src/string.cpp
rc735afb rbc56f30 1 1 /* 2 * Copyright (c) 201 8Jaroslav Jindrak2 * Copyright (c) 2019 Jaroslav Jindrak 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 #include <cassert> 29 30 #include <string> 30 31 … … 34 35 { 35 36 // TODO: implement using stol once we have numeric limits 37 __unimplemented(); 36 38 return 0; 37 39 } … … 40 42 { 41 43 char* end; 42 long result = hel::strtol(str.c_str(), &end, base);44 long result = ::strtol(str.c_str(), &end, base); 43 45 44 46 if (end != str.c_str()) … … 56 58 { 57 59 char* end; 58 unsigned long result = hel::strtoul(str.c_str(), &end, base);60 unsigned long result = ::strtoul(str.c_str(), &end, base); 59 61 60 62 if (end != str.c_str()) … … 72 74 { 73 75 // TODO: implement using stol once we have numeric limits 76 __unimplemented(); 74 77 return 0; 75 78 } … … 78 81 { 79 82 // TODO: implement using stoul once we have numeric limits 83 __unimplemented(); 80 84 return 0; 81 85 } … … 84 88 { 85 89 // TODO: implement 90 __unimplemented(); 86 91 return 0.f; 87 92 } … … 90 95 { 91 96 // TODO: implement 97 __unimplemented(); 92 98 return 0.0; 93 99 } … … 96 102 { 97 103 // TODO: implement 104 __unimplemented(); 98 105 return 0.0l; 99 106 } 100 107 101 namespace hel102 {103 extern "C" int asprintf(char**, const char*, ...);104 }105 106 108 string to_string(int val) 107 109 { 108 110 char* tmp; 109 hel::asprintf(&tmp, "%d", val);111 ::asprintf(&tmp, "%d", val); 110 112 111 113 std::string res{tmp}; … … 118 120 { 119 121 char* tmp; 120 hel::asprintf(&tmp, "%u", val);122 ::asprintf(&tmp, "%u", val); 121 123 122 124 std::string res{tmp}; … … 129 131 { 130 132 char* tmp; 131 hel::asprintf(&tmp, "%ld", val);133 ::asprintf(&tmp, "%ld", val); 132 134 133 135 std::string res{tmp}; … … 140 142 { 141 143 char* tmp; 142 hel::asprintf(&tmp, "%lu", val);144 ::asprintf(&tmp, "%lu", val); 143 145 144 146 std::string res{tmp}; … … 151 153 { 152 154 char* tmp; 153 hel::asprintf(&tmp, "%lld", val);155 ::asprintf(&tmp, "%lld", val); 154 156 155 157 std::string res{tmp}; … … 162 164 { 163 165 char* tmp; 164 hel::asprintf(&tmp, "%llu", val);166 ::asprintf(&tmp, "%llu", val); 165 167 166 168 std::string res{tmp}; … … 173 175 { 174 176 char* tmp; 175 hel::asprintf(&tmp, "%f", val);177 ::asprintf(&tmp, "%f", val); 176 178 177 179 std::string res{tmp}; … … 184 186 { 185 187 char* tmp; 186 hel::asprintf(&tmp, "%f", val);188 ::asprintf(&tmp, "%f", val); 187 189 188 190 std::string res{tmp}; … … 195 197 { 196 198 char* tmp; 197 hel::asprintf(&tmp, "%Lf", val);199 ::asprintf(&tmp, "%Lf", val); 198 200 199 201 std::string res{tmp}; … … 206 208 { 207 209 // TODO: implement 210 __unimplemented(); 208 211 return 0; 209 212 } … … 212 215 { 213 216 // TODO: implement 217 __unimplemented(); 214 218 return 0; 215 219 } … … 218 222 { 219 223 // TODO: implement 224 __unimplemented(); 220 225 return 0; 221 226 } … … 224 229 { 225 230 // TODO: implement 231 __unimplemented(); 226 232 return 0; 227 233 } … … 230 236 { 231 237 // TODO: implement 238 __unimplemented(); 232 239 return 0; 233 240 } … … 236 243 { 237 244 // TODO: implement 245 __unimplemented(); 238 246 return 0.f; 239 247 } … … 242 250 { 243 251 // TODO: implement 252 __unimplemented(); 244 253 return 0.0; 245 254 } … … 248 257 { 249 258 // TODO: implement 259 __unimplemented(); 250 260 return 0.0l; 251 261 } … … 254 264 { 255 265 // TODO: implement 266 __unimplemented(); 256 267 return wstring{}; 257 268 } … … 260 271 { 261 272 // TODO: implement 273 __unimplemented(); 262 274 return wstring{}; 263 275 } … … 266 278 { 267 279 // TODO: implement 280 __unimplemented(); 268 281 return wstring{}; 269 282 } … … 272 285 { 273 286 // TODO: implement 287 __unimplemented(); 274 288 return wstring{}; 275 289 } … … 278 292 { 279 293 // TODO: implement 294 __unimplemented(); 280 295 return wstring{}; 281 296 } … … 284 299 { 285 300 // TODO: implement 301 __unimplemented(); 286 302 return wstring{}; 287 303 } … … 290 306 { 291 307 // TODO: implement 308 __unimplemented(); 292 309 return wstring{}; 293 310 } … … 296 313 { 297 314 // TODO: implement 315 __unimplemented(); 298 316 return wstring{}; 299 317 } … … 302 320 { 303 321 // TODO: implement 322 __unimplemented(); 304 323 return wstring{}; 305 324 }
Note:
See TracChangeset
for help on using the changeset viewer.
