summaryrefslogtreecommitdiff
path: root/AK
AgeCommit message (Collapse)Author
2019-07-18ELFImage: Sprinkle some constification loveRobin Burchell
2019-07-18JsonValue: Add to_uint(), to_int() and as_double().Andreas Kling
The to_foo() functions are for converting when you might not be sure of the underlying value type. The as_foo() family assumes that you know exactly what the underlying value type is.
2019-07-16AK: Add a new TestSuite.h from my own work, adapted to match the existing ↵Robin Burchell
one a bit This gives a few new features: * benchmarks * the ability to run individual testcases easily * timing of tests
2019-07-16BufferStream: Add a function to fully reset stateRobin Burchell
This will allow us to reuse the same buffer with the same stream instance. Needed in AudioServer.
2019-07-16BufferStream: Add signed int overloads for read/writeRobin Burchell
This will be required in AudioServer
2019-07-15LogStream: Add a simple-ish mechanism for colorizing and styling output.Andreas Kling
Meet TStyle. It allows you to write things like this: dbg() << TStyle(TStyle::Red, TStyle::Bold) << "Hello, friends!"; Any style used will be reset along with the newline emitted when the dbg() temporary goes out of scope. :^) This can definitely be improved, but I think it's a decent place to start.
2019-07-15AK: Add a canonicalized_path() convenience function.Andreas Kling
This is the same as calling FileSystemPath(foo).string(). The majority of clients only care about canonicalizing a path, so let's have an easy way to express that.
2019-07-14AK/LibAudio: Add stream read operators to AK::BufferStream, and use it in ↵Robin Burchell
AWavLoader At the same time, we allow chaining of streaming operators, and add a way to check for partial reads (also used in WAV parsing).
2019-07-14AK: Remove some superstition from BufferStream :)Robin Burchell
2019-07-13AK: Add Queue::enqueue(const T&).Andreas Kling
2019-07-13AK: Support case-insensitive HashMap<String, T>.Andreas Kling
We achieve this by allowing you to specify custom traits for the key type. For convenience, we also provide a CaseInsensitiveStringTraits for String.
2019-07-11AK: Delete bad pointer assignment operators and constructors.Andreas Kling
We shouldn't allow constructing e.g an OwnPtr from a RefPtr, and similar conversions. Instead just delete those functions so the compiler whines loudly if you try to use them. This patch also deletes constructing OwnPtr from a WeakPtr, even though that *may* be a valid thing to do, it's sufficiently weird that we can make the client jump through some hoops if he really wants it. :^)
2019-07-11AK: Remove copy_ref().Andreas Kling
This patch removes copy_ref() from RefPtr and NonnullRefPtr. This means that it's now okay to simply copy these smart pointers instead: - RefPtr = RefPtr // Okay! - RefPtr = NonnullRefPtr // Okay! - NonnullRefPtr = NonnullRefPtr // Okay! - NonnullRefPtr = RefPtr // Not okay, since RefPtr can be null.
2019-07-11AK: Remove use of copy_ref().Andreas Kling
2019-07-11AK: Make it more more pleasant to copy RefPtr's.Andreas Kling
I had a silly ambition that we would avoid unnecessary ref count churn by forcing explicit use of "copy_ref()" wherever a copy was actually needed. This was making RefPtr a bit clunky to work with, for no real benefit. This patch adds the missing copy construction/assignment stuff to RefPtr.
2019-07-11AK: Remove weird RefPtr(RefPtr&) constructor.Andreas Kling
2019-07-11AK: Make MappedFile non-copyable.Andreas Kling
2019-07-11AK: Remove weird NonnullRefPtr(NonnullRefPtr&) constructor.Andreas Kling
2019-07-11AK: Use operator== for comparison in Vector::contains_slowRobin Burchell
2019-07-11AK: Add operator== & operator!= to VectorRobin Burchell
2019-07-11AKString: add missing comparison operatorsLawrence Manning
And some trivial tests.
2019-07-09AK: Add Platform.h with an ARCH() macro.Andreas Kling
You can currently use this to detect the CPU architecture like so: #if ARCH(I386) ... #elif ARCH(X86_64) ... #else ... #endif This will be helpful for separating out architecture-specific code blocks.
2019-07-09Kernel: Move VirtualAddress.h into VM/Andreas Kling
2019-07-08Kernel: Have the open() syscall take an explicit path length parameter.Andreas Kling
Instead of computing the path length inside the syscall handler, let the caller do that work. This allows us to implement to new variants of open() and creat(), called open_with_path_length() and creat_with_path_length(). These are suitable for use with e.g StringView.
2019-07-08StringBuilder: Reset the internal builder length after building.Andreas Kling
This puts the StringBuilder back into a pristine state, allowing you to use it to build more strings after you've built one.
2019-07-08StringView: Rename characters() to characters_without_null_termination().Andreas Kling
This should make you think twice before trying to use the const char* from a StringView as if it's a null-terminated string.
2019-07-08AK: Add some missing includes in SinglyLinkedList.Andreas Kling
2019-07-08AK: Add JsonValue::to_bool().Andreas Kling
2019-07-08MappedFile: Fix misuse of StringView::characters().Andreas Kling
This makes me wonder if the open() syscall should take characters+length and we'd compute the length at the LibC layer instead. That way we could also provide an optional non-POSIX open() that takes the length directly..
2019-07-08AK: Add JsonObject::set(key, &&value) overload.Andreas Kling
This dodges a whole bunch of value copying in JsonParser.
2019-07-08AK: Make it easy to convert between JsonValue and IPv4Address.Andreas Kling
They still use string storage, but this change makes it nice and easy to work with IPv4 addresses in JSON data.
2019-07-08AK: Add LogStream operator<< for IPv4Address.Andreas Kling
2019-07-08AK: Add IPv4Address::from_string(StringView).Andreas Kling
This attempts to parse an IPv4Address from a string, and gives us an excuse to try out the new Optional<T> for the return value. :^)
2019-07-08AK: Add a simple Optional<T> template.Andreas Kling
This can be used to store any type, with a flag that says if any value is present or not.
2019-07-08String: String::to_int() should fail for any empty string, not just null.Andreas Kling
2019-07-08LogStream: Uninline some public functions so the linker can find them.Andreas Kling
2019-07-04AK: Add Vector::insert_before_matching(T&&, callback);Andreas Kling
This allows you to do things like: vector.insert_before_matching(value, [](auto& entry) { return value < entry; }); Basically it scans until it finds an element that matches the condition callback and then inserts the new value before the matching element.
2019-07-04Vector: Simplify functions that take both T&& and const T&.Andreas Kling
We can implement foo(const T&) by invoking foo(T&&) with a temporary T.
2019-07-04AK: Move some of LogStream out of line & add overloads for smart pointers.Andreas Kling
2019-07-04AK: Start fleshing out LogStream, a type-aware logging mechanism.Andreas Kling
The first implementation class is DebugLogStream, which can be used like so: dbg() << "Hello friends, I am " << m_years << " years old!"; Note that it will automatically print a newline when the object created by dbg() goes out of scope. This API will grow and evolve, so let's see what we end up with :^)
2019-07-03AK: Rename the common integer typedefs to make it obvious what they are.Andreas Kling
These types can be picked up by including <AK/Types.h>: * u8, u16, u32, u64 (unsigned) * i8, i16, i32, i64 (signed)
2019-07-03AK: Add String::number() for creating a String from a number.Andreas Kling
Instead of manually doing String::format("%d"/"%u") everywhere, let's have a String API for this. It's just a wrapper around format() for now, but it could be made more efficient in the future.
2019-07-01AK: Add u8/u16/u32/u64 and i8/i16/i32/i64 typedefs.Andreas Kling
These are more explicit and will be immediately understandable unlike the old types which assume that you're in an IA-32 headspace. :^)
2019-06-30Meta: Removed all gitignore in the source tree only keeping the root oneVAN BOSSUYT Nicolas
2019-06-29AK: Allow HashMap to be used with non-default-constructible values.Andreas Kling
Solve this by adding find() overloads to HashTable and SinglyLinkedList that take a templated functor for comparing the values. This allows HashMap to call HashTable::find() without having to create a temporary Entry for use as the table key. :^)
2019-06-29AK: Defer to Traits<T> for equality comparison in container templates.Andreas Kling
This is prep work for supporting HashMap with NonnullRefPtr<T> as values. It's currently not possible because many HashTable functions require being able to default-construct the value type.
2019-06-29JsonValue: Add is_bool() and various as_foo() helpers.Andreas Kling
2019-06-29JsonValue: No need to null-check StringImpls if type is Type::String.Andreas Kling
If you try to create a JsonValue from a null String(), it will become a null JsonValue anyway.
2019-06-29StringView: Make it easy to construct from a ByteBuffer.Andreas Kling
2019-06-29HashTable: Don't use move assignment in set(const T&).Andreas Kling