mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 07:47:34 +00:00
Everywhere: Rename {Deprecated => Byte}String
This commit un-deprecates DeprecatedString, and repurposes it as a byte string. As the null state has already been removed, there are no other particularly hairy blockers in repurposing this type as a byte string (what it _really_ is). This commit is auto-generated: $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \ Meta Ports Ladybird Tests Kernel) $ perl -pie 's/\bDeprecatedString\b/ByteString/g; s/deprecated_string/byte_string/g' $xs $ clang-format --style=file -i \ $(git diff --name-only | grep \.cpp\|\.h) $ gn format $(git ls-files '*.gn' '*.gni')
This commit is contained in:
parent
38d62563b3
commit
5e1499d104
1615 changed files with 10257 additions and 10257 deletions
|
@ -39,7 +39,7 @@ ErrorOr<String> ClipboardHistoryModel::column_name(int column) const
|
|||
}
|
||||
}
|
||||
|
||||
static StringView bpp_for_format_resilient(DeprecatedString format)
|
||||
static StringView bpp_for_format_resilient(ByteString format)
|
||||
{
|
||||
unsigned format_uint = format.to_uint().value_or(static_cast<unsigned>(Gfx::BitmapFormat::Invalid));
|
||||
// Cannot use Gfx::Bitmap::bpp_for_format here, as we have to accept invalid enum values.
|
||||
|
@ -64,7 +64,7 @@ GUI::Variant ClipboardHistoryModel::data(const GUI::ModelIndex& index, GUI::Mode
|
|||
switch (index.column()) {
|
||||
case Column::Data:
|
||||
if (data_and_type.mime_type.starts_with("text/"sv))
|
||||
return DeprecatedString::copy(data_and_type.data);
|
||||
return ByteString::copy(data_and_type.data);
|
||||
if (data_and_type.mime_type == "image/x-serenityos") {
|
||||
StringBuilder builder;
|
||||
builder.append('[');
|
||||
|
@ -75,7 +75,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(']');
|
||||
builder.append(" bitmap"sv);
|
||||
return builder.to_deprecated_string();
|
||||
return builder.to_byte_string();
|
||||
}
|
||||
if (data_and_type.mime_type.starts_with("glyph/"sv)) {
|
||||
StringBuilder builder;
|
||||
|
@ -90,7 +90,7 @@ GUI::Variant ClipboardHistoryModel::data(const GUI::ModelIndex& index, GUI::Mode
|
|||
builder.append_code_point(start);
|
||||
builder.appendff(") [{}x{}]", width, height);
|
||||
}
|
||||
return builder.to_deprecated_string();
|
||||
return builder.to_byte_string();
|
||||
}
|
||||
return "<...>";
|
||||
case Column::Type:
|
||||
|
@ -98,13 +98,13 @@ GUI::Variant ClipboardHistoryModel::data(const GUI::ModelIndex& index, GUI::Mode
|
|||
case Column::Size:
|
||||
return AK::human_readable_size(data_and_type.data.size());
|
||||
case Column::Time:
|
||||
return time.to_deprecated_string();
|
||||
return time.to_byte_string();
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
void ClipboardHistoryModel::clipboard_content_did_change(DeprecatedString const&)
|
||||
void ClipboardHistoryModel::clipboard_content_did_change(ByteString const&)
|
||||
{
|
||||
auto data_and_type = GUI::Clipboard::the().fetch_data_and_type();
|
||||
if (!(data_and_type.data.is_empty() && data_and_type.mime_type.is_empty() && data_and_type.metadata.is_empty()))
|
||||
|
@ -184,7 +184,7 @@ ErrorOr<JsonObject> ClipboardHistoryModel::ClipboardItem::to_json() const
|
|||
return object;
|
||||
}
|
||||
|
||||
ErrorOr<void> ClipboardHistoryModel::read_from_file(DeprecatedString const& path)
|
||||
ErrorOr<void> ClipboardHistoryModel::read_from_file(ByteString const& path)
|
||||
{
|
||||
m_path = path;
|
||||
|
||||
|
@ -219,7 +219,7 @@ ErrorOr<void> ClipboardHistoryModel::write_to_file(bool rewrite_all)
|
|||
auto const write_element = [](Core::File& file, ClipboardItem const& item) -> ErrorOr<void> {
|
||||
if (!item.data_and_type.mime_type.starts_with("text/"sv))
|
||||
return {};
|
||||
TRY(file.write_until_depleted(TRY(item.to_json()).to_deprecated_string().bytes()));
|
||||
TRY(file.write_until_depleted(TRY(item.to_json()).to_byte_string().bytes()));
|
||||
TRY(file.write_until_depleted("\n"sv.bytes()));
|
||||
return {};
|
||||
};
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
void clear();
|
||||
bool is_empty() { return m_history_items.is_empty(); }
|
||||
|
||||
ErrorOr<void> read_from_file(DeprecatedString const& path);
|
||||
ErrorOr<void> read_from_file(ByteString const& path);
|
||||
ErrorOr<void> write_to_file(bool rewrite_all);
|
||||
|
||||
ErrorOr<void> invalidate_model_and_file(bool rewrite_all);
|
||||
|
@ -64,10 +64,10 @@ private:
|
|||
virtual int column_count(const GUI::ModelIndex&) const override { return Column::__Count; }
|
||||
|
||||
// ^GUI::Clipboard::ClipboardClient
|
||||
virtual void clipboard_content_did_change(DeprecatedString const&) override;
|
||||
virtual void clipboard_content_did_change(ByteString const&) override;
|
||||
|
||||
Vector<ClipboardItem> m_history_items;
|
||||
size_t m_history_limit;
|
||||
|
||||
DeprecatedString m_path;
|
||||
ByteString m_path;
|
||||
};
|
||||
|
|
|
@ -23,7 +23,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto app = TRY(GUI::Application::create(arguments));
|
||||
auto clipboard_config = TRY(Core::ConfigFile::open_for_app("ClipboardHistory"));
|
||||
|
||||
auto const default_path = DeprecatedString::formatted("{}/{}", Core::StandardPaths::data_directory(), "Clipboard/ClipboardHistory.json"sv);
|
||||
auto const default_path = ByteString::formatted("{}/{}", Core::StandardPaths::data_directory(), "Clipboard/ClipboardHistory.json"sv);
|
||||
auto const clipboard_file_path = clipboard_config->read_entry("Clipboard", "ClipboardFilePath", default_path);
|
||||
auto const parent_path = LexicalPath(clipboard_file_path);
|
||||
TRY(Core::Directory::create(parent_path.dirname(), Core::Directory::CreateDirectories::Yes));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue