1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 23:17:45 +00:00

AK+Everywhere: Rename String to DeprecatedString

We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
This commit is contained in:
Linus Groh 2022-12-04 18:02:33 +00:00 committed by Andreas Kling
parent f74251606d
commit 6e19ab2bbc
2006 changed files with 11635 additions and 11636 deletions

View file

@ -17,7 +17,7 @@ namespace Desktop {
NonnullRefPtr<AppFile> AppFile::get_for_app(StringView app_name)
{
auto path = String::formatted("{}/{}.af", APP_FILES_DIRECTORY, app_name);
auto path = DeprecatedString::formatted("{}/{}.af", APP_FILES_DIRECTORY, app_name);
return open(path);
}
@ -35,7 +35,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 = String::formatted("{}/{}", directory, name);
auto path = DeprecatedString::formatted("{}/{}", directory, name);
auto af = AppFile::open(path);
if (!af->is_valid())
continue;
@ -58,36 +58,36 @@ bool AppFile::validate() const
return true;
}
String AppFile::name() const
DeprecatedString AppFile::name() const
{
auto name = m_config->read_entry("App", "Name").trim_whitespace();
VERIFY(!name.is_empty());
return name;
}
String AppFile::executable() const
DeprecatedString AppFile::executable() const
{
auto executable = m_config->read_entry("App", "Executable").trim_whitespace();
VERIFY(!executable.is_empty());
return executable;
}
String AppFile::description() const
DeprecatedString AppFile::description() const
{
return m_config->read_entry("App", "Description").trim_whitespace();
}
String AppFile::category() const
DeprecatedString AppFile::category() const
{
return m_config->read_entry("App", "Category").trim_whitespace();
}
String AppFile::working_directory() const
DeprecatedString AppFile::working_directory() const
{
return m_config->read_entry("App", "WorkingDirectory").trim_whitespace();
}
String AppFile::icon_path() const
DeprecatedString AppFile::icon_path() const
{
return m_config->read_entry("App", "IconPath").trim_whitespace();
}
@ -112,9 +112,9 @@ bool AppFile::requires_root() const
return m_config->read_bool_entry("App", "RequiresRoot", false);
}
Vector<String> AppFile::launcher_mime_types() const
Vector<DeprecatedString> AppFile::launcher_mime_types() const
{
Vector<String> mime_types;
Vector<DeprecatedString> mime_types;
for (auto& entry : m_config->read_entry("Launcher", "MimeTypes").split(',')) {
entry = entry.trim_whitespace();
if (!entry.is_empty())
@ -123,9 +123,9 @@ Vector<String> AppFile::launcher_mime_types() const
return mime_types;
}
Vector<String> AppFile::launcher_file_types() const
Vector<DeprecatedString> AppFile::launcher_file_types() const
{
Vector<String> file_types;
Vector<DeprecatedString> file_types;
for (auto& entry : m_config->read_entry("Launcher", "FileTypes").split(',')) {
entry = entry.trim_whitespace();
if (!entry.is_empty())
@ -134,9 +134,9 @@ Vector<String> AppFile::launcher_file_types() const
return file_types;
}
Vector<String> AppFile::launcher_protocols() const
Vector<DeprecatedString> AppFile::launcher_protocols() const
{
Vector<String> protocols;
Vector<DeprecatedString> protocols;
for (auto& entry : m_config->read_entry("Launcher", "Protocols").split(',')) {
entry = entry.trim_whitespace();
if (!entry.is_empty())
@ -150,7 +150,7 @@ bool AppFile::spawn() const
if (!is_valid())
return false;
auto pid = Core::Process::spawn(executable(), Span<String const> {}, working_directory());
auto pid = Core::Process::spawn(executable(), Span<DeprecatedString const> {}, working_directory());
if (pid.is_error())
return false;

View file

@ -23,20 +23,20 @@ public:
~AppFile() = default;
bool is_valid() const { return m_valid; }
String filename() const { return m_config->filename(); }
DeprecatedString filename() const { return m_config->filename(); }
String name() const;
String executable() const;
String category() const;
String description() const;
String working_directory() const;
String icon_path() const;
DeprecatedString name() const;
DeprecatedString executable() const;
DeprecatedString category() const;
DeprecatedString description() const;
DeprecatedString working_directory() const;
DeprecatedString icon_path() const;
GUI::Icon icon() const;
bool run_in_terminal() const;
bool requires_root() const;
Vector<String> launcher_mime_types() const;
Vector<String> launcher_file_types() const;
Vector<String> launcher_protocols() const;
Vector<DeprecatedString> launcher_mime_types() const;
Vector<DeprecatedString> launcher_file_types() const;
Vector<DeprecatedString> launcher_protocols() const;
bool spawn() const;
private:

View file

@ -14,7 +14,7 @@
namespace Desktop {
auto Launcher::Details::from_details_str(String const& details_str) -> NonnullRefPtr<Details>
auto Launcher::Details::from_details_str(DeprecatedString 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();
@ -63,7 +63,7 @@ ErrorOr<void> Launcher::add_allowed_url(URL const& url)
return {};
}
ErrorOr<void> Launcher::add_allowed_handler_with_any_url(String const& handler)
ErrorOr<void> Launcher::add_allowed_handler_with_any_url(DeprecatedString const& handler)
{
auto response_or_error = connection().try_add_allowed_handler_with_any_url(handler);
if (response_or_error.is_error())
@ -71,7 +71,7 @@ ErrorOr<void> Launcher::add_allowed_handler_with_any_url(String const& handler)
return {};
}
ErrorOr<void> Launcher::add_allowed_handler_with_only_specific_urls(String const& handler, Vector<URL> const& urls)
ErrorOr<void> Launcher::add_allowed_handler_with_only_specific_urls(DeprecatedString 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())
@ -87,7 +87,7 @@ ErrorOr<void> Launcher::seal_allowlist()
return {};
}
bool Launcher::open(const URL& url, String const& handler_name)
bool Launcher::open(const URL& url, DeprecatedString const& handler_name)
{
return connection().open_url(url, handler_name);
}
@ -98,7 +98,7 @@ bool Launcher::open(const URL& url, Details const& details)
return open(url, details.executable);
}
Vector<String> Launcher::get_handlers_for_url(const URL& url)
Vector<DeprecatedString> Launcher::get_handlers_for_url(const URL& url)
{
return connection().get_handlers_for_url(url.to_string());
}

View file

@ -6,11 +6,11 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/Forward.h>
#include <AK/HashMap.h>
#include <AK/NonnullRefPtrVector.h>
#include <AK/RefCounted.h>
#include <AK/String.h>
namespace Desktop {
@ -24,21 +24,21 @@ public:
};
struct Details : public RefCounted<Details> {
String name;
String executable;
DeprecatedString name;
DeprecatedString executable;
LauncherType launcher_type { LauncherType::Default };
static NonnullRefPtr<Details> from_details_str(String const&);
static NonnullRefPtr<Details> from_details_str(DeprecatedString const&);
};
static void ensure_connection();
static ErrorOr<void> add_allowed_url(URL const&);
static ErrorOr<void> add_allowed_handler_with_any_url(String const& handler);
static ErrorOr<void> add_allowed_handler_with_only_specific_urls(String const& handler, Vector<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> seal_allowlist();
static bool open(const URL&, String const& handler_name = {});
static bool open(const URL&, DeprecatedString const& handler_name = {});
static bool open(const URL&, Details const& details);
static Vector<String> get_handlers_for_url(const URL&);
static Vector<DeprecatedString> get_handlers_for_url(const URL&);
static NonnullRefPtrVector<Details> get_handlers_with_details_for_url(const URL&);
};