AK: Make Utf8View constructors inline and remove C string constructor

Using StringView instead of C strings is basically always preferable.
The only reason to use a C string is because you are calling a C API.
This commit is contained in:
Andreas Kling 2021-09-18 18:02:41 +02:00
commit 1be4cbd639
Notes: sideshowbarker 2024-07-18 03:43:17 +09:00
9 changed files with 36 additions and 42 deletions

View file

@ -7,6 +7,7 @@
#pragma once
#include <AK/String.h>
#include <AK/StringView.h>
#include <AK/Types.h>
@ -53,9 +54,17 @@ public:
using Iterator = Utf8CodePointIterator;
Utf8View() = default;
explicit Utf8View(const String&);
explicit Utf8View(const StringView&);
explicit Utf8View(const char*);
explicit Utf8View(String& string)
: m_string(string.view())
{
}
explicit Utf8View(StringView string)
: m_string(string)
{
}
~Utf8View() = default;
explicit Utf8View(String&&) = delete;