1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:07:35 +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

@ -39,14 +39,14 @@ class FileDB : public CodeComprehension::FileDB {
public:
FileDB() = default;
void add(String filename, String content)
void add(DeprecatedString filename, DeprecatedString content)
{
m_map.set(filename, content);
}
virtual Optional<String> get_or_read_from_filesystem(StringView filename) const override
virtual Optional<DeprecatedString> get_or_read_from_filesystem(StringView filename) const override
{
String target_filename = filename;
DeprecatedString target_filename = filename;
if (!project_root().is_null() && filename.starts_with(project_root())) {
target_filename = LexicalPath::relative_path(filename, project_root());
}
@ -54,7 +54,7 @@ public:
}
private:
HashMap<String, String> m_map;
HashMap<DeprecatedString, DeprecatedString> m_map;
};
static void test_complete_local_args();
@ -75,11 +75,11 @@ int run_tests()
return s_some_test_failed ? 1 : 0;
}
static void add_file(FileDB& filedb, String const& name)
static void add_file(FileDB& filedb, DeprecatedString const& name)
{
auto file = Core::File::open(LexicalPath::join(TESTS_ROOT_DIR, name).string(), Core::OpenMode::ReadOnly);
VERIFY(!file.is_error());
filedb.add(name, String::copy(file.value()->read_all()));
filedb.add(name, DeprecatedString::copy(file.value()->read_all()));
}
void test_complete_local_args()
@ -182,19 +182,19 @@ void test_parameters_hint()
auto result = engine.get_function_params_hint("parameters_hint1.cpp", { 4, 9 });
if (!result.has_value())
FAIL("failed to get parameters hint (1)");
if (result->params != Vector<String> { "int x", "char y" } || result->current_index != 0)
if (result->params != Vector<DeprecatedString> { "int x", "char y" } || result->current_index != 0)
FAIL("bad result (1)");
result = engine.get_function_params_hint("parameters_hint1.cpp", { 5, 15 });
if (!result.has_value())
FAIL("failed to get parameters hint (2)");
if (result->params != Vector<String> { "int x", "char y" } || result->current_index != 1)
if (result->params != Vector<DeprecatedString> { "int x", "char y" } || result->current_index != 1)
FAIL("bad result (2)");
result = engine.get_function_params_hint("parameters_hint1.cpp", { 6, 8 });
if (!result.has_value())
FAIL("failed to get parameters hint (3)");
if (result->params != Vector<String> { "int x", "char y" } || result->current_index != 0)
if (result->params != Vector<DeprecatedString> { "int x", "char y" } || result->current_index != 0)
FAIL("bad result (3)");
PASS;