mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 05:07:35 +00:00
Everywhere: Rename {Deprecated => Byte}String
This commit un-deprecates DeprecatedString, and repurposes it as a byte string. As the null state has already been removed, there are no other particularly hairy blockers in repurposing this type as a byte string (what it _really_ is). This commit is auto-generated: $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \ Meta Ports Ladybird Tests Kernel) $ perl -pie 's/\bDeprecatedString\b/ByteString/g; s/deprecated_string/byte_string/g' $xs $ clang-format --style=file -i \ $(git diff --name-only | grep \.cpp\|\.h) $ gn format $(git ls-files '*.gn' '*.gni')
This commit is contained in:
parent
38d62563b3
commit
5e1499d104
1615 changed files with 10257 additions and 10257 deletions
|
@ -16,9 +16,9 @@
|
|||
|
||||
namespace Desktop {
|
||||
|
||||
DeprecatedString AppFile::app_file_path_for_app(StringView app_name)
|
||||
ByteString AppFile::app_file_path_for_app(StringView app_name)
|
||||
{
|
||||
return DeprecatedString::formatted("{}/{}.af", APP_FILES_DIRECTORY, app_name);
|
||||
return ByteString::formatted("{}/{}.af", APP_FILES_DIRECTORY, app_name);
|
||||
}
|
||||
|
||||
bool AppFile::exists_for_app(StringView app_name)
|
||||
|
@ -45,7 +45,7 @@ void AppFile::for_each(Function<void(NonnullRefPtr<AppFile>)> callback, StringVi
|
|||
auto name = di.next_path();
|
||||
if (!name.ends_with(".af"sv))
|
||||
continue;
|
||||
auto path = DeprecatedString::formatted("{}/{}", directory, name);
|
||||
auto path = ByteString::formatted("{}/{}", directory, name);
|
||||
auto af = AppFile::open(path);
|
||||
if (!af->is_valid())
|
||||
continue;
|
||||
|
@ -68,36 +68,36 @@ bool AppFile::validate() const
|
|||
return true;
|
||||
}
|
||||
|
||||
DeprecatedString AppFile::name() const
|
||||
ByteString AppFile::name() const
|
||||
{
|
||||
auto name = m_config->read_entry("App", "Name").trim_whitespace();
|
||||
VERIFY(!name.is_empty());
|
||||
return name;
|
||||
}
|
||||
|
||||
DeprecatedString AppFile::executable() const
|
||||
ByteString AppFile::executable() const
|
||||
{
|
||||
auto executable = m_config->read_entry("App", "Executable").trim_whitespace();
|
||||
VERIFY(!executable.is_empty());
|
||||
return executable;
|
||||
}
|
||||
|
||||
DeprecatedString AppFile::description() const
|
||||
ByteString AppFile::description() const
|
||||
{
|
||||
return m_config->read_entry("App", "Description").trim_whitespace();
|
||||
}
|
||||
|
||||
DeprecatedString AppFile::category() const
|
||||
ByteString AppFile::category() const
|
||||
{
|
||||
return m_config->read_entry("App", "Category").trim_whitespace();
|
||||
}
|
||||
|
||||
DeprecatedString AppFile::working_directory() const
|
||||
ByteString AppFile::working_directory() const
|
||||
{
|
||||
return m_config->read_entry("App", "WorkingDirectory").trim_whitespace();
|
||||
}
|
||||
|
||||
DeprecatedString AppFile::icon_path() const
|
||||
ByteString AppFile::icon_path() const
|
||||
{
|
||||
return m_config->read_entry("App", "IconPath").trim_whitespace();
|
||||
}
|
||||
|
@ -127,9 +127,9 @@ bool AppFile::exclude_from_system_menu() const
|
|||
return m_config->read_bool_entry("App", "ExcludeFromSystemMenu", false);
|
||||
}
|
||||
|
||||
Vector<DeprecatedString> AppFile::launcher_mime_types() const
|
||||
Vector<ByteString> AppFile::launcher_mime_types() const
|
||||
{
|
||||
Vector<DeprecatedString> mime_types;
|
||||
Vector<ByteString> mime_types;
|
||||
for (auto& entry : m_config->read_entry("Launcher", "MimeTypes").split(',')) {
|
||||
entry = entry.trim_whitespace();
|
||||
if (!entry.is_empty())
|
||||
|
@ -138,9 +138,9 @@ Vector<DeprecatedString> AppFile::launcher_mime_types() const
|
|||
return mime_types;
|
||||
}
|
||||
|
||||
Vector<DeprecatedString> AppFile::launcher_file_types() const
|
||||
Vector<ByteString> AppFile::launcher_file_types() const
|
||||
{
|
||||
Vector<DeprecatedString> file_types;
|
||||
Vector<ByteString> file_types;
|
||||
for (auto& entry : m_config->read_entry("Launcher", "FileTypes").split(',')) {
|
||||
entry = entry.trim_whitespace();
|
||||
if (!entry.is_empty())
|
||||
|
@ -149,9 +149,9 @@ Vector<DeprecatedString> AppFile::launcher_file_types() const
|
|||
return file_types;
|
||||
}
|
||||
|
||||
Vector<DeprecatedString> AppFile::launcher_protocols() const
|
||||
Vector<ByteString> AppFile::launcher_protocols() const
|
||||
{
|
||||
Vector<DeprecatedString> protocols;
|
||||
Vector<ByteString> protocols;
|
||||
for (auto& entry : m_config->read_entry("Launcher", "Protocols").split(',')) {
|
||||
entry = entry.trim_whitespace();
|
||||
if (!entry.is_empty())
|
||||
|
|
|
@ -18,8 +18,8 @@ public:
|
|||
static constexpr auto APP_FILES_DIRECTORY = "/res/apps"sv;
|
||||
|
||||
static bool exists_for_app(StringView app_name);
|
||||
static DeprecatedString file_for_app(StringView app_name);
|
||||
static DeprecatedString app_file_path_for_app(StringView app_name);
|
||||
static ByteString file_for_app(StringView app_name);
|
||||
static ByteString app_file_path_for_app(StringView app_name);
|
||||
|
||||
static NonnullRefPtr<AppFile> get_for_app(StringView app_name);
|
||||
static NonnullRefPtr<AppFile> open(StringView path);
|
||||
|
@ -27,21 +27,21 @@ public:
|
|||
~AppFile() = default;
|
||||
|
||||
bool is_valid() const { return m_valid; }
|
||||
DeprecatedString filename() const { return m_config->filename(); }
|
||||
ByteString filename() const { return m_config->filename(); }
|
||||
|
||||
DeprecatedString name() const;
|
||||
DeprecatedString executable() const;
|
||||
DeprecatedString category() const;
|
||||
DeprecatedString description() const;
|
||||
DeprecatedString working_directory() const;
|
||||
DeprecatedString icon_path() const;
|
||||
ByteString name() const;
|
||||
ByteString executable() const;
|
||||
ByteString category() const;
|
||||
ByteString description() const;
|
||||
ByteString working_directory() const;
|
||||
ByteString icon_path() const;
|
||||
GUI::Icon icon() const;
|
||||
bool run_in_terminal() const;
|
||||
bool requires_root() const;
|
||||
bool exclude_from_system_menu() const;
|
||||
Vector<DeprecatedString> launcher_mime_types() const;
|
||||
Vector<DeprecatedString> launcher_file_types() const;
|
||||
Vector<DeprecatedString> launcher_protocols() const;
|
||||
Vector<ByteString> launcher_mime_types() const;
|
||||
Vector<ByteString> launcher_file_types() const;
|
||||
Vector<ByteString> launcher_protocols() const;
|
||||
bool spawn(ReadonlySpan<StringView> arguments = {}) const;
|
||||
|
||||
private:
|
||||
|
|
|
@ -13,14 +13,14 @@
|
|||
|
||||
namespace Desktop {
|
||||
|
||||
auto Launcher::Details::from_details_str(DeprecatedString const& details_str) -> NonnullRefPtr<Details>
|
||||
auto Launcher::Details::from_details_str(ByteString const& details_str) -> NonnullRefPtr<Details>
|
||||
{
|
||||
auto details = adopt_ref(*new Details);
|
||||
auto json = JsonValue::from_string(details_str).release_value_but_fixme_should_propagate_errors();
|
||||
auto const& obj = json.as_object();
|
||||
details->executable = obj.get_deprecated_string("executable"sv).value_or({});
|
||||
details->name = obj.get_deprecated_string("name"sv).value_or({});
|
||||
if (auto type_value = obj.get_deprecated_string("type"sv); type_value.has_value()) {
|
||||
details->executable = obj.get_byte_string("executable"sv).value_or({});
|
||||
details->name = obj.get_byte_string("name"sv).value_or({});
|
||||
if (auto type_value = obj.get_byte_string("type"sv); type_value.has_value()) {
|
||||
auto const& type_str = type_value.value();
|
||||
if (type_str == "app")
|
||||
details->launcher_type = LauncherType::Application;
|
||||
|
@ -62,7 +62,7 @@ ErrorOr<void> Launcher::add_allowed_url(URL const& url)
|
|||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<void> Launcher::add_allowed_handler_with_any_url(DeprecatedString const& handler)
|
||||
ErrorOr<void> Launcher::add_allowed_handler_with_any_url(ByteString const& handler)
|
||||
{
|
||||
auto response_or_error = connection().try_add_allowed_handler_with_any_url(handler);
|
||||
if (response_or_error.is_error())
|
||||
|
@ -70,7 +70,7 @@ ErrorOr<void> Launcher::add_allowed_handler_with_any_url(DeprecatedString const&
|
|||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<void> Launcher::add_allowed_handler_with_only_specific_urls(DeprecatedString const& handler, Vector<URL> const& urls)
|
||||
ErrorOr<void> Launcher::add_allowed_handler_with_only_specific_urls(ByteString const& handler, Vector<URL> const& urls)
|
||||
{
|
||||
auto response_or_error = connection().try_add_allowed_handler_with_only_specific_urls(handler, urls);
|
||||
if (response_or_error.is_error())
|
||||
|
@ -86,7 +86,7 @@ ErrorOr<void> Launcher::seal_allowlist()
|
|||
return {};
|
||||
}
|
||||
|
||||
bool Launcher::open(const URL& url, DeprecatedString const& handler_name)
|
||||
bool Launcher::open(const URL& url, ByteString const& handler_name)
|
||||
{
|
||||
return connection().open_url(url, handler_name);
|
||||
}
|
||||
|
@ -97,14 +97,14 @@ bool Launcher::open(const URL& url, Details const& details)
|
|||
return open(url, details.executable);
|
||||
}
|
||||
|
||||
Vector<DeprecatedString> Launcher::get_handlers_for_url(const URL& url)
|
||||
Vector<ByteString> Launcher::get_handlers_for_url(const URL& url)
|
||||
{
|
||||
return connection().get_handlers_for_url(url.to_deprecated_string());
|
||||
return connection().get_handlers_for_url(url.to_byte_string());
|
||||
}
|
||||
|
||||
auto Launcher::get_handlers_with_details_for_url(const URL& url) -> Vector<NonnullRefPtr<Details>>
|
||||
{
|
||||
auto details = connection().get_handlers_with_details_for_url(url.to_deprecated_string());
|
||||
auto details = connection().get_handlers_with_details_for_url(url.to_byte_string());
|
||||
Vector<NonnullRefPtr<Details>> handlers_with_details;
|
||||
for (auto& value : details) {
|
||||
handlers_with_details.append(Details::from_details_str(value));
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/Forward.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/RefCounted.h>
|
||||
|
@ -23,21 +23,21 @@ public:
|
|||
};
|
||||
|
||||
struct Details : public RefCounted<Details> {
|
||||
DeprecatedString name;
|
||||
DeprecatedString executable;
|
||||
ByteString name;
|
||||
ByteString executable;
|
||||
LauncherType launcher_type { LauncherType::Default };
|
||||
|
||||
static NonnullRefPtr<Details> from_details_str(DeprecatedString const&);
|
||||
static NonnullRefPtr<Details> from_details_str(ByteString const&);
|
||||
};
|
||||
|
||||
static void ensure_connection();
|
||||
static ErrorOr<void> add_allowed_url(URL const&);
|
||||
static ErrorOr<void> add_allowed_handler_with_any_url(DeprecatedString const& handler);
|
||||
static ErrorOr<void> add_allowed_handler_with_only_specific_urls(DeprecatedString const& handler, Vector<URL> const&);
|
||||
static ErrorOr<void> add_allowed_handler_with_any_url(ByteString const& handler);
|
||||
static ErrorOr<void> add_allowed_handler_with_only_specific_urls(ByteString const& handler, Vector<URL> const&);
|
||||
static ErrorOr<void> seal_allowlist();
|
||||
static bool open(const URL&, DeprecatedString const& handler_name = {});
|
||||
static bool open(const URL&, ByteString const& handler_name = {});
|
||||
static bool open(const URL&, Details const& details);
|
||||
static Vector<DeprecatedString> get_handlers_for_url(const URL&);
|
||||
static Vector<ByteString> get_handlers_for_url(const URL&);
|
||||
static Vector<NonnullRefPtr<Details>> get_handlers_with_details_for_url(const URL&);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue