1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:58:11 +00:00

AK: Make string-to-number conversion helpers return Optional

Get rid of the weird old signature:

- int StringType::to_int(bool& ok) const

And replace it with sensible new signature:

- Optional<int> StringType::to_int() const
This commit is contained in:
Andreas Kling 2020-06-12 21:07:52 +02:00
parent 15f4043a7a
commit fdfda6dec2
55 changed files with 354 additions and 455 deletions

View file

@ -65,11 +65,12 @@ int main(int argc, char** argv)
if (argc != 2)
print_usage_and_exit();
bool ok;
pid_t pid = String(argv[1]).to_int(ok);
if (!ok)
auto pid_opt = String(argv[1]).to_int();
if (!pid_opt.has_value())
print_usage_and_exit();
pid_t pid = pid_opt.value();
GUI::Application app(argc, argv);
auto window = GUI::Window::construct();