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