summaryrefslogtreecommitdiff
path: root/AK
AgeCommit message (Collapse)Author
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
2019-06-29AK: Make a tiny JSON unit test based on a saved VisualBuilder form.Andreas Kling
2019-06-29Kernel: Change the format of /proc/all to JSON.Andreas Kling
Update ProcessManager, top and WSCPUMonitor to handle the new format. Since the kernel is not allowed to use floating-point math, we now compile the JSON classes in AK without JsonValue::Type::Double support. To accomodate large unsigned ints, I added a JsonValue::Type::UnsignedInt.
2019-06-28AK: We can't use std::initializer_list in LibC builds.Andreas Kling
The LibC build is a bit complicated, since the toolchain depends on it. During the toolchain bootstrap, after we've built parts of GCC, we have to stop and build Serenity's LibC, so that the rest of GCC can use it. This means that during that specific LibC build, we don't yet have access to things like std::initializer_list. For now we solve this by defining SERENITY_LIBC_BUILD during the LibC build and excluding the Vector/initializer_list support inside LibC.
2019-06-28AK: Add Vector(std::initializer_list<T>) constructor.Andreas Kling
This allows us to construct a Vector from an initializer list like so: Vector<Object> objects = { object1, object2, object3 };
2019-06-27AK: Use a SinglyLinkedList<T> as HashTable's bucket chain storage.Andreas Kling
We were using a DoublyLinkedList<T> simply because it supported remove(). This patch consolidates the SinglyLinkedList iterators and adds remove().
2019-06-27AK: Oops, fix typo in RemoveVolatile<T> helper.Andreas Kling
2019-06-27AK: Consolidate iterators for HashTable and DoublyLinkedList respectively.Andreas Kling
Get rid of the ConstIterator classes for these containers and use templated FooIterator<T, ...> and FooIterator<const T, ...> helpers. This makes the HashTable class a lot easier to read.
2019-06-27AK: Get rid of ConstVectorIterator.Andreas Kling
We can achieve the same with just a VectorIterator<const Vector, const T>.
2019-06-27AK: Simplify HashMap a bit.Andreas Kling
2019-06-27AK: NonnullRefPtrVector should use Vector<T, inline_capacity> as its base.Andreas Kling
We were forgetting to plumb through the inline capacity in the Base typedef.
2019-06-27AK: Allow constructing an empty NonnullRefPtrVector.Andreas Kling
2019-06-27AK: Support range-for iteration over a NonnullRefPtrVector<T>.Andreas Kling
This means you can now do this: void harmonize(NonnullRefPtrVector<Voice>& voices) { for (auto& voice : voices) { voice.sing(); // Look, no "->"! } } Pretty dang cool :^)
2019-06-27AK: Add NonnullRefPtrVector<T>.Andreas Kling
This is a slot-in convenience replacement for Vector<NonnullRefPtr<T>> that makes accessors return T& instead of NonnullRefPtr<T>&. Since NonnullRefPtr guarantees non-nullness, this allows you to access these vector elements using dot (.) rather than arrow (->). :^)