summaryrefslogtreecommitdiff
path: root/Ladybird/Utilities.cpp
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2023-03-13 17:30:31 -0400
committerLinus Groh <mail@linusgroh.de>2023-03-13 22:05:22 +0000
commitb4d3fea0024001f899ace5e6f377d7232df21656 (patch)
tree59c2762957d0d2afc4c575a54cc6cf92dcb557b5 /Ladybird/Utilities.cpp
parentfc15968418352c877c2b0827fe1b1b1ab17bdd6d (diff)
downloadserenity-b4d3fea0024001f899ace5e6f377d7232df21656.zip
Ladybird: Add a utility to create a QString from an AK::String
Diffstat (limited to 'Ladybird/Utilities.cpp')
-rw-r--r--Ladybird/Utilities.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/Ladybird/Utilities.cpp b/Ladybird/Utilities.cpp
index 12a534a1a6..4f0fa2de5a 100644
--- a/Ladybird/Utilities.cpp
+++ b/Ladybird/Utilities.cpp
@@ -29,6 +29,12 @@ QString qstring_from_ak_deprecated_string(AK::DeprecatedString const& ak_depreca
return QString::fromUtf8(ak_deprecated_string.characters(), ak_deprecated_string.length());
}
+QString qstring_from_ak_string(String const& ak_string)
+{
+ auto view = ak_string.bytes_as_string_view();
+ return QString::fromUtf8(view.characters_without_null_termination(), view.length());
+}
+
void platform_init()
{
#ifdef AK_OS_ANDROID