1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:17:36 +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:
Ali Mohammad Pur 2023-12-16 17:49:34 +03:30 committed by Ali Mohammad Pur
parent 38d62563b3
commit 5e1499d104
1615 changed files with 10257 additions and 10257 deletions

View file

@ -7,7 +7,7 @@
#include "ExportDialog.h"
#include "Spreadsheet.h"
#include "Workbook.h"
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/JsonArray.h>
#include <AK/LexicalPath.h>
#include <AK/MemoryStream.h>
@ -59,7 +59,7 @@ CSVExportDialogPage::CSVExportDialogPage(Sheet const& sheet)
m_data_preview_text_editor->set_should_hide_unnecessary_scrollbars(true);
m_quote_escape_combo_box->set_model(GUI::ItemListModel<DeprecatedString>::create(m_quote_escape_items));
m_quote_escape_combo_box->set_model(GUI::ItemListModel<ByteString>::create(m_quote_escape_items));
// By default, use commas, double quotes with repeat, disable headers, and quote only the fields that require quoting.
m_delimiter_comma_radio->set_checked(true);
@ -91,7 +91,7 @@ CSVExportDialogPage::CSVExportDialogPage(Sheet const& sheet)
auto CSVExportDialogPage::generate(Stream& stream, GenerationType type) -> ErrorOr<void>
{
auto delimiter = TRY([this]() -> ErrorOr<DeprecatedString> {
auto delimiter = TRY([this]() -> ErrorOr<ByteString> {
if (m_delimiter_other_radio->is_checked()) {
if (m_delimiter_other_text_box->text().is_empty())
return Error::from_string_literal("Delimiter unset");
@ -108,7 +108,7 @@ auto CSVExportDialogPage::generate(Stream& stream, GenerationType type) -> Error
return Error::from_string_literal("Delimiter unset");
}());
auto quote = TRY([this]() -> ErrorOr<DeprecatedString> {
auto quote = TRY([this]() -> ErrorOr<ByteString> {
if (m_quote_other_radio->is_checked()) {
if (m_quote_other_text_box->text().is_empty())
return Error::from_string_literal("Quote separator unset");
@ -140,7 +140,7 @@ auto CSVExportDialogPage::generate(Stream& stream, GenerationType type) -> Error
};
auto behaviors = Writer::default_behaviors();
Vector<DeprecatedString> empty_headers;
Vector<ByteString> empty_headers;
auto* headers = &empty_headers;
if (should_export_headers) {
@ -153,7 +153,7 @@ auto CSVExportDialogPage::generate(Stream& stream, GenerationType type) -> Error
switch (type) {
case GenerationType::Normal:
TRY((Writer::XSV<decltype(m_data), Vector<DeprecatedString>>::generate(stream, m_data, move(traits), *headers, behaviors)));
TRY((Writer::XSV<decltype(m_data), Vector<ByteString>>::generate(stream, m_data, move(traits), *headers, behaviors)));
break;
case GenerationType::Preview:
TRY((Writer::XSV<decltype(m_data), decltype(*headers)>::generate_preview(stream, m_data, move(traits), *headers, behaviors)));
@ -176,10 +176,10 @@ void CSVExportDialogPage::update_preview()
return {};
}();
if (maybe_error.is_error())
m_data_preview_text_editor->set_text(DeprecatedString::formatted("Cannot update preview: {}", maybe_error.error()));
m_data_preview_text_editor->set_text(ByteString::formatted("Cannot update preview: {}", maybe_error.error()));
}
ErrorOr<void> ExportDialog::make_and_run_for(StringView mime, Core::File& file, DeprecatedString filename, Workbook& workbook)
ErrorOr<void> ExportDialog::make_and_run_for(StringView mime, Core::File& file, ByteString filename, Workbook& workbook)
{
auto wizard = TRY(GUI::WizardDialog::create(GUI::Application::the()->active_window()));
wizard->set_title("File Export Wizard");
@ -205,7 +205,7 @@ ErrorOr<void> ExportDialog::make_and_run_for(StringView mime, Core::File& file,
for (auto& sheet : workbook.sheets())
array.must_append(sheet->to_json());
auto file_content = array.to_deprecated_string();
auto file_content = array.to_byte_string();
return file.write_until_depleted(file_content.bytes());
};
@ -223,11 +223,11 @@ ErrorOr<void> ExportDialog::make_and_run_for(StringView mime, Core::File& file,
TRY(page->body_widget().load_from_gml(select_format_page_gml));
auto format_combo_box = page->body_widget().find_descendant_of_type_named<GUI::ComboBox>("select_format_page_format_combo_box");
Vector<DeprecatedString> supported_formats {
Vector<ByteString> supported_formats {
"CSV (text/csv)",
"Spreadsheet Worksheet",
};
format_combo_box->set_model(GUI::ItemListModel<DeprecatedString>::create(supported_formats));
format_combo_box->set_model(GUI::ItemListModel<ByteString>::create(supported_formats));
wizard->push_page(page);