summaryrefslogtreecommitdiff
path: root/AK/Utf8View.cpp
AgeCommit message (Collapse)Author
2020-10-22AK: Make Utf8View and Utf32View more consistentTom
This enables use of these classes in templated code.
2020-10-08AK: Use new format functions.asynts
2020-08-05Unicode: Try s/codepoint/code_point/g againNico Weber
This time, without trailing 's'. Ran: git grep -l 'codepoint' | xargs sed -ie 's/codepoint/code_point/g
2020-08-05Revert "Unicode: s/codepoint/code_point/g"Nico Weber
This reverts commit ea9ac3155d1774f13ac4e9a96605c0e85a8f299e. It replaced "codepoint" with "code_points", not "code_point".
2020-08-03Unicode: s/codepoint/code_point/gAndreas Kling
Unicode calls them "code points" so let's follow their style.
2020-05-18AK: Add a way to get the number of valid bytes in a Utf8ViewAnotherTest
2020-05-17AK: Add Utf8View::length_in_codepoints()Andreas Kling
2020-02-25AK, LibGfx, LibGUI: Initialize various variables to zero.Emanuel Sprung
The not initialized variables can lead to compiler warnings that become errors with the -Werror flag.
2020-02-14AK: Add a forward declaration headerAndreas Kling
You can now #include <AK/Forward.h> to get most of the AK types as forward declarations. Header dependency explosion is one of the main contributors to compile times at the moment, so this is a step towards smaller include graphs.
2020-01-24Meta: Claim copyright for files created by meSergey Bugaev
This changes copyright holder to myself for the source code files that I've created or have (almost) completely rewritten. Not included are the files that were significantly changed by others even though it was me who originally created them (think HtmlView), or the many other files I've contributed code to.
2020-01-18Meta: Add license header to source filesAndreas Kling
As suggested by Joshua, this commit adds the 2-clause BSD license as a comment block to the top of every source file. For the first pass, I've just added myself for simplicity. I encourage everyone to add themselves as copyright holders of any file they've added or modified in some significant way. If I've added myself in error somewhere, feel free to replace it with the appropriate copyright holder instead. Going forward, all new source files should include a license header.
2019-12-09AK: Use size_t for the length of stringsAndreas Kling
Using int was a mistake. This patch changes String, StringImpl, StringView and StringBuilder to use size_t instead of int for lengths. Obviously a lot of code needs to change as a result of this.
2019-10-18UTF-8: Add Utf8CodepointIterator::codepoint_length_in_bytes()Andreas Kling
This allows you to retrieve the length (in bytes) of the codepoint the iterator is currently pointing at.
2019-09-15Utf8View: Don't print potentially unterminated string in debug messageAndreas Kling
2019-09-08AK: Fix buffer overrun in Utf8CodepointIterator::operator++Sergey Bugaev
The old implementation tried to move forward as long as the current byte looks like a UTF-8 character continuation byte (has its two most significant bits set to 10). This is correct as long as we assume the string is actually valid UTF-8, which we do (we also have a separate method that can check whether it is the case). We can't, however, assume that the data after the end of our string is also valid UTF-8 (in fact, we're not even allowed to look at data outside out string, but it happens to a valid memory region most of the time). If the byte after the end of our string also has its most significant bits set to 10, we would move one byte forward, and then fail the m_length > 0 assertion. One way to fix this would be to add a length check inside the loop condition. The other one, implemented in this commit, is to reimplement the whole function in terms of decode_first_byte(), which gives us the length as encoded in the first byte. This also brings it more in line with the other functions around it that do UTF-8 decoding.
2019-09-05Utf8View: Try fixing the travis-ci buildAndreas Kling
There's some overload ambiguity when doing Utf8View("literal")
2019-09-05AK: Log UTF-8 validation errorsSergey Bugaev
2019-09-05AK: Add some more utility methods to Utf8ViewSergey Bugaev
2019-08-28AK: Add a Utf8View type for iterating over UTF-8 codepointsSergey Bugaev
Utf8View wraps a StringView and implements begin() and end() that return a Utf8CodepointIterator, which parses UTF-8-encoded Unicode codepoints and returns them as 32-bit integers. This is the first step towards supporting emojis in Serenity ^) https://github.com/SerenityOS/serenity/issues/490