mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +00:00
Everywhere: Rename to_{string => deprecated_string}() where applicable
This will make it easier to support both string types at the same time while we convert code, and tracking down remaining uses. One big exception is Value::to_string() in LibJS, where the name is dictated by the ToString AO.
This commit is contained in:
parent
6e19ab2bbc
commit
57dc179b1f
Notes:
sideshowbarker
2024-07-17 03:43:09 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/57dc179b1f Pull-request: https://github.com/SerenityOS/serenity/pull/16311 Reviewed-by: https://github.com/BertalanD Reviewed-by: https://github.com/MacDue
597 changed files with 1973 additions and 1972 deletions
|
@ -137,7 +137,7 @@ DeprecatedString encode_base64(ReadonlyBytes input)
|
||||||
output.append(out3);
|
output.append(out3);
|
||||||
}
|
}
|
||||||
|
|
||||||
return output.to_string();
|
return output.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace AK {
|
||||||
inline DeprecatedString demangle(StringView name)
|
inline DeprecatedString demangle(StringView name)
|
||||||
{
|
{
|
||||||
int status = 0;
|
int status = 0;
|
||||||
auto* demangled_name = abi::__cxa_demangle(name.to_string().characters(), nullptr, nullptr, &status);
|
auto* demangled_name = abi::__cxa_demangle(name.to_deprecated_string().characters(), nullptr, nullptr, &status);
|
||||||
auto string = DeprecatedString(status == 0 ? StringView { demangled_name, strlen(demangled_name) } : name);
|
auto string = DeprecatedString(status == 0 ? StringView { demangled_name, strlen(demangled_name) } : name);
|
||||||
if (status == 0)
|
if (status == 0)
|
||||||
free(demangled_name);
|
free(demangled_name);
|
||||||
|
|
|
@ -320,7 +320,7 @@ DeprecatedString DeprecatedString::roman_number_from(size_t value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DeprecatedString::matches(StringView mask, Vector<MaskSpan>& mask_spans, CaseSensitivity case_sensitivity) const
|
bool DeprecatedString::matches(StringView mask, Vector<MaskSpan>& mask_spans, CaseSensitivity case_sensitivity) const
|
||||||
|
@ -354,7 +354,7 @@ DeprecatedString DeprecatedString::reverse() const
|
||||||
for (size_t i = length(); i-- > 0;) {
|
for (size_t i = length(); i-- > 0;) {
|
||||||
reversed_string.append(characters()[i]);
|
reversed_string.append(characters()[i]);
|
||||||
}
|
}
|
||||||
return reversed_string.to_string();
|
return reversed_string.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
DeprecatedString escape_html_entities(StringView html)
|
DeprecatedString escape_html_entities(StringView html)
|
||||||
|
@ -372,7 +372,7 @@ DeprecatedString escape_html_entities(StringView html)
|
||||||
else
|
else
|
||||||
builder.append(html[i]);
|
builder.append(html[i]);
|
||||||
}
|
}
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
DeprecatedString::DeprecatedString(FlyString const& string)
|
DeprecatedString::DeprecatedString(FlyString const& string)
|
||||||
|
@ -431,7 +431,7 @@ InputStream& operator>>(InputStream& stream, DeprecatedString& string)
|
||||||
if (next_char) {
|
if (next_char) {
|
||||||
builder.append(next_char);
|
builder.append(next_char);
|
||||||
} else {
|
} else {
|
||||||
string = builder.to_string();
|
string = builder.to_deprecated_string();
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -441,7 +441,7 @@ DeprecatedString DeprecatedString::vformatted(StringView fmtstr, TypeErasedForma
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
MUST(vformat(builder, fmtstr, params));
|
MUST(vformat(builder, fmtstr, params));
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<size_t> DeprecatedString::find_all(StringView needle) const
|
Vector<size_t> DeprecatedString::find_all(StringView needle) const
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace AK {
|
||||||
// StringBuilder builder;
|
// StringBuilder builder;
|
||||||
// builder.append("abc");
|
// builder.append("abc");
|
||||||
// builder.append("123");
|
// builder.append("123");
|
||||||
// s = builder.to_string();
|
// s = builder.to_deprecated_string();
|
||||||
|
|
||||||
class DeprecatedString {
|
class DeprecatedString {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -63,7 +63,7 @@ FlyString::FlyString(StringView string)
|
||||||
return string == candidate;
|
return string == candidate;
|
||||||
});
|
});
|
||||||
if (it == fly_impls().end()) {
|
if (it == fly_impls().end()) {
|
||||||
auto new_string = string.to_string();
|
auto new_string = string.to_deprecated_string();
|
||||||
fly_impls().set(new_string.impl());
|
fly_impls().set(new_string.impl());
|
||||||
new_string.impl()->set_fly({}, true);
|
new_string.impl()->set_fly({}, true);
|
||||||
m_impl = new_string.impl();
|
m_impl = new_string.impl();
|
||||||
|
|
|
@ -138,7 +138,7 @@ DeprecatedString GenericLexer::consume_and_unescape_string(char escape_char)
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
for (size_t i = 0; i < view.length(); ++i)
|
for (size_t i = 0; i < view.length(); ++i)
|
||||||
builder.append(consume_escaped_character(escape_char));
|
builder.append(consume_escaped_character(escape_char));
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto GenericLexer::consume_escaped_code_point(bool combine_surrogate_pairs) -> Result<u32, UnicodeEscapeError>
|
auto GenericLexer::consume_escaped_code_point(bool combine_surrogate_pairs) -> Result<u32, UnicodeEscapeError>
|
||||||
|
|
|
@ -65,7 +65,7 @@ public:
|
||||||
octet(SubnetClass::D));
|
octet(SubnetClass::D));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
DeprecatedString to_string() const
|
DeprecatedString to_deprecated_string() const
|
||||||
{
|
{
|
||||||
return DeprecatedString::formatted("{}.{}.{}.{}",
|
return DeprecatedString::formatted("{}.{}.{}.{}",
|
||||||
octet(SubnetClass::A),
|
octet(SubnetClass::A),
|
||||||
|
@ -74,7 +74,7 @@ public:
|
||||||
octet(SubnetClass::D));
|
octet(SubnetClass::D));
|
||||||
}
|
}
|
||||||
|
|
||||||
DeprecatedString to_string_reversed() const
|
DeprecatedString to_deprecated_string_reversed() const
|
||||||
{
|
{
|
||||||
return DeprecatedString::formatted("{}.{}.{}.{}",
|
return DeprecatedString::formatted("{}.{}.{}.{}",
|
||||||
octet(SubnetClass::D),
|
octet(SubnetClass::D),
|
||||||
|
@ -169,7 +169,7 @@ template<>
|
||||||
struct Formatter<IPv4Address> : Formatter<DeprecatedString> {
|
struct Formatter<IPv4Address> : Formatter<DeprecatedString> {
|
||||||
ErrorOr<void> format(FormatBuilder& builder, IPv4Address value)
|
ErrorOr<void> format(FormatBuilder& builder, IPv4Address value)
|
||||||
{
|
{
|
||||||
return Formatter<DeprecatedString>::format(builder, value.to_string());
|
return Formatter<DeprecatedString>::format(builder, value.to_deprecated_string());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -51,7 +51,7 @@ public:
|
||||||
#ifdef KERNEL
|
#ifdef KERNEL
|
||||||
ErrorOr<NonnullOwnPtr<Kernel::KString>> to_string() const
|
ErrorOr<NonnullOwnPtr<Kernel::KString>> to_string() const
|
||||||
#else
|
#else
|
||||||
DeprecatedString to_string() const
|
DeprecatedString to_deprecated_string() const
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (is_zero()) {
|
if (is_zero()) {
|
||||||
|
@ -292,7 +292,7 @@ template<>
|
||||||
struct Formatter<IPv6Address> : Formatter<DeprecatedString> {
|
struct Formatter<IPv6Address> : Formatter<DeprecatedString> {
|
||||||
ErrorOr<void> format(FormatBuilder& builder, IPv6Address const& value)
|
ErrorOr<void> format(FormatBuilder& builder, IPv6Address const& value)
|
||||||
{
|
{
|
||||||
return Formatter<DeprecatedString>::format(builder, value.to_string());
|
return Formatter<DeprecatedString>::format(builder, value.to_deprecated_string());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -71,7 +71,7 @@ public:
|
||||||
template<typename Builder>
|
template<typename Builder>
|
||||||
void serialize(Builder&) const;
|
void serialize(Builder&) const;
|
||||||
|
|
||||||
[[nodiscard]] DeprecatedString to_string() const { return serialized<StringBuilder>(); }
|
[[nodiscard]] DeprecatedString to_deprecated_string() const { return serialized<StringBuilder>(); }
|
||||||
|
|
||||||
template<typename Callback>
|
template<typename Callback>
|
||||||
void for_each(Callback callback) const
|
void for_each(Callback callback) const
|
||||||
|
|
|
@ -166,7 +166,7 @@ public:
|
||||||
template<typename Builder>
|
template<typename Builder>
|
||||||
void serialize(Builder&) const;
|
void serialize(Builder&) const;
|
||||||
|
|
||||||
[[nodiscard]] DeprecatedString to_string() const { return serialized<StringBuilder>(); }
|
[[nodiscard]] DeprecatedString to_deprecated_string() const { return serialized<StringBuilder>(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
OrderedHashMap<DeprecatedString, JsonValue> m_members;
|
OrderedHashMap<DeprecatedString, JsonValue> m_members;
|
||||||
|
|
|
@ -118,7 +118,7 @@ ErrorOr<DeprecatedString> JsonParser::consume_and_unescape_string()
|
||||||
if (!consume_specific('"'))
|
if (!consume_specific('"'))
|
||||||
return Error::from_string_literal("JsonParser: Expected '\"'");
|
return Error::from_string_literal("JsonParser: Expected '\"'");
|
||||||
|
|
||||||
return final_sb.to_string();
|
return final_sb.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<JsonValue> JsonParser::parse_object()
|
ErrorOr<JsonValue> JsonParser::parse_object()
|
||||||
|
|
|
@ -31,16 +31,16 @@ JsonValue JsonPath::resolve(JsonValue const& top_root) const
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeprecatedString JsonPath::to_string() const
|
DeprecatedString JsonPath::to_deprecated_string() const
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
builder.append("{ ."sv);
|
builder.append("{ ."sv);
|
||||||
for (auto const& el : *this) {
|
for (auto const& el : *this) {
|
||||||
builder.append("sv > "sv);
|
builder.append("sv > "sv);
|
||||||
builder.append(el.to_string());
|
builder.append(el.to_deprecated_string());
|
||||||
}
|
}
|
||||||
builder.append("sv }"sv);
|
builder.append("sv }"sv);
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ public:
|
||||||
return m_index;
|
return m_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeprecatedString to_string() const
|
DeprecatedString to_deprecated_string() const
|
||||||
{
|
{
|
||||||
switch (m_kind) {
|
switch (m_kind) {
|
||||||
case Kind::Key:
|
case Kind::Key:
|
||||||
|
@ -90,7 +90,7 @@ private:
|
||||||
class JsonPath : public Vector<JsonPathElement> {
|
class JsonPath : public Vector<JsonPathElement> {
|
||||||
public:
|
public:
|
||||||
JsonValue resolve(JsonValue const&) const;
|
JsonValue resolve(JsonValue const&) const;
|
||||||
DeprecatedString to_string() const;
|
DeprecatedString to_deprecated_string() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,7 +186,7 @@ JsonValue::JsonValue(DeprecatedString const& value)
|
||||||
}
|
}
|
||||||
|
|
||||||
JsonValue::JsonValue(StringView value)
|
JsonValue::JsonValue(StringView value)
|
||||||
: JsonValue(value.to_string())
|
: JsonValue(value.to_deprecated_string())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ public:
|
||||||
return alternative;
|
return alternative;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeprecatedString to_string() const
|
DeprecatedString to_deprecated_string() const
|
||||||
{
|
{
|
||||||
if (is_string())
|
if (is_string())
|
||||||
return as_string();
|
return as_string();
|
||||||
|
@ -283,7 +283,7 @@ template<>
|
||||||
struct Formatter<JsonValue> : Formatter<StringView> {
|
struct Formatter<JsonValue> : Formatter<StringView> {
|
||||||
ErrorOr<void> format(FormatBuilder& builder, JsonValue const& value)
|
ErrorOr<void> format(FormatBuilder& builder, JsonValue const& value)
|
||||||
{
|
{
|
||||||
return Formatter<StringView>::format(builder, value.to_string());
|
return Formatter<StringView>::format(builder, value.to_deprecated_string());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -118,7 +118,7 @@ DeprecatedString LexicalPath::canonicalized_path(DeprecatedString path)
|
||||||
if (is_absolute)
|
if (is_absolute)
|
||||||
builder.append('/');
|
builder.append('/');
|
||||||
builder.join('/', canonical_parts);
|
builder.join('/', canonical_parts);
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
DeprecatedString LexicalPath::absolute_path(DeprecatedString dir_path, DeprecatedString target)
|
DeprecatedString LexicalPath::absolute_path(DeprecatedString dir_path, DeprecatedString target)
|
||||||
|
|
|
@ -49,7 +49,7 @@ public:
|
||||||
builder.append(first);
|
builder.append(first);
|
||||||
((builder.append('/'), builder.append(forward<S>(rest))), ...);
|
((builder.append('/'), builder.append(forward<S>(rest))), ...);
|
||||||
|
|
||||||
return LexicalPath { builder.to_string() };
|
return LexicalPath { builder.to_deprecated_string() };
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] static DeprecatedString dirname(DeprecatedString path)
|
[[nodiscard]] static DeprecatedString dirname(DeprecatedString path)
|
||||||
|
|
|
@ -64,7 +64,7 @@ public:
|
||||||
return Kernel::KString::formatted("{:02x}:{:02x}:{:02x}:{:02x}:{:02x}:{:02x}", m_data[0], m_data[1], m_data[2], m_data[3], m_data[4], m_data[5]);
|
return Kernel::KString::formatted("{:02x}:{:02x}:{:02x}:{:02x}:{:02x}:{:02x}", m_data[0], m_data[1], m_data[2], m_data[3], m_data[4], m_data[5]);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
DeprecatedString to_string() const
|
DeprecatedString to_deprecated_string() const
|
||||||
{
|
{
|
||||||
return DeprecatedString::formatted("{:02x}:{:02x}:{:02x}:{:02x}:{:02x}:{:02x}", m_data[0], m_data[1], m_data[2], m_data[3], m_data[4], m_data[5]);
|
return DeprecatedString::formatted("{:02x}:{:02x}:{:02x}:{:02x}:{:02x}:{:02x}", m_data[0], m_data[1], m_data[2], m_data[3], m_data[4], m_data[5]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ static inline DeprecatedString human_readable_time(i64 time_in_seconds)
|
||||||
|
|
||||||
builder.appendff("{} second{}", time_in_seconds, time_in_seconds == 1 ? "" : "s");
|
builder.appendff("{} second{}", time_in_seconds, time_in_seconds == 1 ? "" : "s");
|
||||||
|
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline DeprecatedString human_readable_digital_time(i64 time_in_seconds)
|
static inline DeprecatedString human_readable_digital_time(i64 time_in_seconds)
|
||||||
|
@ -78,7 +78,7 @@ static inline DeprecatedString human_readable_digital_time(i64 time_in_seconds)
|
||||||
builder.appendff("{:02}:", minutes);
|
builder.appendff("{:02}:", minutes);
|
||||||
builder.appendff("{:02}", time_in_seconds);
|
builder.appendff("{:02}", time_in_seconds);
|
||||||
|
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,9 +24,9 @@ public:
|
||||||
for (auto indent = m_depth++; indent > 0; indent--)
|
for (auto indent = m_depth++; indent > 0; indent--)
|
||||||
sb.append(' ');
|
sb.append(' ');
|
||||||
if (m_extra.is_empty())
|
if (m_extra.is_empty())
|
||||||
dbgln("\033[1;{}m{}entering {}\033[0m", m_depth % 8 + 30, sb.to_string(), m_location);
|
dbgln("\033[1;{}m{}entering {}\033[0m", m_depth % 8 + 30, sb.to_deprecated_string(), m_location);
|
||||||
else
|
else
|
||||||
dbgln("\033[1;{}m{}entering {}\033[0m ({})", m_depth % 8 + 30, sb.to_string(), m_location, m_extra);
|
dbgln("\033[1;{}m{}entering {}\033[0m ({})", m_depth % 8 + 30, sb.to_deprecated_string(), m_location, m_extra);
|
||||||
}
|
}
|
||||||
|
|
||||||
ScopeLogger(SourceLocation location = SourceLocation::current())
|
ScopeLogger(SourceLocation location = SourceLocation::current())
|
||||||
|
@ -42,9 +42,9 @@ public:
|
||||||
for (auto indent = --m_depth; indent > 0; indent--)
|
for (auto indent = --m_depth; indent > 0; indent--)
|
||||||
sb.append(' ');
|
sb.append(' ');
|
||||||
if (m_extra.is_empty())
|
if (m_extra.is_empty())
|
||||||
dbgln("\033[1;{}m{}leaving {}\033[0m", depth % 8 + 30, sb.to_string(), m_location);
|
dbgln("\033[1;{}m{}leaving {}\033[0m", depth % 8 + 30, sb.to_deprecated_string(), m_location);
|
||||||
else
|
else
|
||||||
dbgln("\033[1;{}m{}leaving {}\033[0m ({})", depth % 8 + 30, sb.to_string(), m_location, m_extra);
|
dbgln("\033[1;{}m{}leaving {}\033[0m ({})", depth % 8 + 30, sb.to_deprecated_string(), m_location, m_extra);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -104,7 +104,7 @@ ByteBuffer StringBuilder::to_byte_buffer() const
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef KERNEL
|
#ifndef KERNEL
|
||||||
DeprecatedString StringBuilder::to_string() const
|
DeprecatedString StringBuilder::to_deprecated_string() const
|
||||||
{
|
{
|
||||||
if (is_empty())
|
if (is_empty())
|
||||||
return DeprecatedString::empty();
|
return DeprecatedString::empty();
|
||||||
|
@ -113,7 +113,7 @@ DeprecatedString StringBuilder::to_string() const
|
||||||
|
|
||||||
DeprecatedString StringBuilder::build() const
|
DeprecatedString StringBuilder::build() const
|
||||||
{
|
{
|
||||||
return to_string();
|
return to_deprecated_string();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ public:
|
||||||
|
|
||||||
#ifndef KERNEL
|
#ifndef KERNEL
|
||||||
[[nodiscard]] DeprecatedString build() const;
|
[[nodiscard]] DeprecatedString build() const;
|
||||||
[[nodiscard]] DeprecatedString to_string() const;
|
[[nodiscard]] DeprecatedString to_deprecated_string() const;
|
||||||
#endif
|
#endif
|
||||||
[[nodiscard]] ByteBuffer to_byte_buffer() const;
|
[[nodiscard]] ByteBuffer to_byte_buffer() const;
|
||||||
|
|
||||||
|
|
|
@ -473,7 +473,7 @@ DeprecatedString to_snakecase(StringView str)
|
||||||
builder.append('_');
|
builder.append('_');
|
||||||
builder.append_as_lowercase(ch);
|
builder.append_as_lowercase(ch);
|
||||||
}
|
}
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
DeprecatedString to_titlecase(StringView str)
|
DeprecatedString to_titlecase(StringView str)
|
||||||
|
@ -489,7 +489,7 @@ DeprecatedString to_titlecase(StringView str)
|
||||||
next_is_upper = ch == ' ';
|
next_is_upper = ch == ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
DeprecatedString invert_case(StringView str)
|
DeprecatedString invert_case(StringView str)
|
||||||
|
@ -503,7 +503,7 @@ DeprecatedString invert_case(StringView str)
|
||||||
builder.append(to_ascii_lowercase(ch));
|
builder.append(to_ascii_lowercase(ch));
|
||||||
}
|
}
|
||||||
|
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
DeprecatedString replace(StringView str, StringView needle, StringView replacement, ReplaceMode replace_mode)
|
DeprecatedString replace(StringView str, StringView needle, StringView replacement, ReplaceMode replace_mode)
|
||||||
|
|
|
@ -251,7 +251,7 @@ bool StringView::operator==(DeprecatedString const& string) const
|
||||||
return *this == string.view();
|
return *this == string.view();
|
||||||
}
|
}
|
||||||
|
|
||||||
DeprecatedString StringView::to_string() const { return DeprecatedString { *this }; }
|
DeprecatedString StringView::to_deprecated_string() const { return DeprecatedString { *this }; }
|
||||||
|
|
||||||
DeprecatedString StringView::replace(StringView needle, StringView replacement, ReplaceMode replace_mode) const
|
DeprecatedString StringView::replace(StringView needle, StringView replacement, ReplaceMode replace_mode) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -288,7 +288,7 @@ public:
|
||||||
constexpr bool operator>=(StringView other) const { return compare(other) >= 0; }
|
constexpr bool operator>=(StringView other) const { return compare(other) >= 0; }
|
||||||
|
|
||||||
#ifndef KERNEL
|
#ifndef KERNEL
|
||||||
[[nodiscard]] DeprecatedString to_string() const;
|
[[nodiscard]] DeprecatedString to_deprecated_string() const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
[[nodiscard]] bool is_whitespace() const
|
[[nodiscard]] bool is_whitespace() const
|
||||||
|
|
12
AK/URL.cpp
12
AK/URL.cpp
|
@ -36,7 +36,7 @@ DeprecatedString URL::path() const
|
||||||
builder.append('/');
|
builder.append('/');
|
||||||
builder.append(path);
|
builder.append(path);
|
||||||
}
|
}
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
URL URL::complete_url(DeprecatedString const& string) const
|
URL URL::complete_url(DeprecatedString const& string) const
|
||||||
|
@ -226,7 +226,7 @@ DeprecatedString URL::serialize_data_url() const
|
||||||
// NOTE: The specification does not say anything about encoding this, but we should encode at least control and non-ASCII
|
// NOTE: The specification does not say anything about encoding this, but we should encode at least control and non-ASCII
|
||||||
// characters (since this is also a valid representation of the same data URL).
|
// characters (since this is also a valid representation of the same data URL).
|
||||||
builder.append(URL::percent_encode(m_data_payload, PercentEncodeSet::C0Control));
|
builder.append(URL::percent_encode(m_data_payload, PercentEncodeSet::C0Control));
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://url.spec.whatwg.org/#concept-url-serializer
|
// https://url.spec.whatwg.org/#concept-url-serializer
|
||||||
|
@ -276,7 +276,7 @@ DeprecatedString URL::serialize(ExcludeFragment exclude_fragment) const
|
||||||
builder.append(percent_encode(m_fragment, PercentEncodeSet::Fragment));
|
builder.append(percent_encode(m_fragment, PercentEncodeSet::Fragment));
|
||||||
}
|
}
|
||||||
|
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://url.spec.whatwg.org/#url-rendering
|
// https://url.spec.whatwg.org/#url-rendering
|
||||||
|
@ -320,7 +320,7 @@ DeprecatedString URL::serialize_for_display() const
|
||||||
builder.append(percent_encode(m_fragment, PercentEncodeSet::Fragment));
|
builder.append(percent_encode(m_fragment, PercentEncodeSet::Fragment));
|
||||||
}
|
}
|
||||||
|
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/origin.html#ascii-serialisation-of-an-origin
|
// https://html.spec.whatwg.org/multipage/origin.html#ascii-serialisation-of-an-origin
|
||||||
|
@ -429,7 +429,7 @@ DeprecatedString URL::percent_encode(StringView input, URL::PercentEncodeSet set
|
||||||
else
|
else
|
||||||
append_percent_encoded_if_necessary(builder, code_point, set);
|
append_percent_encoded_if_necessary(builder, code_point, set);
|
||||||
}
|
}
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
DeprecatedString URL::percent_decode(StringView input)
|
DeprecatedString URL::percent_decode(StringView input)
|
||||||
|
@ -451,7 +451,7 @@ DeprecatedString URL::percent_decode(StringView input)
|
||||||
builder.append(byte);
|
builder.append(byte);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
4
AK/URL.h
4
AK/URL.h
|
@ -81,7 +81,7 @@ public:
|
||||||
|
|
||||||
DeprecatedString serialize(ExcludeFragment = ExcludeFragment::No) const;
|
DeprecatedString serialize(ExcludeFragment = ExcludeFragment::No) const;
|
||||||
DeprecatedString serialize_for_display() const;
|
DeprecatedString serialize_for_display() const;
|
||||||
DeprecatedString to_string() const { return serialize(); }
|
DeprecatedString to_deprecated_string() const { return serialize(); }
|
||||||
|
|
||||||
// HTML origin
|
// HTML origin
|
||||||
DeprecatedString serialize_origin() const;
|
DeprecatedString serialize_origin() const;
|
||||||
|
@ -160,7 +160,7 @@ struct Formatter<URL> : Formatter<StringView> {
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct Traits<URL> : public GenericTraits<URL> {
|
struct Traits<URL> : public GenericTraits<URL> {
|
||||||
static unsigned hash(URL const& url) { return url.to_string().hash(); }
|
static unsigned hash(URL const& url) { return url.to_deprecated_string().hash(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,7 +148,7 @@ static DeprecatedString percent_encode_after_encoding(StringView input, URL::Per
|
||||||
}
|
}
|
||||||
|
|
||||||
// 6. Return output.
|
// 6. Return output.
|
||||||
return output.to_string();
|
return output.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://fetch.spec.whatwg.org/#data-urls
|
// https://fetch.spec.whatwg.org/#data-urls
|
||||||
|
@ -293,7 +293,7 @@ URL URLParser::parse(StringView raw_input, URL const* base_url, Optional<URL> ur
|
||||||
if (is_ascii_alphanumeric(code_point) || code_point == '+' || code_point == '-' || code_point == '.') {
|
if (is_ascii_alphanumeric(code_point) || code_point == '+' || code_point == '-' || code_point == '.') {
|
||||||
buffer.append_as_lowercase(code_point);
|
buffer.append_as_lowercase(code_point);
|
||||||
} else if (code_point == ':') {
|
} else if (code_point == ':') {
|
||||||
url->m_scheme = buffer.to_string();
|
url->m_scheme = buffer.to_deprecated_string();
|
||||||
buffer.clear();
|
buffer.clear();
|
||||||
if (url->scheme() == "file") {
|
if (url->scheme() == "file") {
|
||||||
if (!get_remaining().starts_with("//"sv)) {
|
if (!get_remaining().starts_with("//"sv)) {
|
||||||
|
@ -425,7 +425,7 @@ URL URLParser::parse(StringView raw_input, URL const* base_url, Optional<URL> ur
|
||||||
if (code_point == '@') {
|
if (code_point == '@') {
|
||||||
report_validation_error();
|
report_validation_error();
|
||||||
if (at_sign_seen) {
|
if (at_sign_seen) {
|
||||||
auto content = buffer.to_string();
|
auto content = buffer.to_deprecated_string();
|
||||||
buffer.clear();
|
buffer.clear();
|
||||||
buffer.append("%40"sv);
|
buffer.append("%40"sv);
|
||||||
buffer.append(content);
|
buffer.append(content);
|
||||||
|
|
|
@ -97,7 +97,7 @@ ErrorOr<NonnullOwnPtr<Kernel::KString>> UUID::to_string() const
|
||||||
return Kernel::KString::try_create(builder.string_view());
|
return Kernel::KString::try_create(builder.string_view());
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
DeprecatedString UUID::to_string() const
|
DeprecatedString UUID::to_deprecated_string() const
|
||||||
{
|
{
|
||||||
StringBuilder builder(36);
|
StringBuilder builder(36);
|
||||||
builder.append(encode_hex(m_uuid_buffer.span().trim(4)).view());
|
builder.append(encode_hex(m_uuid_buffer.span().trim(4)).view());
|
||||||
|
@ -109,7 +109,7 @@ DeprecatedString UUID::to_string() const
|
||||||
builder.append(encode_hex(m_uuid_buffer.span().slice(8).trim(2)).view());
|
builder.append(encode_hex(m_uuid_buffer.span().slice(8).trim(2)).view());
|
||||||
builder.append('-');
|
builder.append('-');
|
||||||
builder.append(encode_hex(m_uuid_buffer.span().slice(10).trim(6)).view());
|
builder.append(encode_hex(m_uuid_buffer.span().slice(10).trim(6)).view());
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ public:
|
||||||
#ifdef KERNEL
|
#ifdef KERNEL
|
||||||
ErrorOr<NonnullOwnPtr<Kernel::KString>> to_string() const;
|
ErrorOr<NonnullOwnPtr<Kernel::KString>> to_string() const;
|
||||||
#else
|
#else
|
||||||
DeprecatedString to_string() const;
|
DeprecatedString to_deprecated_string() const;
|
||||||
#endif
|
#endif
|
||||||
bool is_zero() const;
|
bool is_zero() const;
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ void log_that_can_not_fail(StringView fmtstr, TypeErasedFormatParams& params)
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
MUST(vformat(builder, fmtstr, params));
|
MUST(vformat(builder, fmtstr, params));
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
int main(int, char**)
|
int main(int, char**)
|
||||||
{
|
{
|
||||||
auto value = JsonValue::from_string("{\"property\": \"value\"}"sv).release_value_but_fixme_should_propagate_errors();
|
auto value = JsonValue::from_string("{\"property\": \"value\"}"sv).release_value_but_fixme_should_propagate_errors();
|
||||||
printf("parsed: _%s_\n", value.to_string().characters());
|
printf("parsed: _%s_\n", value.to_deprecated_string().characters());
|
||||||
printf("object.property = '%s'\n", value.as_object().get("property"sv).to_string().characters());
|
printf("object.property = '%s'\n", value.as_object().get("property"sv).to_deprecated_string().characters());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ static DeprecatedString pascal_case(DeprecatedString const& identifier)
|
||||||
} else
|
} else
|
||||||
builder.append(ch);
|
builder.append(ch);
|
||||||
}
|
}
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Message {
|
struct Message {
|
||||||
|
@ -50,7 +50,7 @@ struct Message {
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
builder.append(pascal_case(name));
|
builder.append(pascal_case(name));
|
||||||
builder.append("Response"sv);
|
builder.append("Response"sv);
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ static DeprecatedString message_name(DeprecatedString const& endpoint, Deprecate
|
||||||
builder.append(pascal_case(message));
|
builder.append(pascal_case(message));
|
||||||
if (is_response)
|
if (is_response)
|
||||||
builder.append("Response"sv);
|
builder.append("Response"sv);
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<Endpoint> parse(ByteBuffer const& file_contents)
|
Vector<Endpoint> parse(ByteBuffer const& file_contents)
|
||||||
|
@ -262,7 +262,7 @@ DeprecatedString constructor_for_message(DeprecatedString const& name, Vector<Pa
|
||||||
|
|
||||||
if (parameters.is_empty()) {
|
if (parameters.is_empty()) {
|
||||||
builder.append("() {}"sv);
|
builder.append("() {}"sv);
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
builder.append('(');
|
builder.append('(');
|
||||||
for (size_t i = 0; i < parameters.size(); ++i) {
|
for (size_t i = 0; i < parameters.size(); ++i) {
|
||||||
|
@ -279,7 +279,7 @@ DeprecatedString constructor_for_message(DeprecatedString const& name, Vector<Pa
|
||||||
builder.append(", "sv);
|
builder.append(", "sv);
|
||||||
}
|
}
|
||||||
builder.append(" {}"sv);
|
builder.append(" {}"sv);
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
void do_message(SourceGenerator message_generator, DeprecatedString const& name, Vector<Parameter> const& parameters, DeprecatedString const& response_type = {})
|
void do_message(SourceGenerator message_generator, DeprecatedString const& name, Vector<Parameter> const& parameters, DeprecatedString const& response_type = {})
|
||||||
|
@ -683,7 +683,7 @@ public:
|
||||||
message_generator.set("message.pascal_name", pascal_case(name));
|
message_generator.set("message.pascal_name", pascal_case(name));
|
||||||
message_generator.set("message.response_type", pascal_case(message.response_name()));
|
message_generator.set("message.response_type", pascal_case(message.response_name()));
|
||||||
message_generator.set("handler_name", name);
|
message_generator.set("handler_name", name);
|
||||||
message_generator.set("arguments", argument_generator.to_string());
|
message_generator.set("arguments", argument_generator.to_deprecated_string());
|
||||||
message_generator.appendln(R"~~~(
|
message_generator.appendln(R"~~~(
|
||||||
case (int)Messages::@endpoint.name@::MessageID::@message.pascal_name@: {)~~~");
|
case (int)Messages::@endpoint.name@::MessageID::@message.pascal_name@: {)~~~");
|
||||||
if (returns_something) {
|
if (returns_something) {
|
||||||
|
@ -740,7 +740,7 @@ public:
|
||||||
if (const_ref)
|
if (const_ref)
|
||||||
builder.append(" const&"sv);
|
builder.append(" const&"sv);
|
||||||
|
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
};
|
};
|
||||||
|
|
||||||
for (size_t i = 0; i < parameters.size(); ++i) {
|
for (size_t i = 0; i < parameters.size(); ++i) {
|
||||||
|
|
|
@ -174,7 +174,7 @@ static DeprecatedString sanitize_entry(DeprecatedString const& entry)
|
||||||
next_is_upper = ch == '_';
|
next_is_upper = ch == '_';
|
||||||
}
|
}
|
||||||
|
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
static Vector<u32> parse_code_point_list(StringView list)
|
static Vector<u32> parse_code_point_list(StringView list)
|
||||||
|
@ -451,7 +451,7 @@ static ErrorOr<void> parse_normalization_props(Core::Stream::BufferedFile& file,
|
||||||
VERIFY((segments.size() == 2) || (segments.size() == 3));
|
VERIFY((segments.size() == 2) || (segments.size() == 3));
|
||||||
|
|
||||||
auto code_point_range = parse_code_point_range(segments[0].trim_whitespace());
|
auto code_point_range = parse_code_point_range(segments[0].trim_whitespace());
|
||||||
auto property = segments[1].trim_whitespace().to_string();
|
auto property = segments[1].trim_whitespace().to_deprecated_string();
|
||||||
|
|
||||||
Vector<u32> value;
|
Vector<u32> value;
|
||||||
QuickCheck quick_check = QuickCheck::Yes;
|
QuickCheck quick_check = QuickCheck::Yes;
|
||||||
|
|
|
@ -89,7 +89,7 @@ static DeprecatedString union_type_to_variant(UnionType const& union_type, Inter
|
||||||
builder.append(", Empty"sv);
|
builder.append(", Empty"sv);
|
||||||
|
|
||||||
builder.append('>');
|
builder.append('>');
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
CppType idl_type_name_to_cpp_type(Type const& type, Interface const& interface)
|
CppType idl_type_name_to_cpp_type(Type const& type, Interface const& interface)
|
||||||
|
@ -174,7 +174,7 @@ static DeprecatedString make_input_acceptable_cpp(DeprecatedString const& input)
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
builder.append(input);
|
builder.append(input);
|
||||||
builder.append('_');
|
builder.append('_');
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
return input.replace("-"sv, "_"sv, ReplaceMode::All);
|
return input.replace("-"sv, "_"sv, ReplaceMode::All);
|
||||||
|
@ -893,7 +893,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter
|
||||||
if (dictionary_type)
|
if (dictionary_type)
|
||||||
to_variant_captures.append(DeprecatedString::formatted(", &{}{}_to_dictionary", js_name, js_suffix));
|
to_variant_captures.append(DeprecatedString::formatted(", &{}{}_to_dictionary", js_name, js_suffix));
|
||||||
|
|
||||||
union_generator.set("to_variant_captures", to_variant_captures.to_string());
|
union_generator.set("to_variant_captures", to_variant_captures.to_deprecated_string());
|
||||||
|
|
||||||
union_generator.append(R"~~~(
|
union_generator.append(R"~~~(
|
||||||
auto @js_name@@js_suffix@_to_variant = [@to_variant_captures@](JS::Value @js_name@@js_suffix@) -> JS::ThrowCompletionOr<@union_type@> {
|
auto @js_name@@js_suffix@_to_variant = [@to_variant_captures@](JS::Value @js_name@@js_suffix@) -> JS::ThrowCompletionOr<@union_type@> {
|
||||||
|
@ -1527,7 +1527,7 @@ static void generate_wrap_statement(SourceGenerator& generator, DeprecatedString
|
||||||
)~~~");
|
)~~~");
|
||||||
} else if (interface.enumerations.contains(type.name())) {
|
} else if (interface.enumerations.contains(type.name())) {
|
||||||
scoped_generator.append(R"~~~(
|
scoped_generator.append(R"~~~(
|
||||||
@result_expression@ JS::js_string(vm, Bindings::idl_enum_to_string(@value@));
|
@result_expression@ JS::js_string(vm, Bindings::idl_enum_to_deprecated_string(@value@));
|
||||||
)~~~");
|
)~~~");
|
||||||
} else if (interface.callback_functions.contains(type.name())) {
|
} else if (interface.callback_functions.contains(type.name())) {
|
||||||
// https://webidl.spec.whatwg.org/#es-callback-function
|
// https://webidl.spec.whatwg.org/#es-callback-function
|
||||||
|
@ -1837,7 +1837,7 @@ static DeprecatedString generate_constructor_for_idl_type(Type const& type)
|
||||||
builder.appendff("make_ref_counted<IDL::ParameterizedTypeType>(\"{}\", {}, NonnullRefPtrVector<IDL::Type> {{", type.name(), type.is_nullable());
|
builder.appendff("make_ref_counted<IDL::ParameterizedTypeType>(\"{}\", {}, NonnullRefPtrVector<IDL::Type> {{", type.name(), type.is_nullable());
|
||||||
append_type_list(builder, parameterized_type.parameters());
|
append_type_list(builder, parameterized_type.parameters());
|
||||||
builder.append("})"sv);
|
builder.append("})"sv);
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
case Type::Kind::Union: {
|
case Type::Kind::Union: {
|
||||||
auto const& union_type = type.as_union();
|
auto const& union_type = type.as_union();
|
||||||
|
@ -1845,7 +1845,7 @@ static DeprecatedString generate_constructor_for_idl_type(Type const& type)
|
||||||
builder.appendff("make_ref_counted<IDL::UnionType>(\"{}\", {}, NonnullRefPtrVector<IDL::Type> {{", type.name(), type.is_nullable());
|
builder.appendff("make_ref_counted<IDL::UnionType>(\"{}\", {}, NonnullRefPtrVector<IDL::Type> {{", type.name(), type.is_nullable());
|
||||||
append_type_list(builder, union_type.member_types());
|
append_type_list(builder, union_type.member_types());
|
||||||
builder.append("})"sv);
|
builder.append("})"sv);
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1931,8 +1931,8 @@ JS_DEFINE_NATIVE_FUNCTION(@class_name@::@function.name:snakecase@)
|
||||||
optionality_builder.append("}"sv);
|
optionality_builder.append("}"sv);
|
||||||
|
|
||||||
function_generator.set("overload.callable_id", DeprecatedString::number(overload.callable_id));
|
function_generator.set("overload.callable_id", DeprecatedString::number(overload.callable_id));
|
||||||
function_generator.set("overload.types", types_builder.to_string());
|
function_generator.set("overload.types", types_builder.to_deprecated_string());
|
||||||
function_generator.set("overload.optionality_values", optionality_builder.to_string());
|
function_generator.set("overload.optionality_values", optionality_builder.to_deprecated_string());
|
||||||
|
|
||||||
function_generator.appendln(" overloads.empend(@overload.callable_id@, @overload.types@, @overload.optionality_values@);");
|
function_generator.appendln(" overloads.empend(@overload.callable_id@, @overload.types@, @overload.optionality_values@);");
|
||||||
}
|
}
|
||||||
|
@ -2326,7 +2326,7 @@ enum class @enum.type.name@ {
|
||||||
|
|
||||||
enum_generator.append(R"~~~(
|
enum_generator.append(R"~~~(
|
||||||
};
|
};
|
||||||
inline DeprecatedString idl_enum_to_string(@enum.type.name@ value) {
|
inline DeprecatedString idl_enum_to_deprecated_string(@enum.type.name@ value) {
|
||||||
switch(value) {
|
switch(value) {
|
||||||
)~~~");
|
)~~~");
|
||||||
for (auto& entry : it.value.translated_cpp_names) {
|
for (auto& entry : it.value.translated_cpp_names) {
|
||||||
|
@ -2730,7 +2730,7 @@ JS_DEFINE_NATIVE_FUNCTION(@class_name@::to_string)
|
||||||
)~~~");
|
)~~~");
|
||||||
} else {
|
} else {
|
||||||
stringifier_generator.append(R"~~~(
|
stringifier_generator.append(R"~~~(
|
||||||
auto retval = TRY(throw_dom_exception_if_needed(vm, [&] { return impl->to_string(); }));
|
auto retval = TRY(throw_dom_exception_if_needed(vm, [&] { return impl->to_deprecated_string(); }));
|
||||||
)~~~");
|
)~~~");
|
||||||
}
|
}
|
||||||
stringifier_generator.append(R"~~~(
|
stringifier_generator.append(R"~~~(
|
||||||
|
|
|
@ -104,7 +104,7 @@ int main(int argc, char** argv)
|
||||||
builder.append(namespace_);
|
builder.append(namespace_);
|
||||||
builder.append("::"sv);
|
builder.append("::"sv);
|
||||||
builder.append(interface.name);
|
builder.append(interface.name);
|
||||||
interface.fully_qualified_name = builder.to_string();
|
interface.fully_qualified_name = builder.to_deprecated_string();
|
||||||
} else {
|
} else {
|
||||||
interface.fully_qualified_name = interface.name;
|
interface.fully_qualified_name = interface.name;
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ enum class ValueID;
|
||||||
enum_generator.appendln("enum class @name:titlecase@ : @enum_type@ {");
|
enum_generator.appendln("enum class @name:titlecase@ : @enum_type@ {");
|
||||||
|
|
||||||
for (auto& member : members.values()) {
|
for (auto& member : members.values()) {
|
||||||
auto member_name = member.to_string();
|
auto member_name = member.to_deprecated_string();
|
||||||
// Don't include aliases in the enum.
|
// Don't include aliases in the enum.
|
||||||
if (member_name.contains('='))
|
if (member_name.contains('='))
|
||||||
continue;
|
continue;
|
||||||
|
@ -126,7 +126,7 @@ Optional<@name:titlecase@> value_id_to_@name:snakecase@(ValueID value_id)
|
||||||
|
|
||||||
for (auto& member : members.values()) {
|
for (auto& member : members.values()) {
|
||||||
auto member_generator = enum_generator.fork();
|
auto member_generator = enum_generator.fork();
|
||||||
auto member_name = member.to_string();
|
auto member_name = member.to_deprecated_string();
|
||||||
if (member_name.contains('=')) {
|
if (member_name.contains('=')) {
|
||||||
auto parts = member_name.split_view('=');
|
auto parts = member_name.split_view('=');
|
||||||
member_generator.set("valueid:titlecase", title_casify(parts[0]));
|
member_generator.set("valueid:titlecase", title_casify(parts[0]));
|
||||||
|
@ -154,7 +154,7 @@ ValueID to_value_id(@name:titlecase@ @name:snakecase@_value)
|
||||||
|
|
||||||
for (auto& member : members.values()) {
|
for (auto& member : members.values()) {
|
||||||
auto member_generator = enum_generator.fork();
|
auto member_generator = enum_generator.fork();
|
||||||
auto member_name = member.to_string();
|
auto member_name = member.to_deprecated_string();
|
||||||
if (member_name.contains('='))
|
if (member_name.contains('='))
|
||||||
continue;
|
continue;
|
||||||
member_generator.set("member:titlecase", title_casify(member_name));
|
member_generator.set("member:titlecase", title_casify(member_name));
|
||||||
|
@ -178,7 +178,7 @@ StringView to_string(@name:titlecase@ value)
|
||||||
|
|
||||||
for (auto& member : members.values()) {
|
for (auto& member : members.values()) {
|
||||||
auto member_generator = enum_generator.fork();
|
auto member_generator = enum_generator.fork();
|
||||||
auto member_name = member.to_string();
|
auto member_name = member.to_deprecated_string();
|
||||||
if (member_name.contains('='))
|
if (member_name.contains('='))
|
||||||
continue;
|
continue;
|
||||||
member_generator.set("member:css", member_name);
|
member_generator.set("member:css", member_name);
|
||||||
|
|
|
@ -585,7 +585,7 @@ size_t property_maximum_value_count(PropertyID property_id)
|
||||||
VERIFY(max_values.is_number() && !max_values.is_double());
|
VERIFY(max_values.is_number() && !max_values.is_double());
|
||||||
auto property_generator = generator.fork();
|
auto property_generator = generator.fork();
|
||||||
property_generator.set("name:titlecase", title_casify(name));
|
property_generator.set("name:titlecase", title_casify(name));
|
||||||
property_generator.set("max_values", max_values.to_string());
|
property_generator.set("max_values", max_values.to_deprecated_string());
|
||||||
property_generator.append(R"~~~(
|
property_generator.append(R"~~~(
|
||||||
case PropertyID::@name:titlecase@:
|
case PropertyID::@name:titlecase@:
|
||||||
return @max_values@;
|
return @max_values@;
|
||||||
|
|
|
@ -45,7 +45,7 @@ static DeprecatedString title_casify_transform_function(StringView input)
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
builder.append(toupper(input[0]));
|
builder.append(toupper(input[0]));
|
||||||
builder.append(input.substring_view(1));
|
builder.append(input.substring_view(1));
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<void> generate_header_file(JsonObject& transforms_data, Core::Stream::File& file)
|
ErrorOr<void> generate_header_file(JsonObject& transforms_data, Core::Stream::File& file)
|
||||||
|
@ -189,7 +189,7 @@ TransformFunctionMetadata transform_function_metadata(TransformFunction transfor
|
||||||
member_generator.append(first ? " "sv : ", "sv);
|
member_generator.append(first ? " "sv : ", "sv);
|
||||||
first = false;
|
first = false;
|
||||||
|
|
||||||
member_generator.append(DeprecatedString::formatted("{{ TransformFunctionParameterType::{}, {}}}", parameter_type, value.as_object().get("required"sv).to_string()));
|
member_generator.append(DeprecatedString::formatted("{{ TransformFunctionParameterType::{}, {}}}", parameter_type, value.as_object().get("required"sv).to_deprecated_string()));
|
||||||
});
|
});
|
||||||
|
|
||||||
member_generator.append(R"~~~( }
|
member_generator.append(R"~~~( }
|
||||||
|
|
|
@ -57,7 +57,7 @@ enum class ValueID {
|
||||||
|
|
||||||
identifier_data.for_each([&](auto& name) {
|
identifier_data.for_each([&](auto& name) {
|
||||||
auto member_generator = generator.fork();
|
auto member_generator = generator.fork();
|
||||||
member_generator.set("name:titlecase", title_casify(name.to_string()));
|
member_generator.set("name:titlecase", title_casify(name.to_deprecated_string()));
|
||||||
|
|
||||||
member_generator.append(R"~~~(
|
member_generator.append(R"~~~(
|
||||||
@name:titlecase@,
|
@name:titlecase@,
|
||||||
|
@ -95,8 +95,8 @@ ValueID value_id_from_string(StringView string)
|
||||||
|
|
||||||
identifier_data.for_each([&](auto& name) {
|
identifier_data.for_each([&](auto& name) {
|
||||||
auto member_generator = generator.fork();
|
auto member_generator = generator.fork();
|
||||||
member_generator.set("name", name.to_string());
|
member_generator.set("name", name.to_deprecated_string());
|
||||||
member_generator.set("name:titlecase", title_casify(name.to_string()));
|
member_generator.set("name:titlecase", title_casify(name.to_deprecated_string()));
|
||||||
member_generator.append(R"~~~(
|
member_generator.append(R"~~~(
|
||||||
if (string.equals_ignoring_case("@name@"sv))
|
if (string.equals_ignoring_case("@name@"sv))
|
||||||
return ValueID::@name:titlecase@;
|
return ValueID::@name:titlecase@;
|
||||||
|
@ -113,8 +113,8 @@ const char* string_from_value_id(ValueID value_id) {
|
||||||
|
|
||||||
identifier_data.for_each([&](auto& name) {
|
identifier_data.for_each([&](auto& name) {
|
||||||
auto member_generator = generator.fork();
|
auto member_generator = generator.fork();
|
||||||
member_generator.set("name", name.to_string());
|
member_generator.set("name", name.to_deprecated_string());
|
||||||
member_generator.set("name:titlecase", title_casify(name.to_string()));
|
member_generator.set("name:titlecase", title_casify(name.to_deprecated_string()));
|
||||||
member_generator.append(R"~~~(
|
member_generator.append(R"~~~(
|
||||||
case ValueID::@name:titlecase@:
|
case ValueID::@name:titlecase@:
|
||||||
return "@name@";
|
return "@name@";
|
||||||
|
|
|
@ -25,7 +25,7 @@ DeprecatedString title_casify(DeprecatedString const& dashy_name)
|
||||||
continue;
|
continue;
|
||||||
builder.append(part.substring_view(1, part.length() - 1));
|
builder.append(part.substring_view(1, part.length() - 1));
|
||||||
}
|
}
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
DeprecatedString camel_casify(StringView dashy_name)
|
DeprecatedString camel_casify(StringView dashy_name)
|
||||||
|
@ -46,7 +46,7 @@ DeprecatedString camel_casify(StringView dashy_name)
|
||||||
continue;
|
continue;
|
||||||
builder.append(part.substring_view(1, part.length() - 1));
|
builder.append(part.substring_view(1, part.length() - 1));
|
||||||
}
|
}
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
DeprecatedString snake_casify(DeprecatedString const& dashy_name)
|
DeprecatedString snake_casify(DeprecatedString const& dashy_name)
|
||||||
|
|
|
@ -159,7 +159,7 @@ parse_state_machine(StringView input)
|
||||||
consume_whitespace();
|
consume_whitespace();
|
||||||
state.exit_action = consume_identifier();
|
state.exit_action = consume_identifier();
|
||||||
} else if (lexer.next_is('@')) {
|
} else if (lexer.next_is('@')) {
|
||||||
auto directive = consume_identifier().to_string();
|
auto directive = consume_identifier().to_deprecated_string();
|
||||||
fprintf(stderr, "Unimplemented @ directive %s\n", directive.characters());
|
fprintf(stderr, "Unimplemented @ directive %s\n", directive.characters());
|
||||||
exit(1);
|
exit(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -189,7 +189,7 @@ parse_state_machine(StringView input)
|
||||||
lexer.consume_specific('@');
|
lexer.consume_specific('@');
|
||||||
state_machine->anywhere = consume_state_description();
|
state_machine->anywhere = consume_state_description();
|
||||||
} else if (lexer.consume_specific('@')) {
|
} else if (lexer.consume_specific('@')) {
|
||||||
auto directive = consume_identifier().to_string();
|
auto directive = consume_identifier().to_deprecated_string();
|
||||||
fprintf(stderr, "Unimplemented @ directive %s\n", directive.characters());
|
fprintf(stderr, "Unimplemented @ directive %s\n", directive.characters());
|
||||||
exit(1);
|
exit(1);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -290,7 +290,7 @@ int main()
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: Required components will always be preselected.
|
// NOTE: Required components will always be preselected.
|
||||||
WhiptailOption option { component.name, component.name, description_builder.to_string(), is_required };
|
WhiptailOption option { component.name, component.name, description_builder.to_deprecated_string(), is_required };
|
||||||
if (build_type == "REQUIRED") {
|
if (build_type == "REQUIRED") {
|
||||||
// noop
|
// noop
|
||||||
} else if (build_type == "RECOMMENDED") {
|
} else if (build_type == "RECOMMENDED") {
|
||||||
|
|
|
@ -125,7 +125,7 @@ static bool parse_and_run(JS::Interpreter& interpreter, StringView source, Strin
|
||||||
if (JS::Bytecode::g_dump_bytecode || s_run_bytecode) {
|
if (JS::Bytecode::g_dump_bytecode || s_run_bytecode) {
|
||||||
auto executable_result = JS::Bytecode::Generator::generate(script_or_module->parse_node());
|
auto executable_result = JS::Bytecode::Generator::generate(script_or_module->parse_node());
|
||||||
if (executable_result.is_error()) {
|
if (executable_result.is_error()) {
|
||||||
result = g_vm->throw_completion<JS::InternalError>(executable_result.error().to_string());
|
result = g_vm->throw_completion<JS::InternalError>(executable_result.error().to_deprecated_string());
|
||||||
return ReturnEarly::No;
|
return ReturnEarly::No;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,8 +163,8 @@ static bool parse_and_run(JS::Interpreter& interpreter, StringView source, Strin
|
||||||
auto hint = error.source_location_hint(source);
|
auto hint = error.source_location_hint(source);
|
||||||
if (!hint.is_empty())
|
if (!hint.is_empty())
|
||||||
displayln("{}", hint);
|
displayln("{}", hint);
|
||||||
displayln("{}", error.to_string());
|
displayln("{}", error.to_deprecated_string());
|
||||||
result = interpreter.vm().throw_completion<JS::SyntaxError>(error.to_string());
|
result = interpreter.vm().throw_completion<JS::SyntaxError>(error.to_deprecated_string());
|
||||||
} else {
|
} else {
|
||||||
auto return_early = run_script_or_module(script_or_error.value());
|
auto return_early = run_script_or_module(script_or_error.value());
|
||||||
if (return_early == ReturnEarly::Yes)
|
if (return_early == ReturnEarly::Yes)
|
||||||
|
@ -177,8 +177,8 @@ static bool parse_and_run(JS::Interpreter& interpreter, StringView source, Strin
|
||||||
auto hint = error.source_location_hint(source);
|
auto hint = error.source_location_hint(source);
|
||||||
if (!hint.is_empty())
|
if (!hint.is_empty())
|
||||||
displayln("{}", hint);
|
displayln("{}", hint);
|
||||||
displayln(error.to_string());
|
displayln(error.to_deprecated_string());
|
||||||
result = interpreter.vm().throw_completion<JS::SyntaxError>(error.to_string());
|
result = interpreter.vm().throw_completion<JS::SyntaxError>(error.to_deprecated_string());
|
||||||
} else {
|
} else {
|
||||||
auto return_early = run_script_or_module(module_or_error.value());
|
auto return_early = run_script_or_module(module_or_error.value());
|
||||||
if (return_early == ReturnEarly::Yes)
|
if (return_early == ReturnEarly::Yes)
|
||||||
|
|
|
@ -156,7 +156,7 @@ TEST_CASE(flystring)
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
builder.append('f');
|
builder.append('f');
|
||||||
builder.append("oo"sv);
|
builder.append("oo"sv);
|
||||||
FlyString c = builder.to_string();
|
FlyString c = builder.to_deprecated_string();
|
||||||
EXPECT_EQ(a.impl(), b.impl());
|
EXPECT_EQ(a.impl(), b.impl());
|
||||||
EXPECT_EQ(a.impl(), c.impl());
|
EXPECT_EQ(a.impl(), c.impl());
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ TEST_CASE(string_builder)
|
||||||
builder.appendff(" {} ", 42);
|
builder.appendff(" {} ", 42);
|
||||||
builder.appendff("{1}{0} ", 1, 2);
|
builder.appendff("{1}{0} ", 1, 2);
|
||||||
|
|
||||||
EXPECT_EQ(builder.to_string(), " 42 21 ");
|
EXPECT_EQ(builder.to_deprecated_string(), " 42 21 ");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE(format_without_arguments)
|
TEST_CASE(format_without_arguments)
|
||||||
|
|
|
@ -61,7 +61,7 @@ TEST_CASE(should_convert_to_string)
|
||||||
{
|
{
|
||||||
constexpr IPv4Address addr(1, 25, 39, 42);
|
constexpr IPv4Address addr(1, 25, 39, 42);
|
||||||
|
|
||||||
EXPECT_EQ("1.25.39.42", addr.to_string());
|
EXPECT_EQ("1.25.39.42", addr.to_deprecated_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE(should_make_ipv4_address_from_string)
|
TEST_CASE(should_make_ipv4_address_from_string)
|
||||||
|
|
|
@ -55,14 +55,14 @@ TEST_CASE(should_get_groups_by_index)
|
||||||
|
|
||||||
TEST_CASE(should_convert_to_string)
|
TEST_CASE(should_convert_to_string)
|
||||||
{
|
{
|
||||||
EXPECT_EQ("102:304:506:708:90a:b0c:d0e:f10"sv, IPv6Address({ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }).to_string());
|
EXPECT_EQ("102:304:506:708:90a:b0c:d0e:f10"sv, IPv6Address({ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }).to_deprecated_string());
|
||||||
EXPECT_EQ("::"sv, IPv6Address().to_string());
|
EXPECT_EQ("::"sv, IPv6Address().to_deprecated_string());
|
||||||
EXPECT_EQ("::1"sv, IPv6Address({ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }).to_string());
|
EXPECT_EQ("::1"sv, IPv6Address({ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }).to_deprecated_string());
|
||||||
EXPECT_EQ("1::"sv, IPv6Address({ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }).to_string());
|
EXPECT_EQ("1::"sv, IPv6Address({ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }).to_deprecated_string());
|
||||||
EXPECT_EQ("102:0:506:708:900::10"sv, IPv6Address({ 1, 2, 0, 0, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 16 }).to_string());
|
EXPECT_EQ("102:0:506:708:900::10"sv, IPv6Address({ 1, 2, 0, 0, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 16 }).to_deprecated_string());
|
||||||
EXPECT_EQ("102:0:506:708:900::"sv, IPv6Address({ 1, 2, 0, 0, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0 }).to_string());
|
EXPECT_EQ("102:0:506:708:900::"sv, IPv6Address({ 1, 2, 0, 0, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0 }).to_deprecated_string());
|
||||||
EXPECT_EQ("::304:506:708:90a:b0c:d0e:f10"sv, IPv6Address({ 0, 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }).to_string());
|
EXPECT_EQ("::304:506:708:90a:b0c:d0e:f10"sv, IPv6Address({ 0, 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }).to_deprecated_string());
|
||||||
EXPECT_EQ("102:304::708:90a:b0c:d0e:f10"sv, IPv6Address({ 1, 2, 3, 4, 0, 0, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }).to_string());
|
EXPECT_EQ("102:304::708:90a:b0c:d0e:f10"sv, IPv6Address({ 1, 2, 3, 4, 0, 0, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }).to_deprecated_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE(should_make_ipv6_address_from_string)
|
TEST_CASE(should_make_ipv6_address_from_string)
|
||||||
|
@ -86,7 +86,7 @@ TEST_CASE(ipv4_mapped_ipv6)
|
||||||
IPv6Address mapped_address(ipv4_address_to_map);
|
IPv6Address mapped_address(ipv4_address_to_map);
|
||||||
EXPECT(mapped_address.is_ipv4_mapped());
|
EXPECT(mapped_address.is_ipv4_mapped());
|
||||||
EXPECT_EQ(ipv4_address_to_map, mapped_address.ipv4_mapped_address().value());
|
EXPECT_EQ(ipv4_address_to_map, mapped_address.ipv4_mapped_address().value());
|
||||||
EXPECT_EQ("::ffff:192.168.0.1"sv, mapped_address.to_string());
|
EXPECT_EQ("::ffff:192.168.0.1"sv, mapped_address.to_deprecated_string());
|
||||||
EXPECT_EQ(IPv4Address(192, 168, 1, 9), IPv6Address::from_string("::FFFF:192.168.1.9"sv).value().ipv4_mapped_address().value());
|
EXPECT_EQ(IPv4Address(192, 168, 1, 9), IPv6Address::from_string("::FFFF:192.168.1.9"sv).value().ipv4_mapped_address().value());
|
||||||
EXPECT(!IPv6Address::from_string("::abcd:192.168.1.9"sv).has_value());
|
EXPECT(!IPv6Address::from_string("::abcd:192.168.1.9"sv).has_value());
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ TEST_CASE(load_form)
|
||||||
|
|
||||||
EXPECT(form_json.is_object());
|
EXPECT(form_json.is_object());
|
||||||
|
|
||||||
auto name = form_json.as_object().get("name"sv).to_string();
|
auto name = form_json.as_object().get("name"sv).to_deprecated_string();
|
||||||
|
|
||||||
EXPECT_EQ(name, "Form1");
|
EXPECT_EQ(name, "Form1");
|
||||||
|
|
||||||
|
@ -111,13 +111,13 @@ TEST_CASE(json_duplicate_keys)
|
||||||
json.set("test", "foo");
|
json.set("test", "foo");
|
||||||
json.set("test", "bar");
|
json.set("test", "bar");
|
||||||
json.set("test", "baz");
|
json.set("test", "baz");
|
||||||
EXPECT_EQ(json.to_string(), "{\"test\":\"baz\"}");
|
EXPECT_EQ(json.to_deprecated_string(), "{\"test\":\"baz\"}");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE(json_u64_roundtrip)
|
TEST_CASE(json_u64_roundtrip)
|
||||||
{
|
{
|
||||||
auto big_value = 0xffffffffffffffffull;
|
auto big_value = 0xffffffffffffffffull;
|
||||||
auto json = JsonValue(big_value).to_string();
|
auto json = JsonValue(big_value).to_deprecated_string();
|
||||||
auto value = JsonValue::from_string(json);
|
auto value = JsonValue::from_string(json);
|
||||||
EXPECT_EQ_FORCE(value.is_error(), false);
|
EXPECT_EQ_FORCE(value.is_error(), false);
|
||||||
EXPECT_EQ(value.value().as_u64(), big_value);
|
EXPECT_EQ(value.value().as_u64(), big_value);
|
||||||
|
|
|
@ -80,7 +80,7 @@ TEST_CASE(should_equality_compare)
|
||||||
TEST_CASE(should_string_format)
|
TEST_CASE(should_string_format)
|
||||||
{
|
{
|
||||||
MACAddress sut(1, 2, 3, 4, 5, 6);
|
MACAddress sut(1, 2, 3, 4, 5, 6);
|
||||||
EXPECT_EQ("01:02:03:04:05:06", sut.to_string());
|
EXPECT_EQ("01:02:03:04:05:06", sut.to_deprecated_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE(should_make_mac_address_from_string_numbers)
|
TEST_CASE(should_make_mac_address_from_string_numbers)
|
||||||
|
|
|
@ -367,21 +367,21 @@ TEST_CASE(leading_whitespace)
|
||||||
{
|
{
|
||||||
URL url { " https://foo.com/"sv };
|
URL url { " https://foo.com/"sv };
|
||||||
EXPECT(url.is_valid());
|
EXPECT(url.is_valid());
|
||||||
EXPECT_EQ(url.to_string(), "https://foo.com/");
|
EXPECT_EQ(url.to_deprecated_string(), "https://foo.com/");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE(trailing_whitespace)
|
TEST_CASE(trailing_whitespace)
|
||||||
{
|
{
|
||||||
URL url { "https://foo.com/ "sv };
|
URL url { "https://foo.com/ "sv };
|
||||||
EXPECT(url.is_valid());
|
EXPECT(url.is_valid());
|
||||||
EXPECT_EQ(url.to_string(), "https://foo.com/");
|
EXPECT_EQ(url.to_deprecated_string(), "https://foo.com/");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE(leading_and_trailing_whitespace)
|
TEST_CASE(leading_and_trailing_whitespace)
|
||||||
{
|
{
|
||||||
URL url { " https://foo.com/ "sv };
|
URL url { " https://foo.com/ "sv };
|
||||||
EXPECT(url.is_valid());
|
EXPECT(url.is_valid());
|
||||||
EXPECT_EQ(url.to_string(), "https://foo.com/");
|
EXPECT_EQ(url.to_deprecated_string(), "https://foo.com/");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE(unicode)
|
TEST_CASE(unicode)
|
||||||
|
|
|
@ -48,7 +48,7 @@ TEST_CASE(test_regression)
|
||||||
|
|
||||||
EXPECT_EQ(tokens.size(), target_lines.size());
|
EXPECT_EQ(tokens.size(), target_lines.size());
|
||||||
for (size_t i = 0; i < tokens.size(); ++i) {
|
for (size_t i = 0; i < tokens.size(); ++i) {
|
||||||
EXPECT_EQ(tokens[i].to_string(), target_lines[i]);
|
EXPECT_EQ(tokens[i].to_deprecated_string(), target_lines[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,6 @@ TEST_CASE(test_decode)
|
||||||
illegal_character_builder.append(byte);
|
illegal_character_builder.append(byte);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto illegal_character_decode = IMAP::decode_quoted_printable(illegal_character_builder.to_string());
|
auto illegal_character_decode = IMAP::decode_quoted_printable(illegal_character_builder.to_deprecated_string());
|
||||||
EXPECT(illegal_character_decode.is_empty());
|
EXPECT(illegal_character_decode.is_empty());
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,14 +62,14 @@ TESTJS_GLOBAL_FUNCTION(mark_as_garbage, markAsGarbage)
|
||||||
return execution_context->lexical_environment != nullptr;
|
return execution_context->lexical_environment != nullptr;
|
||||||
});
|
});
|
||||||
if (!outer_environment.has_value())
|
if (!outer_environment.has_value())
|
||||||
return vm.throw_completion<JS::ReferenceError>(JS::ErrorType::UnknownIdentifier, variable_name.string());
|
return vm.throw_completion<JS::ReferenceError>(JS::ErrorType::UnknownIdentifier, variable_name.deprecated_string());
|
||||||
|
|
||||||
auto reference = TRY(vm.resolve_binding(variable_name.string(), outer_environment.value()->lexical_environment));
|
auto reference = TRY(vm.resolve_binding(variable_name.deprecated_string(), outer_environment.value()->lexical_environment));
|
||||||
|
|
||||||
auto value = TRY(reference.get_value(vm));
|
auto value = TRY(reference.get_value(vm));
|
||||||
|
|
||||||
if (!can_be_held_weakly(value))
|
if (!can_be_held_weakly(value))
|
||||||
return vm.throw_completion<JS::TypeError>(JS::ErrorType::CannotBeHeldWeakly, DeprecatedString::formatted("Variable with name {}", variable_name.string()));
|
return vm.throw_completion<JS::TypeError>(JS::ErrorType::CannotBeHeldWeakly, DeprecatedString::formatted("Variable with name {}", variable_name.deprecated_string()));
|
||||||
|
|
||||||
vm.heap().uproot_cell(&value.as_cell());
|
vm.heap().uproot_cell(&value.as_cell());
|
||||||
TRY(reference.delete_(vm));
|
TRY(reference.delete_(vm));
|
||||||
|
|
|
@ -427,7 +427,7 @@ void write_per_file(HashMap<size_t, TestResult> const& result_map, Vector<Deprec
|
||||||
complete_results.set("duration", time_taken_in_ms / 1000.);
|
complete_results.set("duration", time_taken_in_ms / 1000.);
|
||||||
complete_results.set("results", result_object);
|
complete_results.set("results", result_object);
|
||||||
|
|
||||||
if (!file->write_or_error(complete_results.to_string().bytes()))
|
if (!file->write_or_error(complete_results.to_deprecated_string().bytes()))
|
||||||
warnln("Failed to write per-file");
|
warnln("Failed to write per-file");
|
||||||
file->close();
|
file->close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ static Result<ScriptOrModuleProgram, TestError> parse_program(JS::Realm& realm,
|
||||||
return TestError {
|
return TestError {
|
||||||
NegativePhase::ParseOrEarly,
|
NegativePhase::ParseOrEarly,
|
||||||
"SyntaxError",
|
"SyntaxError",
|
||||||
script_or_error.error()[0].to_string(),
|
script_or_error.error()[0].to_deprecated_string(),
|
||||||
""
|
""
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ static Result<void, TestError> run_program(InterpreterT& interpreter, ScriptOrMo
|
||||||
|
|
||||||
auto unit_result = JS::Bytecode::Generator::generate(program_node);
|
auto unit_result = JS::Bytecode::Generator::generate(program_node);
|
||||||
if (unit_result.is_error()) {
|
if (unit_result.is_error()) {
|
||||||
result = JS::throw_completion(JS::InternalError::create(interpreter.realm(), DeprecatedString::formatted("TODO({})", unit_result.error().to_string())));
|
result = JS::throw_completion(JS::InternalError::create(interpreter.realm(), DeprecatedString::formatted("TODO({})", unit_result.error().to_deprecated_string())));
|
||||||
} else {
|
} else {
|
||||||
auto unit = unit_result.release_value();
|
auto unit = unit_result.release_value();
|
||||||
auto optimization_level = s_enable_bytecode_optimizations ? JS::Bytecode::Interpreter::OptimizationLevel::Optimize : JS::Bytecode::Interpreter::OptimizationLevel::Default;
|
auto optimization_level = s_enable_bytecode_optimizations ? JS::Bytecode::Interpreter::OptimizationLevel::Optimize : JS::Bytecode::Interpreter::OptimizationLevel::Default;
|
||||||
|
@ -160,7 +160,7 @@ static Result<StringView, TestError> read_harness_file(StringView harness_file)
|
||||||
}
|
}
|
||||||
|
|
||||||
StringView contents_view = contents_or_error.value();
|
StringView contents_view = contents_or_error.value();
|
||||||
s_cached_harness_files.set(harness_file, contents_view.to_string());
|
s_cached_harness_files.set(harness_file, contents_view.to_deprecated_string());
|
||||||
cache = s_cached_harness_files.find(harness_file);
|
cache = s_cached_harness_files.find(harness_file);
|
||||||
VERIFY(cache != s_cached_harness_files.end());
|
VERIFY(cache != s_cached_harness_files.end());
|
||||||
}
|
}
|
||||||
|
@ -219,7 +219,7 @@ static Result<void, TestError> run_test(StringView source, StringView filepath,
|
||||||
return TestError {
|
return TestError {
|
||||||
NegativePhase::ParseOrEarly,
|
NegativePhase::ParseOrEarly,
|
||||||
"SyntaxError",
|
"SyntaxError",
|
||||||
parser.errors()[0].to_string(),
|
parser.errors()[0].to_deprecated_string(),
|
||||||
""
|
""
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -483,7 +483,7 @@ static bool verify_test(Result<void, TestError>& result, TestMetadata const& met
|
||||||
|
|
||||||
JsonObject expected_error_object;
|
JsonObject expected_error_object;
|
||||||
expected_error_object.set("phase", phase_to_string(metadata.phase));
|
expected_error_object.set("phase", phase_to_string(metadata.phase));
|
||||||
expected_error_object.set("type", metadata.type.to_string());
|
expected_error_object.set("type", metadata.type.to_deprecated_string());
|
||||||
|
|
||||||
expected_error = expected_error_object;
|
expected_error = expected_error_object;
|
||||||
|
|
||||||
|
@ -548,7 +548,7 @@ static bool g_in_assert = false;
|
||||||
assert_fail_result.set("assert_fail", true);
|
assert_fail_result.set("assert_fail", true);
|
||||||
assert_fail_result.set("result", "assert_fail");
|
assert_fail_result.set("result", "assert_fail");
|
||||||
assert_fail_result.set("output", assert_failed_message);
|
assert_fail_result.set("output", assert_failed_message);
|
||||||
outln(saved_stdout_fd, "RESULT {}{}", assert_fail_result.to_string(), '\0');
|
outln(saved_stdout_fd, "RESULT {}{}", assert_fail_result.to_deprecated_string(), '\0');
|
||||||
// (Attempt to) Ensure that messages are written before quitting.
|
// (Attempt to) Ensure that messages are written before quitting.
|
||||||
fflush(saved_stdout_fd);
|
fflush(saved_stdout_fd);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
|
@ -728,7 +728,7 @@ int main(int argc, char** argv)
|
||||||
StringBuilder builder { contents.size() + strict_length };
|
StringBuilder builder { contents.size() + strict_length };
|
||||||
builder.append(use_strict);
|
builder.append(use_strict);
|
||||||
builder.append(contents);
|
builder.append(contents);
|
||||||
source_with_strict = builder.to_string();
|
source_with_strict = builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
StringView with_strict = source_with_strict.view();
|
StringView with_strict = source_with_strict.view();
|
||||||
|
@ -738,7 +738,7 @@ int main(int argc, char** argv)
|
||||||
result_object.set("test", path);
|
result_object.set("test", path);
|
||||||
|
|
||||||
ScopeGuard output_guard = [&] {
|
ScopeGuard output_guard = [&] {
|
||||||
outln(saved_stdout_fd, "RESULT {}{}", result_object.to_string(), '\0');
|
outln(saved_stdout_fd, "RESULT {}{}", result_object.to_deprecated_string(), '\0');
|
||||||
fflush(saved_stdout_fd);
|
fflush(saved_stdout_fd);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -377,7 +377,7 @@ TEST_CASE(ini_file_entries)
|
||||||
|
|
||||||
if constexpr (REGEX_DEBUG) {
|
if constexpr (REGEX_DEBUG) {
|
||||||
for (auto& v : result.matches)
|
for (auto& v : result.matches)
|
||||||
fprintf(stderr, "%s\n", v.view.to_string().characters());
|
fprintf(stderr, "%s\n", v.view.to_deprecated_string().characters());
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPECT_EQ(result.matches.at(0).view, "[Window]");
|
EXPECT_EQ(result.matches.at(0).view, "[Window]");
|
||||||
|
@ -1084,7 +1084,7 @@ TEST_CASE(single_match_flag)
|
||||||
auto result = re.match("ABC"sv);
|
auto result = re.match("ABC"sv);
|
||||||
EXPECT_EQ(result.success, true);
|
EXPECT_EQ(result.success, true);
|
||||||
EXPECT_EQ(result.matches.size(), 1u);
|
EXPECT_EQ(result.matches.size(), 1u);
|
||||||
EXPECT_EQ(result.matches.first().view.to_string(), "A"sv);
|
EXPECT_EQ(result.matches.first().view.to_deprecated_string(), "A"sv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1097,7 +1097,7 @@ TEST_CASE(inversion_state_in_char_class)
|
||||||
auto result = re.match("hello"sv);
|
auto result = re.match("hello"sv);
|
||||||
EXPECT_EQ(result.success, true);
|
EXPECT_EQ(result.success, true);
|
||||||
EXPECT_EQ(result.matches.size(), 1u);
|
EXPECT_EQ(result.matches.size(), 1u);
|
||||||
EXPECT_EQ(result.matches.first().view.to_string(), "h"sv);
|
EXPECT_EQ(result.matches.first().view.to_deprecated_string(), "h"sv);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
Regex<ECMA262> re("^(?:([^\\s!\"#%-,\\./;->@\\[-\\^`\\{-~]+(?=([=~}\\s/.)|]))))"sv, ECMAScriptFlags::Global);
|
Regex<ECMA262> re("^(?:([^\\s!\"#%-,\\./;->@\\[-\\^`\\{-~]+(?=([=~}\\s/.)|]))))"sv, ECMAScriptFlags::Global);
|
||||||
|
@ -1105,8 +1105,8 @@ TEST_CASE(inversion_state_in_char_class)
|
||||||
auto result = re.match("slideNumbers}}"sv);
|
auto result = re.match("slideNumbers}}"sv);
|
||||||
EXPECT_EQ(result.success, true);
|
EXPECT_EQ(result.success, true);
|
||||||
EXPECT_EQ(result.matches.size(), 1u);
|
EXPECT_EQ(result.matches.size(), 1u);
|
||||||
EXPECT_EQ(result.matches.first().view.to_string(), "slideNumbers"sv);
|
EXPECT_EQ(result.matches.first().view.to_deprecated_string(), "slideNumbers"sv);
|
||||||
EXPECT_EQ(result.capture_group_matches.first()[0].view.to_string(), "slideNumbers"sv);
|
EXPECT_EQ(result.capture_group_matches.first()[0].view.to_deprecated_string(), "slideNumbers"sv);
|
||||||
EXPECT_EQ(result.capture_group_matches.first()[1].view.to_string(), "}"sv);
|
EXPECT_EQ(result.capture_group_matches.first()[1].view.to_deprecated_string(), "}"sv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,7 +204,7 @@ TEST_CASE(character_class2)
|
||||||
fprintf(stderr, "Matches[%i].rm_so: %li, .rm_eo: %li .rm_cnt: %li: ", i, matches[i].rm_so, matches[i].rm_eo, matches[i].rm_cnt);
|
fprintf(stderr, "Matches[%i].rm_so: %li, .rm_eo: %li .rm_cnt: %li: ", i, matches[i].rm_so, matches[i].rm_eo, matches[i].rm_cnt);
|
||||||
fprintf(stderr, "haystack length: %lu\n", haystack.length());
|
fprintf(stderr, "haystack length: %lu\n", haystack.length());
|
||||||
if (matches[i].rm_so != -1)
|
if (matches[i].rm_so != -1)
|
||||||
fprintf(stderr, "%s\n", haystack.substring_view(matches[i].rm_so, matches[i].rm_eo - matches[i].rm_so).to_string().characters());
|
fprintf(stderr, "%s\n", haystack.substring_view(matches[i].rm_so, matches[i].rm_eo - matches[i].rm_so).to_deprecated_string().characters());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ void verify_table_contents(SQL::Database& db, int expected_count)
|
||||||
for (auto& row : rows_or_error.value()) {
|
for (auto& row : rows_or_error.value()) {
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
builder.appendff("Test{}", row["IntColumn"].to_int().value());
|
builder.appendff("Test{}", row["IntColumn"].to_int().value());
|
||||||
EXPECT_EQ(row["TextColumn"].to_string(), builder.build());
|
EXPECT_EQ(row["TextColumn"].to_deprecated_string(), builder.build());
|
||||||
count++;
|
count++;
|
||||||
sum += row["IntColumn"].to_int().value();
|
sum += row["IntColumn"].to_int().value();
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ ParseResult parse(StringView sql)
|
||||||
auto expression = parser.parse();
|
auto expression = parser.parse();
|
||||||
|
|
||||||
if (parser.has_errors()) {
|
if (parser.has_errors()) {
|
||||||
return parser.errors()[0].to_string();
|
return parser.errors()[0].to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
return expression;
|
return expression;
|
||||||
|
|
|
@ -27,7 +27,7 @@ SQL::ResultOr<SQL::ResultSet> try_execute(NonnullRefPtr<SQL::Database> database,
|
||||||
auto statement = parser.next_statement();
|
auto statement = parser.next_statement();
|
||||||
EXPECT(!parser.has_errors());
|
EXPECT(!parser.has_errors());
|
||||||
if (parser.has_errors())
|
if (parser.has_errors())
|
||||||
outln("{}", parser.errors()[0].to_string());
|
outln("{}", parser.errors()[0].to_deprecated_string());
|
||||||
return statement->execute(move(database));
|
return statement->execute(move(database));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ TEST_CASE(insert_into_table)
|
||||||
auto rows_or_error = database->select_all(*table);
|
auto rows_or_error = database->select_all(*table);
|
||||||
EXPECT(!rows_or_error.is_error());
|
EXPECT(!rows_or_error.is_error());
|
||||||
for (auto& row : rows_or_error.value()) {
|
for (auto& row : rows_or_error.value()) {
|
||||||
EXPECT_EQ(row["TEXTCOLUMN"].to_string(), "Test");
|
EXPECT_EQ(row["TEXTCOLUMN"].to_deprecated_string(), "Test");
|
||||||
EXPECT_EQ(row["INTCOLUMN"].to_int().value(), 42);
|
EXPECT_EQ(row["INTCOLUMN"].to_int().value(), 42);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
@ -325,8 +325,8 @@ TEST_CASE(select_inner_join)
|
||||||
EXPECT_EQ(result.size(), 1u);
|
EXPECT_EQ(result.size(), 1u);
|
||||||
EXPECT_EQ(result[0].row.size(), 3u);
|
EXPECT_EQ(result[0].row.size(), 3u);
|
||||||
EXPECT_EQ(result[0].row[0].to_int().value(), 42);
|
EXPECT_EQ(result[0].row[0].to_int().value(), 42);
|
||||||
EXPECT_EQ(result[0].row[1].to_string(), "Test_1");
|
EXPECT_EQ(result[0].row[1].to_deprecated_string(), "Test_1");
|
||||||
EXPECT_EQ(result[0].row[2].to_string(), "Test_12");
|
EXPECT_EQ(result[0].row[2].to_deprecated_string(), "Test_12");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE(select_with_like)
|
TEST_CASE(select_with_like)
|
||||||
|
@ -412,11 +412,11 @@ TEST_CASE(select_with_order)
|
||||||
|
|
||||||
result = execute(database, "SELECT TextColumn, IntColumn FROM TestSchema.TestTable ORDER BY TextColumn;");
|
result = execute(database, "SELECT TextColumn, IntColumn FROM TestSchema.TestTable ORDER BY TextColumn;");
|
||||||
EXPECT_EQ(result.size(), 5u);
|
EXPECT_EQ(result.size(), 5u);
|
||||||
EXPECT_EQ(result[0].row[0].to_string(), "Test_1");
|
EXPECT_EQ(result[0].row[0].to_deprecated_string(), "Test_1");
|
||||||
EXPECT_EQ(result[1].row[0].to_string(), "Test_2");
|
EXPECT_EQ(result[1].row[0].to_deprecated_string(), "Test_2");
|
||||||
EXPECT_EQ(result[2].row[0].to_string(), "Test_3");
|
EXPECT_EQ(result[2].row[0].to_deprecated_string(), "Test_3");
|
||||||
EXPECT_EQ(result[3].row[0].to_string(), "Test_4");
|
EXPECT_EQ(result[3].row[0].to_deprecated_string(), "Test_4");
|
||||||
EXPECT_EQ(result[4].row[0].to_string(), "Test_5");
|
EXPECT_EQ(result[4].row[0].to_deprecated_string(), "Test_5");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE(select_with_regexp)
|
TEST_CASE(select_with_regexp)
|
||||||
|
@ -487,15 +487,15 @@ TEST_CASE(select_with_order_two_columns)
|
||||||
|
|
||||||
result = execute(database, "SELECT TextColumn, IntColumn FROM TestSchema.TestTable ORDER BY TextColumn, IntColumn;");
|
result = execute(database, "SELECT TextColumn, IntColumn FROM TestSchema.TestTable ORDER BY TextColumn, IntColumn;");
|
||||||
EXPECT_EQ(result.size(), 5u);
|
EXPECT_EQ(result.size(), 5u);
|
||||||
EXPECT_EQ(result[0].row[0].to_string(), "Test_1");
|
EXPECT_EQ(result[0].row[0].to_deprecated_string(), "Test_1");
|
||||||
EXPECT_EQ(result[0].row[1].to_int().value(), 47);
|
EXPECT_EQ(result[0].row[1].to_int().value(), 47);
|
||||||
EXPECT_EQ(result[1].row[0].to_string(), "Test_2");
|
EXPECT_EQ(result[1].row[0].to_deprecated_string(), "Test_2");
|
||||||
EXPECT_EQ(result[1].row[1].to_int().value(), 40);
|
EXPECT_EQ(result[1].row[1].to_int().value(), 40);
|
||||||
EXPECT_EQ(result[2].row[0].to_string(), "Test_2");
|
EXPECT_EQ(result[2].row[0].to_deprecated_string(), "Test_2");
|
||||||
EXPECT_EQ(result[2].row[1].to_int().value(), 42);
|
EXPECT_EQ(result[2].row[1].to_int().value(), 42);
|
||||||
EXPECT_EQ(result[3].row[0].to_string(), "Test_4");
|
EXPECT_EQ(result[3].row[0].to_deprecated_string(), "Test_4");
|
||||||
EXPECT_EQ(result[3].row[1].to_int().value(), 41);
|
EXPECT_EQ(result[3].row[1].to_int().value(), 41);
|
||||||
EXPECT_EQ(result[4].row[0].to_string(), "Test_5");
|
EXPECT_EQ(result[4].row[0].to_deprecated_string(), "Test_5");
|
||||||
EXPECT_EQ(result[4].row[1].to_int().value(), 44);
|
EXPECT_EQ(result[4].row[1].to_int().value(), 44);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -516,11 +516,11 @@ TEST_CASE(select_with_order_by_column_not_in_result)
|
||||||
|
|
||||||
result = execute(database, "SELECT TextColumn FROM TestSchema.TestTable ORDER BY IntColumn;");
|
result = execute(database, "SELECT TextColumn FROM TestSchema.TestTable ORDER BY IntColumn;");
|
||||||
EXPECT_EQ(result.size(), 5u);
|
EXPECT_EQ(result.size(), 5u);
|
||||||
EXPECT_EQ(result[0].row[0].to_string(), "Test_3");
|
EXPECT_EQ(result[0].row[0].to_deprecated_string(), "Test_3");
|
||||||
EXPECT_EQ(result[1].row[0].to_string(), "Test_4");
|
EXPECT_EQ(result[1].row[0].to_deprecated_string(), "Test_4");
|
||||||
EXPECT_EQ(result[2].row[0].to_string(), "Test_2");
|
EXPECT_EQ(result[2].row[0].to_deprecated_string(), "Test_2");
|
||||||
EXPECT_EQ(result[3].row[0].to_string(), "Test_5");
|
EXPECT_EQ(result[3].row[0].to_deprecated_string(), "Test_5");
|
||||||
EXPECT_EQ(result[4].row[0].to_string(), "Test_1");
|
EXPECT_EQ(result[4].row[0].to_deprecated_string(), "Test_1");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE(select_with_limit)
|
TEST_CASE(select_with_limit)
|
||||||
|
@ -618,11 +618,11 @@ TEST_CASE(describe_table)
|
||||||
auto result = execute(database, "DESCRIBE TABLE TestSchema.TestTable;");
|
auto result = execute(database, "DESCRIBE TABLE TestSchema.TestTable;");
|
||||||
EXPECT_EQ(result.size(), 2u);
|
EXPECT_EQ(result.size(), 2u);
|
||||||
|
|
||||||
EXPECT_EQ(result[0].row[0].to_string(), "TEXTCOLUMN");
|
EXPECT_EQ(result[0].row[0].to_deprecated_string(), "TEXTCOLUMN");
|
||||||
EXPECT_EQ(result[0].row[1].to_string(), "text");
|
EXPECT_EQ(result[0].row[1].to_deprecated_string(), "text");
|
||||||
|
|
||||||
EXPECT_EQ(result[1].row[0].to_string(), "INTCOLUMN");
|
EXPECT_EQ(result[1].row[0].to_deprecated_string(), "INTCOLUMN");
|
||||||
EXPECT_EQ(result[1].row[1].to_string(), "int");
|
EXPECT_EQ(result[1].row[1].to_deprecated_string(), "int");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE(binary_operator_execution)
|
TEST_CASE(binary_operator_execution)
|
||||||
|
|
|
@ -27,7 +27,7 @@ ParseResult parse(StringView sql)
|
||||||
auto statement = parser.next_statement();
|
auto statement = parser.next_statement();
|
||||||
|
|
||||||
if (parser.has_errors()) {
|
if (parser.has_errors()) {
|
||||||
return parser.errors()[0].to_string();
|
return parser.errors()[0].to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
return statement;
|
return statement;
|
||||||
|
|
|
@ -17,7 +17,7 @@ TEST_CASE(null_value)
|
||||||
{
|
{
|
||||||
SQL::Value v(SQL::SQLType::Null);
|
SQL::Value v(SQL::SQLType::Null);
|
||||||
EXPECT_EQ(v.type(), SQL::SQLType::Null);
|
EXPECT_EQ(v.type(), SQL::SQLType::Null);
|
||||||
EXPECT_EQ(v.to_string(), "(null)"sv);
|
EXPECT_EQ(v.to_deprecated_string(), "(null)"sv);
|
||||||
EXPECT(!v.to_bool().has_value());
|
EXPECT(!v.to_bool().has_value());
|
||||||
EXPECT(!v.to_int().has_value());
|
EXPECT(!v.to_int().has_value());
|
||||||
EXPECT(!v.to_u32().has_value());
|
EXPECT(!v.to_u32().has_value());
|
||||||
|
@ -44,25 +44,25 @@ TEST_CASE(text_value)
|
||||||
|
|
||||||
v = "Test"sv;
|
v = "Test"sv;
|
||||||
EXPECT_EQ(v.type(), SQL::SQLType::Text);
|
EXPECT_EQ(v.type(), SQL::SQLType::Text);
|
||||||
EXPECT_EQ(v.to_string(), "Test"sv);
|
EXPECT_EQ(v.to_deprecated_string(), "Test"sv);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
SQL::Value v(DeprecatedString("String Test"sv));
|
SQL::Value v(DeprecatedString("String Test"sv));
|
||||||
EXPECT_EQ(v.type(), SQL::SQLType::Text);
|
EXPECT_EQ(v.type(), SQL::SQLType::Text);
|
||||||
EXPECT_EQ(v.to_string(), "String Test"sv);
|
EXPECT_EQ(v.to_deprecated_string(), "String Test"sv);
|
||||||
|
|
||||||
v = DeprecatedString("String Test 2"sv);
|
v = DeprecatedString("String Test 2"sv);
|
||||||
EXPECT_EQ(v.type(), SQL::SQLType::Text);
|
EXPECT_EQ(v.type(), SQL::SQLType::Text);
|
||||||
EXPECT_EQ(v.to_string(), "String Test 2"sv);
|
EXPECT_EQ(v.to_deprecated_string(), "String Test 2"sv);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
SQL::Value v("const char * Test");
|
SQL::Value v("const char * Test");
|
||||||
EXPECT_EQ(v.type(), SQL::SQLType::Text);
|
EXPECT_EQ(v.type(), SQL::SQLType::Text);
|
||||||
EXPECT_EQ(v.to_string(), "const char * Test"sv);
|
EXPECT_EQ(v.to_deprecated_string(), "const char * Test"sv);
|
||||||
|
|
||||||
v = "const char * Test 2";
|
v = "const char * Test 2";
|
||||||
EXPECT_EQ(v.type(), SQL::SQLType::Text);
|
EXPECT_EQ(v.type(), SQL::SQLType::Text);
|
||||||
EXPECT_EQ(v.to_string(), "const char * Test 2"sv);
|
EXPECT_EQ(v.to_deprecated_string(), "const char * Test 2"sv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ TEST_CASE(integer_value)
|
||||||
|
|
||||||
EXPECT(v.to_int().has_value());
|
EXPECT(v.to_int().has_value());
|
||||||
EXPECT_EQ(v.to_int().value(), 42);
|
EXPECT_EQ(v.to_int().value(), 42);
|
||||||
EXPECT_EQ(v.to_string(), "42"sv);
|
EXPECT_EQ(v.to_deprecated_string(), "42"sv);
|
||||||
|
|
||||||
EXPECT(v.to_double().has_value());
|
EXPECT(v.to_double().has_value());
|
||||||
EXPECT((v.to_double().value() - 42.0) < NumericLimits<double>().epsilon());
|
EXPECT((v.to_double().value() - 42.0) < NumericLimits<double>().epsilon());
|
||||||
|
@ -215,7 +215,7 @@ TEST_CASE(float_value)
|
||||||
|
|
||||||
EXPECT(v.to_int().has_value());
|
EXPECT(v.to_int().has_value());
|
||||||
EXPECT_EQ(v.to_int().value(), 3);
|
EXPECT_EQ(v.to_int().value(), 3);
|
||||||
EXPECT_EQ(v.to_string(), "3.14");
|
EXPECT_EQ(v.to_deprecated_string(), "3.14");
|
||||||
|
|
||||||
EXPECT(v.to_bool().has_value());
|
EXPECT(v.to_bool().has_value());
|
||||||
EXPECT(v.to_bool().value());
|
EXPECT(v.to_bool().value());
|
||||||
|
@ -228,7 +228,7 @@ TEST_CASE(float_value)
|
||||||
|
|
||||||
EXPECT(v.to_int().has_value());
|
EXPECT(v.to_int().has_value());
|
||||||
EXPECT_EQ(v.to_int().value(), 0);
|
EXPECT_EQ(v.to_int().value(), 0);
|
||||||
EXPECT_EQ(v.to_string(), "0"sv);
|
EXPECT_EQ(v.to_deprecated_string(), "0"sv);
|
||||||
|
|
||||||
EXPECT(v.to_bool().has_value());
|
EXPECT(v.to_bool().has_value());
|
||||||
EXPECT(!v.to_bool().value());
|
EXPECT(!v.to_bool().value());
|
||||||
|
@ -307,7 +307,7 @@ TEST_CASE(bool_value)
|
||||||
|
|
||||||
EXPECT(v.to_int().has_value());
|
EXPECT(v.to_int().has_value());
|
||||||
EXPECT_EQ(v.to_int().value(), 1);
|
EXPECT_EQ(v.to_int().value(), 1);
|
||||||
EXPECT_EQ(v.to_string(), "true"sv);
|
EXPECT_EQ(v.to_deprecated_string(), "true"sv);
|
||||||
|
|
||||||
EXPECT(v.to_double().has_value());
|
EXPECT(v.to_double().has_value());
|
||||||
EXPECT((v.to_double().value() - 1.0) < NumericLimits<double>().epsilon());
|
EXPECT((v.to_double().value() - 1.0) < NumericLimits<double>().epsilon());
|
||||||
|
@ -321,7 +321,7 @@ TEST_CASE(bool_value)
|
||||||
|
|
||||||
EXPECT(v.to_int().has_value());
|
EXPECT(v.to_int().has_value());
|
||||||
EXPECT_EQ(v.to_int().value(), 0);
|
EXPECT_EQ(v.to_int().value(), 0);
|
||||||
EXPECT_EQ(v.to_string(), "false"sv);
|
EXPECT_EQ(v.to_deprecated_string(), "false"sv);
|
||||||
|
|
||||||
EXPECT(v.to_double().has_value());
|
EXPECT(v.to_double().has_value());
|
||||||
EXPECT(v.to_double().value() < NumericLimits<double>().epsilon());
|
EXPECT(v.to_double().value() < NumericLimits<double>().epsilon());
|
||||||
|
@ -335,7 +335,7 @@ TEST_CASE(bool_value)
|
||||||
|
|
||||||
EXPECT(v.to_int().has_value());
|
EXPECT(v.to_int().has_value());
|
||||||
EXPECT_EQ(v.to_int().value(), 1);
|
EXPECT_EQ(v.to_int().value(), 1);
|
||||||
EXPECT_EQ(v.to_string(), "true"sv);
|
EXPECT_EQ(v.to_deprecated_string(), "true"sv);
|
||||||
|
|
||||||
EXPECT(v.to_double().has_value());
|
EXPECT(v.to_double().has_value());
|
||||||
EXPECT((v.to_double().value() - 1.0) < NumericLimits<double>().epsilon());
|
EXPECT((v.to_double().value() - 1.0) < NumericLimits<double>().epsilon());
|
||||||
|
|
|
@ -113,7 +113,7 @@ TESTJS_GLOBAL_FUNCTION(parse_webassembly_module, parseWebAssemblyModule)
|
||||||
};
|
};
|
||||||
auto result = Wasm::Module::parse(stream);
|
auto result = Wasm::Module::parse(stream);
|
||||||
if (result.is_error())
|
if (result.is_error())
|
||||||
return vm.throw_completion<JS::SyntaxError>(Wasm::parse_error_to_string(result.error()));
|
return vm.throw_completion<JS::SyntaxError>(Wasm::parse_error_to_deprecated_string(result.error()));
|
||||||
|
|
||||||
if (stream.handle_any_error())
|
if (stream.handle_any_error())
|
||||||
return vm.throw_completion<JS::SyntaxError>("Binary stream contained errors");
|
return vm.throw_completion<JS::SyntaxError>("Binary stream contained errors");
|
||||||
|
|
|
@ -81,7 +81,7 @@ static u32 hash_tokens(Vector<Token> const& tokens)
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
for (auto& token : tokens)
|
for (auto& token : tokens)
|
||||||
builder.append(token.to_string());
|
builder.append(token.to_deprecated_string());
|
||||||
return (u32)builder.string_view().hash();
|
return (u32)builder.string_view().hash();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ TESTJS_RUN_FILE_FUNCTION(DeprecatedString const&, JS::Interpreter& interpreter,
|
||||||
auto result = Test::JS::parse_script(name, interpreter.realm());
|
auto result = Test::JS::parse_script(name, interpreter.realm());
|
||||||
if (result.is_error()) {
|
if (result.is_error()) {
|
||||||
warnln("Unable to parse {}", name);
|
warnln("Unable to parse {}", name);
|
||||||
warnln("{}", result.error().error.to_string());
|
warnln("{}", result.error().error.to_deprecated_string());
|
||||||
warnln("{}", result.error().hint);
|
warnln("{}", result.error().hint);
|
||||||
Test::cleanup_and_exit();
|
Test::cleanup_and_exit();
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ GUI::Variant ClipboardHistoryModel::data(const GUI::ModelIndex& index, GUI::Mode
|
||||||
builder.append(bpp_for_format_resilient(data_and_type.metadata.get("format").value_or("0")));
|
builder.append(bpp_for_format_resilient(data_and_type.metadata.get("format").value_or("0")));
|
||||||
builder.append(']');
|
builder.append(']');
|
||||||
builder.append(" bitmap"sv);
|
builder.append(" bitmap"sv);
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
if (data_and_type.mime_type.starts_with("glyph/"sv)) {
|
if (data_and_type.mime_type.starts_with("glyph/"sv)) {
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
|
@ -96,7 +96,7 @@ GUI::Variant ClipboardHistoryModel::data(const GUI::ModelIndex& index, GUI::Mode
|
||||||
builder.append_code_point(start);
|
builder.append_code_point(start);
|
||||||
builder.appendff(") [{}x{}]", width, height);
|
builder.appendff(") [{}x{}]", width, height);
|
||||||
}
|
}
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
return "<...>";
|
return "<...>";
|
||||||
case Column::Type:
|
case Column::Type:
|
||||||
|
@ -104,7 +104,7 @@ GUI::Variant ClipboardHistoryModel::data(const GUI::ModelIndex& index, GUI::Mode
|
||||||
case Column::Size:
|
case Column::Size:
|
||||||
return AK::human_readable_size(data_and_type.data.size());
|
return AK::human_readable_size(data_and_type.data.size());
|
||||||
case Column::Time:
|
case Column::Time:
|
||||||
return time.to_string();
|
return time.to_deprecated_string();
|
||||||
default:
|
default:
|
||||||
VERIFY_NOT_REACHED();
|
VERIFY_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,13 +122,13 @@ private:
|
||||||
auto json = JsonValue::from_string(file_contents_or_error.value());
|
auto json = JsonValue::from_string(file_contents_or_error.value());
|
||||||
|
|
||||||
if (json.is_error())
|
if (json.is_error())
|
||||||
return adapter_info.to_string();
|
return adapter_info.to_deprecated_string();
|
||||||
|
|
||||||
int connected_adapters = 0;
|
int connected_adapters = 0;
|
||||||
json.value().as_array().for_each([&adapter_info, &connected_adapters](auto& value) {
|
json.value().as_array().for_each([&adapter_info, &connected_adapters](auto& value) {
|
||||||
auto& if_object = value.as_object();
|
auto& if_object = value.as_object();
|
||||||
auto ip_address = if_object.get("ipv4_address"sv).as_string_or("no IP");
|
auto ip_address = if_object.get("ipv4_address"sv).as_string_or("no IP");
|
||||||
auto ifname = if_object.get("name"sv).to_string();
|
auto ifname = if_object.get("name"sv).to_deprecated_string();
|
||||||
auto link_up = if_object.get("link_up"sv).as_bool();
|
auto link_up = if_object.get("link_up"sv).as_bool();
|
||||||
auto link_speed = if_object.get("link_speed"sv).to_i32();
|
auto link_speed = if_object.get("link_speed"sv).to_i32();
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ private:
|
||||||
// show connected icon so long as at least one adapter is connected
|
// show connected icon so long as at least one adapter is connected
|
||||||
connected_adapters ? set_connected(true) : set_connected(false);
|
connected_adapters ? set_connected(true) : set_connected(false);
|
||||||
|
|
||||||
return adapter_info.to_string();
|
return adapter_info.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
DeprecatedString m_adapter_info;
|
DeprecatedString m_adapter_info;
|
||||||
|
|
|
@ -130,7 +130,7 @@ void AnalogClock::paint_event(GUI::PaintEvent& event)
|
||||||
|
|
||||||
void AnalogClock::update_title_date()
|
void AnalogClock::update_title_date()
|
||||||
{
|
{
|
||||||
window()->set_title(Core::DateTime::now().to_string("%Y-%m-%d"sv));
|
window()->set_title(Core::DateTime::now().to_deprecated_string("%Y-%m-%d"sv));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnalogClock::context_menu_event(GUI::ContextMenuEvent& event)
|
void AnalogClock::context_menu_event(GUI::ContextMenuEvent& event)
|
||||||
|
|
|
@ -26,7 +26,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
|
|
||||||
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-analog-clock"sv));
|
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-analog-clock"sv));
|
||||||
auto window = TRY(GUI::Window::try_create());
|
auto window = TRY(GUI::Window::try_create());
|
||||||
window->set_title(Core::DateTime::now().to_string("%Y-%m-%d"sv));
|
window->set_title(Core::DateTime::now().to_deprecated_string("%Y-%m-%d"sv));
|
||||||
window->set_icon(app_icon.bitmap_for_size(16));
|
window->set_icon(app_icon.bitmap_for_size(16));
|
||||||
window->resize(170, 170);
|
window->resize(170, 170);
|
||||||
window->set_resizable(false);
|
window->set_resizable(false);
|
||||||
|
|
|
@ -115,7 +115,7 @@ private:
|
||||||
class URLResult final : public Result {
|
class URLResult final : public Result {
|
||||||
public:
|
public:
|
||||||
explicit URLResult(const URL& url)
|
explicit URLResult(const URL& url)
|
||||||
: Result(url.to_string(), "Open URL in Browser"sv, 50)
|
: Result(url.to_deprecated_string(), "Open URL in Browser"sv, 50)
|
||||||
, m_bitmap(GUI::Icon::default_icon("app-browser"sv).bitmap_for_size(16))
|
, m_bitmap(GUI::Icon::default_icon("app-browser"sv).bitmap_for_size(16))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,8 +186,8 @@ void BookmarksBarWidget::model_did_update(unsigned)
|
||||||
int width = 0;
|
int width = 0;
|
||||||
for (int item_index = 0; item_index < model()->row_count(); ++item_index) {
|
for (int item_index = 0; item_index < model()->row_count(); ++item_index) {
|
||||||
|
|
||||||
auto title = model()->index(item_index, 0).data().to_string();
|
auto title = model()->index(item_index, 0).data().to_deprecated_string();
|
||||||
auto url = model()->index(item_index, 1).data().to_string();
|
auto url = model()->index(item_index, 1).data().to_deprecated_string();
|
||||||
|
|
||||||
Gfx::IntRect rect { width, 0, font().width(title) + 32, height() };
|
Gfx::IntRect rect { width, 0, font().width(title) + 32, height() };
|
||||||
|
|
||||||
|
@ -263,8 +263,8 @@ bool BookmarksBarWidget::contains_bookmark(DeprecatedString const& url)
|
||||||
{
|
{
|
||||||
for (int item_index = 0; item_index < model()->row_count(); ++item_index) {
|
for (int item_index = 0; item_index < model()->row_count(); ++item_index) {
|
||||||
|
|
||||||
auto item_title = model()->index(item_index, 0).data().to_string();
|
auto item_title = model()->index(item_index, 0).data().to_deprecated_string();
|
||||||
auto item_url = model()->index(item_index, 1).data().to_string();
|
auto item_url = model()->index(item_index, 1).data().to_deprecated_string();
|
||||||
if (item_url == url) {
|
if (item_url == url) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -276,8 +276,8 @@ bool BookmarksBarWidget::remove_bookmark(DeprecatedString const& url)
|
||||||
{
|
{
|
||||||
for (int item_index = 0; item_index < model()->row_count(); ++item_index) {
|
for (int item_index = 0; item_index < model()->row_count(); ++item_index) {
|
||||||
|
|
||||||
auto item_title = model()->index(item_index, 0).data().to_string();
|
auto item_title = model()->index(item_index, 0).data().to_deprecated_string();
|
||||||
auto item_url = model()->index(item_index, 1).data().to_string();
|
auto item_url = model()->index(item_index, 1).data().to_deprecated_string();
|
||||||
if (item_url == url) {
|
if (item_url == url) {
|
||||||
auto& json_model = *static_cast<GUI::JsonArrayModel*>(model());
|
auto& json_model = *static_cast<GUI::JsonArrayModel*>(model());
|
||||||
|
|
||||||
|
@ -309,8 +309,8 @@ bool BookmarksBarWidget::add_bookmark(DeprecatedString const& url, DeprecatedStr
|
||||||
bool BookmarksBarWidget::edit_bookmark(DeprecatedString const& url)
|
bool BookmarksBarWidget::edit_bookmark(DeprecatedString const& url)
|
||||||
{
|
{
|
||||||
for (int item_index = 0; item_index < model()->row_count(); ++item_index) {
|
for (int item_index = 0; item_index < model()->row_count(); ++item_index) {
|
||||||
auto item_title = model()->index(item_index, 0).data().to_string();
|
auto item_title = model()->index(item_index, 0).data().to_deprecated_string();
|
||||||
auto item_url = model()->index(item_index, 1).data().to_string();
|
auto item_url = model()->index(item_index, 1).data().to_deprecated_string();
|
||||||
|
|
||||||
if (item_url == url) {
|
if (item_url == url) {
|
||||||
auto values = BookmarkEditor::edit_bookmark(window(), item_title, item_url);
|
auto values = BookmarkEditor::edit_bookmark(window(), item_title, item_url);
|
||||||
|
|
|
@ -51,7 +51,7 @@ static DeprecatedString bookmarks_file_path()
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
builder.append(Core::StandardPaths::config_directory());
|
builder.append(Core::StandardPaths::config_directory());
|
||||||
builder.append("/bookmarks.json"sv);
|
builder.append("/bookmarks.json"sv);
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
static DeprecatedString search_engines_file_path()
|
static DeprecatedString search_engines_file_path()
|
||||||
|
@ -59,7 +59,7 @@ static DeprecatedString search_engines_file_path()
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
builder.append(Core::StandardPaths::config_directory());
|
builder.append(Core::StandardPaths::config_directory());
|
||||||
builder.append("/SearchEngines.json"sv);
|
builder.append("/SearchEngines.json"sv);
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
BrowserWindow::BrowserWindow(CookieJar& cookie_jar, URL url)
|
BrowserWindow::BrowserWindow(CookieJar& cookie_jar, URL url)
|
||||||
|
@ -479,8 +479,8 @@ ErrorOr<void> BrowserWindow::load_search_engines(GUI::Menu& settings_menu)
|
||||||
if (!json_item.is_object())
|
if (!json_item.is_object())
|
||||||
continue;
|
continue;
|
||||||
auto search_engine = json_item.as_object();
|
auto search_engine = json_item.as_object();
|
||||||
auto name = search_engine.get("title"sv).to_string();
|
auto name = search_engine.get("title"sv).to_deprecated_string();
|
||||||
auto url_format = search_engine.get("url_format"sv).to_string();
|
auto url_format = search_engine.get("url_format"sv).to_deprecated_string();
|
||||||
|
|
||||||
auto action = GUI::Action::create_checkable(
|
auto action = GUI::Action::create_checkable(
|
||||||
name, [&, url_format](auto&) {
|
name, [&, url_format](auto&) {
|
||||||
|
@ -543,7 +543,7 @@ void BrowserWindow::set_window_title_for_tab(Tab const& tab)
|
||||||
{
|
{
|
||||||
auto& title = tab.title();
|
auto& title = tab.title();
|
||||||
auto url = tab.url();
|
auto url = tab.url();
|
||||||
set_title(DeprecatedString::formatted("{} - Browser", title.is_empty() ? url.to_string() : title));
|
set_title(DeprecatedString::formatted("{} - Browser", title.is_empty() ? url.to_deprecated_string() : title));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserWindow::create_new_tab(URL url, bool activate)
|
void BrowserWindow::create_new_tab(URL url, bool activate)
|
||||||
|
@ -742,7 +742,7 @@ ErrorOr<void> BrowserWindow::take_screenshot(ScreenshotType type)
|
||||||
return Error::from_string_view("Failed to take a screenshot of the current tab"sv);
|
return Error::from_string_view("Failed to take a screenshot of the current tab"sv);
|
||||||
|
|
||||||
LexicalPath path { Core::StandardPaths::downloads_directory() };
|
LexicalPath path { Core::StandardPaths::downloads_directory() };
|
||||||
path = path.append(Core::DateTime::now().to_string("screenshot-%Y-%m-%d-%H-%M-%S.png"sv));
|
path = path.append(Core::DateTime::now().to_deprecated_string("screenshot-%Y-%m-%d-%H-%M-%S.png"sv));
|
||||||
|
|
||||||
auto encoded = Gfx::PNGWriter::encode(*bitmap.bitmap());
|
auto encoded = Gfx::PNGWriter::encode(*bitmap.bitmap());
|
||||||
|
|
||||||
|
|
|
@ -92,9 +92,9 @@ void CookieJar::dump_cookies() const
|
||||||
builder.appendff("{}{}{}\n", key_color, cookie.key.path, no_color);
|
builder.appendff("{}{}{}\n", key_color, cookie.key.path, no_color);
|
||||||
|
|
||||||
builder.appendff("\t{}Value{} = {}\n", attribute_color, no_color, cookie.value.value);
|
builder.appendff("\t{}Value{} = {}\n", attribute_color, no_color, cookie.value.value);
|
||||||
builder.appendff("\t{}CreationTime{} = {}\n", attribute_color, no_color, cookie.value.creation_time.to_string());
|
builder.appendff("\t{}CreationTime{} = {}\n", attribute_color, no_color, cookie.value.creation_time.to_deprecated_string());
|
||||||
builder.appendff("\t{}LastAccessTime{} = {}\n", attribute_color, no_color, cookie.value.last_access_time.to_string());
|
builder.appendff("\t{}LastAccessTime{} = {}\n", attribute_color, no_color, cookie.value.last_access_time.to_deprecated_string());
|
||||||
builder.appendff("\t{}ExpiryTime{} = {}\n", attribute_color, no_color, cookie.value.expiry_time.to_string());
|
builder.appendff("\t{}ExpiryTime{} = {}\n", attribute_color, no_color, cookie.value.expiry_time.to_deprecated_string());
|
||||||
builder.appendff("\t{}Secure{} = {:s}\n", attribute_color, no_color, cookie.value.secure);
|
builder.appendff("\t{}Secure{} = {:s}\n", attribute_color, no_color, cookie.value.secure);
|
||||||
builder.appendff("\t{}HttpOnly{} = {:s}\n", attribute_color, no_color, cookie.value.http_only);
|
builder.appendff("\t{}HttpOnly{} = {:s}\n", attribute_color, no_color, cookie.value.http_only);
|
||||||
builder.appendff("\t{}HostOnly{} = {:s}\n", attribute_color, no_color, cookie.value.host_only);
|
builder.appendff("\t{}HostOnly{} = {:s}\n", attribute_color, no_color, cookie.value.host_only);
|
||||||
|
|
|
@ -80,7 +80,7 @@ GUI::Variant CookiesModel::data(GUI::ModelIndex const& index, GUI::ModelRole rol
|
||||||
case Column::Value:
|
case Column::Value:
|
||||||
return cookie.value;
|
return cookie.value;
|
||||||
case Column::ExpiryTime:
|
case Column::ExpiryTime:
|
||||||
return cookie.expiry_time.to_string();
|
return cookie.expiry_time.to_deprecated_string();
|
||||||
case Column::SameSite:
|
case Column::SameSite:
|
||||||
return Web::Cookie::same_site_to_string(cookie.same_site);
|
return Web::Cookie::same_site_to_string(cookie.same_site);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ DownloadWidget::DownloadWidget(const URL& url)
|
||||||
builder.append(Core::StandardPaths::downloads_directory());
|
builder.append(Core::StandardPaths::downloads_directory());
|
||||||
builder.append('/');
|
builder.append('/');
|
||||||
builder.append(m_url.basename());
|
builder.append(m_url.basename());
|
||||||
m_destination_path = builder.to_string();
|
m_destination_path = builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto close_on_finish = Config::read_bool("Browser"sv, "Preferences"sv, "CloseDownloadWidgetOnFinish"sv, false);
|
auto close_on_finish = Config::read_bool("Browser"sv, "Preferences"sv, "CloseDownloadWidgetOnFinish"sv, false);
|
||||||
|
@ -129,7 +129,7 @@ void DownloadWidget::did_progress(Optional<u32> total_size, u32 downloaded_size)
|
||||||
builder.append("Downloaded "sv);
|
builder.append("Downloaded "sv);
|
||||||
builder.append(human_readable_size(downloaded_size));
|
builder.append(human_readable_size(downloaded_size));
|
||||||
builder.appendff(" in {} sec", m_elapsed_timer.elapsed() / 1000);
|
builder.appendff(" in {} sec", m_elapsed_timer.elapsed() / 1000);
|
||||||
m_progress_label->set_text(builder.to_string());
|
m_progress_label->set_text(builder.to_deprecated_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -142,7 +142,7 @@ void DownloadWidget::did_progress(Optional<u32> total_size, u32 downloaded_size)
|
||||||
}
|
}
|
||||||
builder.append(" of "sv);
|
builder.append(" of "sv);
|
||||||
builder.append(m_url.basename());
|
builder.append(m_url.basename());
|
||||||
window()->set_title(builder.to_string());
|
window()->set_title(builder.to_deprecated_string());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ void InspectorWidget::set_selection(Selection selection)
|
||||||
auto* model = verify_cast<WebView::DOMTreeModel>(m_dom_tree_view->model());
|
auto* model = verify_cast<WebView::DOMTreeModel>(m_dom_tree_view->model());
|
||||||
auto index = model->index_for_node(selection.dom_node_id, selection.pseudo_element);
|
auto index = model->index_for_node(selection.dom_node_id, selection.pseudo_element);
|
||||||
if (!index.is_valid()) {
|
if (!index.is_valid()) {
|
||||||
dbgln("InspectorWidget told to inspect non-existent node: {}", selection.to_string());
|
dbgln("InspectorWidget told to inspect non-existent node: {}", selection.to_deprecated_string());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ void InspectorWidget::clear_dom_json()
|
||||||
void InspectorWidget::set_dom_node_properties_json(Selection selection, DeprecatedString specified_values_json, DeprecatedString computed_values_json, DeprecatedString custom_properties_json, DeprecatedString node_box_sizing_json)
|
void InspectorWidget::set_dom_node_properties_json(Selection selection, DeprecatedString specified_values_json, DeprecatedString computed_values_json, DeprecatedString custom_properties_json, DeprecatedString node_box_sizing_json)
|
||||||
{
|
{
|
||||||
if (selection != m_selection) {
|
if (selection != m_selection) {
|
||||||
dbgln("Got data for the wrong node id! Wanted ({}), got ({})", m_selection.to_string(), selection.to_string());
|
dbgln("Got data for the wrong node id! Wanted ({}), got ({})", m_selection.to_deprecated_string(), selection.to_deprecated_string());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ public:
|
||||||
return dom_node_id == other.dom_node_id && pseudo_element == other.pseudo_element;
|
return dom_node_id == other.dom_node_id && pseudo_element == other.pseudo_element;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeprecatedString to_string() const
|
DeprecatedString to_deprecated_string() const
|
||||||
{
|
{
|
||||||
if (pseudo_element.has_value())
|
if (pseudo_element.has_value())
|
||||||
return DeprecatedString::formatted("id: {}, pseudo: {}", dom_node_id, Web::CSS::pseudo_element_name(pseudo_element.value()));
|
return DeprecatedString::formatted("id: {}, pseudo: {}", dom_node_id, Web::CSS::pseudo_element_name(pseudo_element.value()));
|
||||||
|
|
|
@ -77,7 +77,7 @@ void Tab::view_source(const URL& url, DeprecatedString const& source)
|
||||||
editor.set_syntax_highlighter(make<Web::HTML::SyntaxHighlighter>());
|
editor.set_syntax_highlighter(make<Web::HTML::SyntaxHighlighter>());
|
||||||
editor.set_ruler_visible(true);
|
editor.set_ruler_visible(true);
|
||||||
window->resize(640, 480);
|
window->resize(640, 480);
|
||||||
window->set_title(url.to_string());
|
window->set_title(url.to_deprecated_string());
|
||||||
window->set_icon(g_icon_bag.filetype_text);
|
window->set_icon(g_icon_bag.filetype_text);
|
||||||
window->set_window_mode(GUI::WindowMode::Modeless);
|
window->set_window_mode(GUI::WindowMode::Modeless);
|
||||||
window->show();
|
window->show();
|
||||||
|
@ -137,7 +137,7 @@ Tab::Tab(BrowserWindow& window)
|
||||||
m_go_back_context_menu = GUI::Menu::construct();
|
m_go_back_context_menu = GUI::Menu::construct();
|
||||||
for (auto& url : m_history.get_back_title_history()) {
|
for (auto& url : m_history.get_back_title_history()) {
|
||||||
i++;
|
i++;
|
||||||
m_go_back_context_menu->add_action(GUI::Action::create(url.to_string(), g_icon_bag.filetype_html, [this, i](auto&) { go_back(i); }));
|
m_go_back_context_menu->add_action(GUI::Action::create(url.to_deprecated_string(), g_icon_bag.filetype_html, [this, i](auto&) { go_back(i); }));
|
||||||
}
|
}
|
||||||
m_go_back_context_menu->popup(go_back_button.screen_relative_rect().bottom_left());
|
m_go_back_context_menu->popup(go_back_button.screen_relative_rect().bottom_left());
|
||||||
};
|
};
|
||||||
|
@ -150,7 +150,7 @@ Tab::Tab(BrowserWindow& window)
|
||||||
m_go_forward_context_menu = GUI::Menu::construct();
|
m_go_forward_context_menu = GUI::Menu::construct();
|
||||||
for (auto& url : m_history.get_forward_title_history()) {
|
for (auto& url : m_history.get_forward_title_history()) {
|
||||||
i++;
|
i++;
|
||||||
m_go_forward_context_menu->add_action(GUI::Action::create(url.to_string(), g_icon_bag.filetype_html, [this, i](auto&) { go_forward(i); }));
|
m_go_forward_context_menu->add_action(GUI::Action::create(url.to_deprecated_string(), g_icon_bag.filetype_html, [this, i](auto&) { go_forward(i); }));
|
||||||
}
|
}
|
||||||
m_go_forward_context_menu->popup(go_forward_button.screen_relative_rect().bottom_left());
|
m_go_forward_context_menu->popup(go_forward_button.screen_relative_rect().bottom_left());
|
||||||
};
|
};
|
||||||
|
@ -215,7 +215,7 @@ Tab::Tab(BrowserWindow& window)
|
||||||
update_status();
|
update_status();
|
||||||
|
|
||||||
m_location_box->set_icon(nullptr);
|
m_location_box->set_icon(nullptr);
|
||||||
m_location_box->set_text(url.to_string());
|
m_location_box->set_text(url.to_deprecated_string());
|
||||||
|
|
||||||
// don't add to history if back or forward is pressed
|
// don't add to history if back or forward is pressed
|
||||||
if (!m_is_history_navigation)
|
if (!m_is_history_navigation)
|
||||||
|
@ -223,7 +223,7 @@ Tab::Tab(BrowserWindow& window)
|
||||||
m_is_history_navigation = false;
|
m_is_history_navigation = false;
|
||||||
|
|
||||||
update_actions();
|
update_actions();
|
||||||
update_bookmark_button(url.to_string());
|
update_bookmark_button(url.to_deprecated_string());
|
||||||
|
|
||||||
if (m_dom_inspector_widget)
|
if (m_dom_inspector_widget)
|
||||||
m_dom_inspector_widget->clear_dom_json();
|
m_dom_inspector_widget->clear_dom_json();
|
||||||
|
@ -309,7 +309,7 @@ Tab::Tab(BrowserWindow& window)
|
||||||
}));
|
}));
|
||||||
m_link_context_menu->add_separator();
|
m_link_context_menu->add_separator();
|
||||||
m_link_context_menu->add_action(GUI::Action::create("&Copy URL", g_icon_bag.copy, [this](auto&) {
|
m_link_context_menu->add_action(GUI::Action::create("&Copy URL", g_icon_bag.copy, [this](auto&) {
|
||||||
GUI::Clipboard::the().set_plain_text(m_link_context_menu_url.to_string());
|
GUI::Clipboard::the().set_plain_text(m_link_context_menu_url.to_deprecated_string());
|
||||||
}));
|
}));
|
||||||
m_link_context_menu->add_separator();
|
m_link_context_menu->add_separator();
|
||||||
m_link_context_menu->add_action(GUI::Action::create("&Download", g_icon_bag.download, [this](auto&) {
|
m_link_context_menu->add_action(GUI::Action::create("&Download", g_icon_bag.download, [this](auto&) {
|
||||||
|
@ -336,7 +336,7 @@ Tab::Tab(BrowserWindow& window)
|
||||||
GUI::Clipboard::the().set_bitmap(*m_image_context_menu_bitmap.bitmap());
|
GUI::Clipboard::the().set_bitmap(*m_image_context_menu_bitmap.bitmap());
|
||||||
}));
|
}));
|
||||||
m_image_context_menu->add_action(GUI::Action::create("Copy Image &URL", g_icon_bag.copy, [this](auto&) {
|
m_image_context_menu->add_action(GUI::Action::create("Copy Image &URL", g_icon_bag.copy, [this](auto&) {
|
||||||
GUI::Clipboard::the().set_plain_text(m_image_context_menu_url.to_string());
|
GUI::Clipboard::the().set_plain_text(m_image_context_menu_url.to_deprecated_string());
|
||||||
}));
|
}));
|
||||||
m_image_context_menu->add_separator();
|
m_image_context_menu->add_separator();
|
||||||
m_image_context_menu->add_action(GUI::Action::create("&Download", g_icon_bag.download, [this](auto&) {
|
m_image_context_menu->add_action(GUI::Action::create("&Download", g_icon_bag.download, [this](auto&) {
|
||||||
|
@ -357,8 +357,8 @@ Tab::Tab(BrowserWindow& window)
|
||||||
|
|
||||||
view().on_title_change = [this](auto& title) {
|
view().on_title_change = [this](auto& title) {
|
||||||
if (title.is_null()) {
|
if (title.is_null()) {
|
||||||
m_history.update_title(url().to_string());
|
m_history.update_title(url().to_deprecated_string());
|
||||||
m_title = url().to_string();
|
m_title = url().to_deprecated_string();
|
||||||
} else {
|
} else {
|
||||||
m_history.update_title(title);
|
m_history.update_title(title);
|
||||||
m_title = title;
|
m_title = title;
|
||||||
|
@ -436,7 +436,7 @@ Tab::Tab(BrowserWindow& window)
|
||||||
|
|
||||||
view().on_link_hover = [this](auto& url) {
|
view().on_link_hover = [this](auto& url) {
|
||||||
if (url.is_valid())
|
if (url.is_valid())
|
||||||
update_status(url.to_string());
|
update_status(url.to_deprecated_string());
|
||||||
else
|
else
|
||||||
update_status();
|
update_status();
|
||||||
};
|
};
|
||||||
|
@ -495,7 +495,7 @@ Optional<URL> Tab::url_from_location_bar(MayAppendTLD may_append_tld)
|
||||||
builder.append(".com"sv);
|
builder.append(".com"sv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DeprecatedString final_text = builder.to_string();
|
DeprecatedString final_text = builder.to_deprecated_string();
|
||||||
|
|
||||||
auto url = url_from_user_input(final_text);
|
auto url = url_from_user_input(final_text);
|
||||||
return url;
|
return url;
|
||||||
|
@ -543,7 +543,7 @@ void Tab::update_actions()
|
||||||
|
|
||||||
void Tab::bookmark_current_url()
|
void Tab::bookmark_current_url()
|
||||||
{
|
{
|
||||||
auto url = this->url().to_string();
|
auto url = this->url().to_deprecated_string();
|
||||||
if (BookmarksBarWidget::the().contains_bookmark(url)) {
|
if (BookmarksBarWidget::the().contains_bookmark(url)) {
|
||||||
BookmarksBarWidget::the().remove_bookmark(url);
|
BookmarksBarWidget::the().remove_bookmark(url);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -106,7 +106,7 @@ BrowserSettingsWidget::BrowserSettingsWidget()
|
||||||
m_search_engine_combobox->set_model(move(search_engines_model));
|
m_search_engine_combobox->set_model(move(search_engines_model));
|
||||||
m_search_engine_combobox->set_only_allow_values_from_model(true);
|
m_search_engine_combobox->set_only_allow_values_from_model(true);
|
||||||
m_search_engine_combobox->on_change = [this](AK::DeprecatedString const&, GUI::ModelIndex const& cursor_index) {
|
m_search_engine_combobox->on_change = [this](AK::DeprecatedString const&, GUI::ModelIndex const& cursor_index) {
|
||||||
auto url_format = m_search_engine_combobox->model()->index(cursor_index.row(), 1).data().to_string();
|
auto url_format = m_search_engine_combobox->model()->index(cursor_index.row(), 1).data().to_deprecated_string();
|
||||||
m_is_custom_search_engine = url_format.is_empty();
|
m_is_custom_search_engine = url_format.is_empty();
|
||||||
m_custom_search_engine_group->set_enabled(m_is_custom_search_engine);
|
m_custom_search_engine_group->set_enabled(m_is_custom_search_engine);
|
||||||
set_modified(true);
|
set_modified(true);
|
||||||
|
@ -122,7 +122,7 @@ void BrowserSettingsWidget::set_color_scheme(StringView color_scheme)
|
||||||
{
|
{
|
||||||
bool found_color_scheme = false;
|
bool found_color_scheme = false;
|
||||||
for (int item_index = 0; item_index < m_color_scheme_combobox->model()->row_count(); ++item_index) {
|
for (int item_index = 0; item_index < m_color_scheme_combobox->model()->row_count(); ++item_index) {
|
||||||
auto scheme = m_color_scheme_combobox->model()->index(item_index, 1).data().to_string();
|
auto scheme = m_color_scheme_combobox->model()->index(item_index, 1).data().to_deprecated_string();
|
||||||
if (scheme == color_scheme) {
|
if (scheme == color_scheme) {
|
||||||
m_color_scheme_combobox->set_selected_index(item_index, GUI::AllowCallback::No);
|
m_color_scheme_combobox->set_selected_index(item_index, GUI::AllowCallback::No);
|
||||||
found_color_scheme = true;
|
found_color_scheme = true;
|
||||||
|
@ -146,7 +146,7 @@ void BrowserSettingsWidget::set_search_engine_url(StringView url)
|
||||||
|
|
||||||
bool found_url = false;
|
bool found_url = false;
|
||||||
for (int item_index = 0; item_index < m_search_engine_combobox->model()->row_count(); ++item_index) {
|
for (int item_index = 0; item_index < m_search_engine_combobox->model()->row_count(); ++item_index) {
|
||||||
auto url_format = m_search_engine_combobox->model()->index(item_index, 1).data().to_string();
|
auto url_format = m_search_engine_combobox->model()->index(item_index, 1).data().to_deprecated_string();
|
||||||
if (url_format == url) {
|
if (url_format == url) {
|
||||||
m_search_engine_combobox->set_selected_index(item_index, GUI::AllowCallback::No);
|
m_search_engine_combobox->set_selected_index(item_index, GUI::AllowCallback::No);
|
||||||
found_url = true;
|
found_url = true;
|
||||||
|
@ -189,7 +189,7 @@ void BrowserSettingsWidget::apply_settings()
|
||||||
Config::write_bool("Browser"sv, "Preferences"sv, "ShowBookmarksBar"sv, m_show_bookmarks_bar_checkbox->is_checked());
|
Config::write_bool("Browser"sv, "Preferences"sv, "ShowBookmarksBar"sv, m_show_bookmarks_bar_checkbox->is_checked());
|
||||||
|
|
||||||
auto color_scheme_index = m_color_scheme_combobox->selected_index();
|
auto color_scheme_index = m_color_scheme_combobox->selected_index();
|
||||||
auto color_scheme = m_color_scheme_combobox->model()->index(color_scheme_index, 1).data().to_string();
|
auto color_scheme = m_color_scheme_combobox->model()->index(color_scheme_index, 1).data().to_deprecated_string();
|
||||||
Config::write_string("Browser"sv, "Preferences"sv, "ColorScheme"sv, color_scheme);
|
Config::write_string("Browser"sv, "Preferences"sv, "ColorScheme"sv, color_scheme);
|
||||||
|
|
||||||
if (!m_enable_search_engine_checkbox->is_checked()) {
|
if (!m_enable_search_engine_checkbox->is_checked()) {
|
||||||
|
@ -198,7 +198,7 @@ void BrowserSettingsWidget::apply_settings()
|
||||||
Config::write_string("Browser"sv, "Preferences"sv, "SearchEngine"sv, m_custom_search_engine_textbox->text());
|
Config::write_string("Browser"sv, "Preferences"sv, "SearchEngine"sv, m_custom_search_engine_textbox->text());
|
||||||
} else {
|
} else {
|
||||||
auto selected_index = m_search_engine_combobox->selected_index();
|
auto selected_index = m_search_engine_combobox->selected_index();
|
||||||
auto url = m_search_engine_combobox->model()->index(selected_index, 1).data().to_string();
|
auto url = m_search_engine_combobox->model()->index(selected_index, 1).data().to_deprecated_string();
|
||||||
Config::write_string("Browser"sv, "Preferences"sv, "SearchEngine"sv, url);
|
Config::write_string("Browser"sv, "Preferences"sv, "SearchEngine"sv, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -146,7 +146,7 @@ void CalculatorWidget::mimic_pressed_button(RefPtr<GUI::Button> button)
|
||||||
|
|
||||||
void CalculatorWidget::update_display()
|
void CalculatorWidget::update_display()
|
||||||
{
|
{
|
||||||
m_entry->set_text(m_keypad.to_string());
|
m_entry->set_text(m_keypad.to_deprecated_string());
|
||||||
if (m_calculator.has_error())
|
if (m_calculator.has_error())
|
||||||
m_label->set_text("E");
|
m_label->set_text("E");
|
||||||
else
|
else
|
||||||
|
|
|
@ -112,10 +112,10 @@ void Keypad::set_to_0()
|
||||||
m_state = State::External;
|
m_state = State::External;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeprecatedString Keypad::to_string() const
|
DeprecatedString Keypad::to_deprecated_string() const
|
||||||
{
|
{
|
||||||
if (m_state == State::External)
|
if (m_state == State::External)
|
||||||
return m_internal_value.to_string(m_displayed_fraction_length);
|
return m_internal_value.to_deprecated_string(m_displayed_fraction_length);
|
||||||
|
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ DeprecatedString Keypad::to_string() const
|
||||||
builder.append(frac_value);
|
builder.append(frac_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Keypad::set_rounding_length(unsigned rounding_threshold)
|
void Keypad::set_rounding_length(unsigned rounding_threshold)
|
||||||
|
|
|
@ -33,7 +33,7 @@ public:
|
||||||
void set_rounding_length(unsigned);
|
void set_rounding_length(unsigned);
|
||||||
unsigned rounding_length() const;
|
unsigned rounding_length() const;
|
||||||
|
|
||||||
DeprecatedString to_string() const;
|
DeprecatedString to_deprecated_string() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Internal representation of the current decimal value.
|
// Internal representation of the current decimal value.
|
||||||
|
|
|
@ -54,7 +54,7 @@ CharacterMapWidget::CharacterMapWidget()
|
||||||
continue;
|
continue;
|
||||||
builder.append_code_point(code_point);
|
builder.append_code_point(code_point);
|
||||||
}
|
}
|
||||||
GUI::Clipboard::the().set_plain_text(builder.to_string());
|
GUI::Clipboard::the().set_plain_text(builder.to_deprecated_string());
|
||||||
});
|
});
|
||||||
m_copy_selection_action->set_status_tip("Copy the highlighted characters to the clipboard");
|
m_copy_selection_action->set_status_tip("Copy the highlighted characters to the clipboard");
|
||||||
|
|
||||||
|
@ -179,5 +179,5 @@ void CharacterMapWidget::update_statusbar()
|
||||||
builder.appendff("U+{:04X}", code_point);
|
builder.appendff("U+{:04X}", code_point);
|
||||||
if (auto display_name = Unicode::code_point_display_name(code_point); display_name.has_value())
|
if (auto display_name = Unicode::code_point_display_name(code_point); display_name.has_value())
|
||||||
builder.appendff(" - {}", display_name.value());
|
builder.appendff(" - {}", display_name.value());
|
||||||
m_statusbar->set_text(builder.to_string());
|
m_statusbar->set_text(builder.to_deprecated_string());
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,5 +119,5 @@ void ClockSettingsWidget::update_time_format_string()
|
||||||
|
|
||||||
void ClockSettingsWidget::update_clock_preview()
|
void ClockSettingsWidget::update_clock_preview()
|
||||||
{
|
{
|
||||||
m_clock_preview->set_text(Core::DateTime::now().to_string(m_time_format));
|
m_clock_preview->set_text(Core::DateTime::now().to_deprecated_string(m_time_format));
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,12 +90,12 @@ static TitleAndText build_backtrace(Coredump::Reader const& coredump, ELF::Core:
|
||||||
first_entry = false;
|
first_entry = false;
|
||||||
else
|
else
|
||||||
builder.append('\n');
|
builder.append('\n');
|
||||||
builder.append(entry.to_string());
|
builder.append(entry.to_deprecated_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
dbgln("--- Backtrace for thread #{} (TID {}) ---", thread_index, thread_info.tid);
|
dbgln("--- Backtrace for thread #{} (TID {}) ---", thread_index, thread_info.tid);
|
||||||
for (auto& entry : backtrace.entries()) {
|
for (auto& entry : backtrace.entries()) {
|
||||||
dbgln("{}", entry.to_string(true));
|
dbgln("{}", entry.to_deprecated_string(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -290,7 +290,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto file = file_or_error.value();
|
auto file = file_or_error.value();
|
||||||
if (!file->write(full_backtrace.to_string()))
|
if (!file->write(full_backtrace.to_deprecated_string()))
|
||||||
GUI::MessageBox::show(window, DeprecatedString::formatted("Couldn't save file: {}.", file_or_error.error()), "Saving backtrace failed"sv, GUI::MessageBox::Type::Error);
|
GUI::MessageBox::show(window, DeprecatedString::formatted("Couldn't save file: {}.", file_or_error.error()), "Saving backtrace failed"sv, GUI::MessageBox::Type::Error);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ static bool handle_disassemble_command(DeprecatedString const& command, FlatPtr
|
||||||
if (!insn.has_value())
|
if (!insn.has_value())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
outln(" {:p} <+{}>:\t{}", offset + first_instruction, offset, insn.value().to_string(offset));
|
outln(" {:p} <+{}>:\t{}", offset + first_instruction, offset, insn.value().to_deprecated_string(offset));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -72,7 +72,7 @@ void BackgroundSettingsWidget::create_frame()
|
||||||
m_context_menu->add_separator();
|
m_context_menu->add_separator();
|
||||||
m_copy_action = GUI::CommonActions::make_copy_action(
|
m_copy_action = GUI::CommonActions::make_copy_action(
|
||||||
[this](auto&) {
|
[this](auto&) {
|
||||||
auto url = URL::create_with_file_scheme(m_monitor_widget->wallpaper()).to_string();
|
auto url = URL::create_with_file_scheme(m_monitor_widget->wallpaper()).to_deprecated_string();
|
||||||
GUI::Clipboard::the().set_data(url.bytes(), "text/uri-list");
|
GUI::Clipboard::the().set_data(url.bytes(), "text/uri-list");
|
||||||
},
|
},
|
||||||
this);
|
this);
|
||||||
|
|
|
@ -148,7 +148,7 @@ void MonitorWidget::paint_event(GUI::PaintEvent& event)
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (!m_desktop_resolution.is_null()) {
|
if (!m_desktop_resolution.is_null()) {
|
||||||
auto displayed_resolution_string = Gfx::IntSize { m_desktop_resolution.width(), m_desktop_resolution.height() }.to_string();
|
auto displayed_resolution_string = Gfx::IntSize { m_desktop_resolution.width(), m_desktop_resolution.height() }.to_deprecated_string();
|
||||||
|
|
||||||
// Render text label scaled with scale factor to hint at its effect.
|
// Render text label scaled with scale factor to hint at its effect.
|
||||||
// FIXME: Once bitmaps have intrinsic scale factors, we could create a bitmap with an intrinsic scale factor of m_desktop_scale_factor
|
// FIXME: Once bitmaps have intrinsic scale factors, we could create a bitmap with an intrinsic scale factor of m_desktop_scale_factor
|
||||||
|
|
|
@ -533,7 +533,7 @@ Vector<DeprecatedString> DirectoryView::selected_file_paths() const
|
||||||
view.selection().for_each_index([&](GUI::ModelIndex const& index) {
|
view.selection().for_each_index([&](GUI::ModelIndex const& index) {
|
||||||
auto parent_index = model.parent_index(index);
|
auto parent_index = model.parent_index(index);
|
||||||
auto name_index = model.index(index.row(), GUI::FileSystemModel::Column::Name, parent_index);
|
auto name_index = model.index(index.row(), GUI::FileSystemModel::Column::Name, parent_index);
|
||||||
auto path = name_index.data(GUI::ModelRole::Custom).to_string();
|
auto path = name_index.data(GUI::ModelRole::Custom).to_deprecated_string();
|
||||||
paths.append(path);
|
paths.append(path);
|
||||||
});
|
});
|
||||||
return paths;
|
return paths;
|
||||||
|
|
|
@ -1312,7 +1312,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (auto result = Core::File::copy_file_or_directory(url_to_copy.path(), new_path); result.is_error()) {
|
if (auto result = Core::File::copy_file_or_directory(url_to_copy.path(), new_path); result.is_error()) {
|
||||||
auto error_message = DeprecatedString::formatted("Could not copy {} into {}:\n {}", url_to_copy.to_string(), new_path, static_cast<Error const&>(result.error()));
|
auto error_message = DeprecatedString::formatted("Could not copy {} into {}:\n {}", url_to_copy.to_deprecated_string(), new_path, static_cast<Error const&>(result.error()));
|
||||||
GUI::MessageBox::show(window, error_message, "File Manager"sv, GUI::MessageBox::Type::Error);
|
GUI::MessageBox::show(window, error_message, "File Manager"sv, GUI::MessageBox::Type::Error);
|
||||||
} else {
|
} else {
|
||||||
had_accepted_copy = true;
|
had_accepted_copy = true;
|
||||||
|
|
|
@ -325,7 +325,7 @@ ErrorOr<void> MainWidget::create_actions()
|
||||||
continue;
|
continue;
|
||||||
builder.append_code_point(code_point);
|
builder.append_code_point(code_point);
|
||||||
}
|
}
|
||||||
GUI::Clipboard::the().set_plain_text(builder.to_string());
|
GUI::Clipboard::the().set_plain_text(builder.to_deprecated_string());
|
||||||
});
|
});
|
||||||
m_copy_text_action->set_status_tip("Copy to clipboard as text");
|
m_copy_text_action->set_status_tip("Copy to clipboard as text");
|
||||||
|
|
||||||
|
@ -879,7 +879,7 @@ void MainWidget::update_title()
|
||||||
else
|
else
|
||||||
title.append(m_path);
|
title.append(m_path);
|
||||||
title.append("[*] - Font Editor"sv);
|
title.append("[*] - Font Editor"sv);
|
||||||
window()->set_title(title.to_string());
|
window()->set_title(title.to_deprecated_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::did_modify_font()
|
void MainWidget::did_modify_font()
|
||||||
|
@ -920,7 +920,7 @@ void MainWidget::update_statusbar()
|
||||||
builder.appendff(" [{}x{}]", m_edited_font->raw_glyph_width(glyph), m_edited_font->glyph_height());
|
builder.appendff(" [{}x{}]", m_edited_font->raw_glyph_width(glyph), m_edited_font->glyph_height());
|
||||||
else if (Gfx::Emoji::emoji_for_code_point(glyph))
|
else if (Gfx::Emoji::emoji_for_code_point(glyph))
|
||||||
builder.appendff(" [emoji]");
|
builder.appendff(" [emoji]");
|
||||||
m_statusbar->set_text(builder.to_string());
|
m_statusbar->set_text(builder.to_deprecated_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::update_preview()
|
void MainWidget::update_preview()
|
||||||
|
|
|
@ -131,7 +131,7 @@ MainWidget::MainWidget()
|
||||||
};
|
};
|
||||||
m_web_view->on_link_hover = [this](URL const& url) {
|
m_web_view->on_link_hover = [this](URL const& url) {
|
||||||
if (url.is_valid())
|
if (url.is_valid())
|
||||||
m_statusbar->set_text(url.to_string());
|
m_statusbar->set_text(url.to_deprecated_string());
|
||||||
else
|
else
|
||||||
m_statusbar->set_text({});
|
m_statusbar->set_text({});
|
||||||
};
|
};
|
||||||
|
|
|
@ -172,7 +172,7 @@ bool HexEditor::copy_selected_hex_to_clipboard()
|
||||||
for (size_t i = m_selection_start; i < m_selection_end; i++)
|
for (size_t i = m_selection_start; i < m_selection_end; i++)
|
||||||
output_string_builder.appendff("{:02X} ", m_document->get(i).value);
|
output_string_builder.appendff("{:02X} ", m_document->get(i).value);
|
||||||
|
|
||||||
GUI::Clipboard::the().set_plain_text(output_string_builder.to_string());
|
GUI::Clipboard::the().set_plain_text(output_string_builder.to_deprecated_string());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ bool HexEditor::copy_selected_text_to_clipboard()
|
||||||
for (size_t i = m_selection_start; i < m_selection_end; i++)
|
for (size_t i = m_selection_start; i < m_selection_end; i++)
|
||||||
output_string_builder.append(isprint(m_document->get(i).value) ? m_document->get(i).value : '.');
|
output_string_builder.append(isprint(m_document->get(i).value) ? m_document->get(i).value : '.');
|
||||||
|
|
||||||
GUI::Clipboard::the().set_plain_text(output_string_builder.to_string());
|
GUI::Clipboard::the().set_plain_text(output_string_builder.to_deprecated_string());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ bool HexEditor::copy_selected_hex_to_clipboard_as_c_code()
|
||||||
}
|
}
|
||||||
output_string_builder.append("\n};\n"sv);
|
output_string_builder.append("\n};\n"sv);
|
||||||
|
|
||||||
GUI::Clipboard::the().set_plain_text(output_string_builder.to_string());
|
GUI::Clipboard::the().set_plain_text(output_string_builder.to_deprecated_string());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -768,7 +768,7 @@ Vector<Match> HexEditor::find_all(ByteBuffer& needle, size_t start)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (found) {
|
if (found) {
|
||||||
matches.append({ i, DeprecatedString::formatted("{}", StringView { needle }.to_string().characters()) });
|
matches.append({ i, DeprecatedString::formatted("{}", StringView { needle }.to_deprecated_string().characters()) });
|
||||||
i += needle.size() - 1;
|
i += needle.size() - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -803,7 +803,7 @@ Vector<Match> HexEditor::find_all_strings(size_t min_length)
|
||||||
builder.append(c);
|
builder.append(c);
|
||||||
} else {
|
} else {
|
||||||
if (builder.length() >= min_length)
|
if (builder.length() >= min_length)
|
||||||
matches.append({ offset, builder.to_string() });
|
matches.append({ offset, builder.to_deprecated_string() });
|
||||||
builder.clear();
|
builder.clear();
|
||||||
found_string = false;
|
found_string = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -520,7 +520,7 @@ void HexEditorWidget::update_title()
|
||||||
else
|
else
|
||||||
builder.append(m_path);
|
builder.append(m_path);
|
||||||
builder.append("[*] - Hex Editor"sv);
|
builder.append("[*] - Hex Editor"sv);
|
||||||
window()->set_title(builder.to_string());
|
window()->set_title(builder.to_deprecated_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
void HexEditorWidget::open_file(NonnullRefPtr<Core::File> file)
|
void HexEditorWidget::open_file(NonnullRefPtr<Core::File> file)
|
||||||
|
|
|
@ -71,7 +71,7 @@ public:
|
||||||
VERIFY_NOT_REACHED();
|
VERIFY_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
DeprecatedString inspector_value_type_to_string(ValueType type) const
|
DeprecatedString inspector_value_type_to_deprecated_string(ValueType type) const
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case SignedByte:
|
case SignedByte:
|
||||||
|
@ -112,7 +112,7 @@ public:
|
||||||
if (role == GUI::ModelRole::Display) {
|
if (role == GUI::ModelRole::Display) {
|
||||||
switch (index.column()) {
|
switch (index.column()) {
|
||||||
case Column::Type:
|
case Column::Type:
|
||||||
return inspector_value_type_to_string(static_cast<ValueType>(index.row()));
|
return inspector_value_type_to_deprecated_string(static_cast<ValueType>(index.row()));
|
||||||
case Column::Value:
|
case Column::Value:
|
||||||
return m_values.at(index.row());
|
return m_values.at(index.row());
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
window->set_title(DeprecatedString::formatted("{} {} {}% - Image Viewer", widget->path(), widget->bitmap()->size().to_string(), (int)(scale * 100)));
|
window->set_title(DeprecatedString::formatted("{} {} {}% - Image Viewer", widget->path(), widget->bitmap()->size().to_deprecated_string(), (int)(scale * 100)));
|
||||||
|
|
||||||
if (!widget->scaled_for_first_image()) {
|
if (!widget->scaled_for_first_image()) {
|
||||||
widget->set_scaled_for_first_image(true);
|
widget->set_scaled_for_first_image(true);
|
||||||
|
|
|
@ -178,7 +178,7 @@ ErrorOr<void> KeyboardMapperWidget::save_to_file(StringView filename)
|
||||||
if (values[i])
|
if (values[i])
|
||||||
sb.append_code_point(values[i]);
|
sb.append_code_point(values[i]);
|
||||||
|
|
||||||
JsonValue val(sb.to_string());
|
JsonValue val(sb.to_deprecated_string());
|
||||||
items.append(move(val));
|
items.append(move(val));
|
||||||
}
|
}
|
||||||
map_json.set(name, move(items));
|
map_json.set(name, move(items));
|
||||||
|
@ -191,7 +191,7 @@ ErrorOr<void> KeyboardMapperWidget::save_to_file(StringView filename)
|
||||||
add_array("shift_altgr_map", m_character_map.shift_altgr_map);
|
add_array("shift_altgr_map", m_character_map.shift_altgr_map);
|
||||||
|
|
||||||
// Write to file.
|
// Write to file.
|
||||||
DeprecatedString file_content = map_json.to_string();
|
DeprecatedString file_content = map_json.to_deprecated_string();
|
||||||
auto file = TRY(Core::Stream::File::open(filename, Core::Stream::OpenMode::Write));
|
auto file = TRY(Core::Stream::File::open(filename, Core::Stream::OpenMode::Write));
|
||||||
TRY(file->write(file_content.bytes()));
|
TRY(file->write(file_content.bytes()));
|
||||||
file->close();
|
file->close();
|
||||||
|
@ -249,7 +249,7 @@ void KeyboardMapperWidget::set_current_map(const DeprecatedString current_map)
|
||||||
StringBuilder sb;
|
StringBuilder sb;
|
||||||
sb.append_code_point(map[index]);
|
sb.append_code_point(map[index]);
|
||||||
|
|
||||||
m_keys.at(k)->set_text(sb.to_string());
|
m_keys.at(k)->set_text(sb.to_deprecated_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
this->update();
|
this->update();
|
||||||
|
@ -261,7 +261,7 @@ void KeyboardMapperWidget::update_window_title()
|
||||||
sb.append(m_filename);
|
sb.append(m_filename);
|
||||||
sb.append("[*] - Keyboard Mapper"sv);
|
sb.append("[*] - Keyboard Mapper"sv);
|
||||||
|
|
||||||
window()->set_title(sb.to_string());
|
window()->set_title(sb.to_deprecated_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeyboardMapperWidget::show_error_to_user(Error error)
|
void KeyboardMapperWidget::show_error_to_user(Error error)
|
||||||
|
|
|
@ -161,7 +161,7 @@ KeyboardSettingsWidget::KeyboardSettingsWidget()
|
||||||
auto json = JsonValue::from_string(proc_keymap->read_all()).release_value_but_fixme_should_propagate_errors();
|
auto json = JsonValue::from_string(proc_keymap->read_all()).release_value_but_fixme_should_propagate_errors();
|
||||||
auto const& keymap_object = json.as_object();
|
auto const& keymap_object = json.as_object();
|
||||||
VERIFY(keymap_object.has("keymap"sv));
|
VERIFY(keymap_object.has("keymap"sv));
|
||||||
m_initial_active_keymap = keymap_object.get("keymap"sv).to_string();
|
m_initial_active_keymap = keymap_object.get("keymap"sv).to_deprecated_string();
|
||||||
dbgln("KeyboardSettings thinks the current keymap is: {}", m_initial_active_keymap);
|
dbgln("KeyboardSettings thinks the current keymap is: {}", m_initial_active_keymap);
|
||||||
|
|
||||||
auto mapper_config(Core::ConfigFile::open("/etc/Keyboard.ini").release_value_but_fixme_should_propagate_errors());
|
auto mapper_config(Core::ConfigFile::open("/etc/Keyboard.ini").release_value_but_fixme_should_propagate_errors());
|
||||||
|
|
|
@ -55,7 +55,7 @@ MailWidget::MailWidget()
|
||||||
|
|
||||||
m_web_view->on_link_hover = [this](auto& url) {
|
m_web_view->on_link_hover = [this](auto& url) {
|
||||||
if (url.is_valid())
|
if (url.is_valid())
|
||||||
m_statusbar->set_text(url.to_string());
|
m_statusbar->set_text(url.to_deprecated_string());
|
||||||
else
|
else
|
||||||
m_statusbar->set_text("");
|
m_statusbar->set_text("");
|
||||||
};
|
};
|
||||||
|
@ -68,7 +68,7 @@ MailWidget::MailWidget()
|
||||||
m_link_context_menu_default_action = link_default_action;
|
m_link_context_menu_default_action = link_default_action;
|
||||||
m_link_context_menu->add_separator();
|
m_link_context_menu->add_separator();
|
||||||
m_link_context_menu->add_action(GUI::Action::create("&Copy URL", [this](auto&) {
|
m_link_context_menu->add_action(GUI::Action::create("&Copy URL", [this](auto&) {
|
||||||
GUI::Clipboard::the().set_plain_text(m_link_context_menu_url.to_string());
|
GUI::Clipboard::the().set_plain_text(m_link_context_menu_url.to_deprecated_string());
|
||||||
}));
|
}));
|
||||||
|
|
||||||
m_web_view->on_link_context_menu_request = [this](auto& url, auto& screen_position) {
|
m_web_view->on_link_context_menu_request = [this](auto& url, auto& screen_position) {
|
||||||
|
@ -82,7 +82,7 @@ MailWidget::MailWidget()
|
||||||
GUI::Clipboard::the().set_bitmap(*m_image_context_menu_bitmap.bitmap());
|
GUI::Clipboard::the().set_bitmap(*m_image_context_menu_bitmap.bitmap());
|
||||||
}));
|
}));
|
||||||
m_image_context_menu->add_action(GUI::Action::create("Copy Image &URL", [this](auto&) {
|
m_image_context_menu->add_action(GUI::Action::create("Copy Image &URL", [this](auto&) {
|
||||||
GUI::Clipboard::the().set_plain_text(m_image_context_menu_url.to_string());
|
GUI::Clipboard::the().set_plain_text(m_image_context_menu_url.to_deprecated_string());
|
||||||
}));
|
}));
|
||||||
m_image_context_menu->add_separator();
|
m_image_context_menu->add_separator();
|
||||||
m_image_context_menu->add_action(GUI::Action::create("&Open Image in Browser", [this](auto&) {
|
m_image_context_menu->add_action(GUI::Action::create("&Open Image in Browser", [this](auto&) {
|
||||||
|
@ -347,7 +347,7 @@ void MailWidget::selected_mailbox()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return builder.to_string();
|
return builder.to_deprecated_string();
|
||||||
};
|
};
|
||||||
|
|
||||||
auto& subject_iterator_value = subject_iterator->get<1>().value();
|
auto& subject_iterator_value = subject_iterator->get<1>().value();
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue