Commit graph

25 commits

Author SHA1 Message Date
Timothy Flynn
fe2dff4944 AK+Everywhere: Convert JSON value serialization to String
This removes the use of StringBuilder::OutputType (which was ByteString,
and only used by the JSON classes). And it removes the StringBuilder
template parameter from the serialization methods; this was only ever
used with StringBuilder, so a template is pretty overkill here.
2025-02-20 19:27:51 -05:00
Timothy Flynn
2c03de60da AK+Everywhere: Remove now-unecessary use of ByteString with JSON types
This removes JsonObject::get_byte_string and JsonObject::to_byte_string.
2025-02-20 19:27:51 -05:00
Timothy Flynn
bc54c0cdfb AK+Everywhere: Store JSON strings as String 2025-02-20 19:27:51 -05:00
Timothy Flynn
e591636419 AK+Everywhere: Store JSON object keys as String 2025-02-20 19:27:51 -05:00
Timothy Flynn
70eb0ba1cd AK+Everywhere: Remove the char const* JSON value constructor 2025-02-20 19:27:51 -05:00
Timothy Flynn
9a4bb958ac LibCore: Remove ErrorOr return type from read_long_version_string
Nothing in this function is fallible.
2025-02-13 08:27:02 -05:00
Tim Ledbetter
c67035b9c1 LibCore/ArgsParser: Treat multi-use arguments as required 2025-02-05 06:58:52 -05:00
Pavel Shliak
6ec06a01a2 LibCore: Do not include math.h in ArgsParser 2024-12-08 16:38:13 +00:00
Timothy Flynn
93712b24bf Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
Andreas Kling
13d7c09125 Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
Lenny Maiorani
f99d1d3bd7 Vector: Implement find, find_if, find_first_matching in terms of AK::find*
Problem:
- The implementation of `find` is coupled to the implementation of `Vector`.
- `Vector::find` takes the predicate by value which might be expensive.

Solution:
- Decouple the implementation of `find` from `Vector` by using a
  generic `find` algorithm.
- Change the name of `find` with a predicate to `find_if` so that a
  binding reference can be used and the predicate can be forwarded to
  avoid copies.
- Change all the `find(pred)` call sites to use `find_if`.
2021-01-11 19:45:05 +01:00
Ben Wiederhake
52a8062084 LibCore: Offer to display a general description 2020-12-06 00:06:53 +01:00
asynts
3b3edbc4d2 AK: Rename new_out to out and new_warn to warn. 2020-11-09 16:21:29 +01:00
Andreas Kling
6d841f2628 LibCore: Run clang-format on ArgsParser.cpp 2020-11-07 21:13:56 +01:00
Nico Weber
b143e604d7 LibCore: Add an ArgsParser::add_option() overload for doubles 2020-11-07 18:28:35 +01:00
asynts
c9ca897a45 LibCore: Use new format functions in some places. 2020-10-17 23:20:31 +02:00
Ben Wiederhake
ede5dbd7b3 Meta+LibC through LibHTTP: Make clang-format-10 clean
Why break at LibHTTP? Because "Meta+Libraries" would be insanely large,
and breaking between LibHTTP and LibJS makes the commits roughly evenly large.
2020-09-25 21:18:17 +02:00
Diego Iastrubni
64c15798e7 LibCore: Add support for double on argparse
Code is pretty trivial. If someone needs "float" support, a copy-paste
will be in place.

Build system was confused between math.h from rootfs, and toolchain. I
fixed the problem caused by `math.h` by locally using the builtin
`isnan()` from the compiler. It's ugly - but works. I am looking for
other alternatives.
2020-08-12 13:57:06 +02:00
Andreas Kling
fdfda6dec2 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
2020-06-12 21:28:55 +02:00
Sergey Bugaev
b4ca45b5ec LibCore: Update Core::ArgsParser to the new error message format 2020-05-30 15:01:18 +02:00
AnotherTest
1c4f38749e LibCore: Allow ArgsParser::parse() to not exit on failure
This allows its use in places where multiple calls to
ArgsParser::parse() are needed, such as Shell builtins.
2020-05-17 11:58:08 +02:00
AnotherTest
16ba0b39f3 LibCore: Reset getopt's state when starting parse()
This way, a program can use ArgsParser multiple times, potentially with
multiple different options.
2020-05-17 11:58:08 +02:00
Andreas Kling
37fc6c117c Userspace: Add missing #includes now that AK/StdLibExtras.h is smaller 2020-03-08 13:06:51 +01:00
Andreas Kling
ceec1a7d38 AK: Make Vector use size_t for its size and capacity 2020-02-25 14:52:35 +01:00
Andreas Kling
d17e23bd27 LibCore: Remove leading C from filenames 2020-02-06 15:04:03 +01:00
Renamed from Libraries/LibCore/CArgsParser.cpp (Browse further)