1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 22:37:35 +00:00

AK: Move memory streams from LibCore

This commit is contained in:
Tim Schumacher 2023-01-25 20:19:05 +01:00 committed by Andrew Kaster
parent 11550f582b
commit 093cf428a3
46 changed files with 213 additions and 203 deletions

View file

@ -10,8 +10,8 @@
#include <AK/DeprecatedString.h>
#include <AK/JsonArray.h>
#include <AK/LexicalPath.h>
#include <AK/MemoryStream.h>
#include <Applications/Spreadsheet/CSVExportGML.h>
#include <LibCore/MemoryStream.h>
#include <LibCore/StandardPaths.h>
#include <LibGUI/Application.h>
#include <LibGUI/CheckBox.h>
@ -167,7 +167,7 @@ auto CSVExportDialogPage::generate(AK::Stream& stream, GenerationType type) -> E
void CSVExportDialogPage::update_preview()
{
auto maybe_error = [this]() -> ErrorOr<void> {
Core::Stream::AllocatingMemoryStream memory_stream;
AllocatingMemoryStream memory_stream;
TRY(generate(memory_stream, GenerationType::Preview));
auto buffer = TRY(memory_stream.read_until_eof());
m_data_preview_text_editor->set_text(StringView(buffer));

View file

@ -7,7 +7,7 @@
#include <LibTest/TestCase.h>
#include "../CSV.h"
#include <LibCore/MemoryStream.h>
#include <AK/MemoryStream.h>
TEST_CASE(can_write)
{
@ -17,7 +17,7 @@ TEST_CASE(can_write)
{ 7, 8, 9 },
};
Core::Stream::AllocatingMemoryStream stream;
AllocatingMemoryStream stream;
MUST(Writer::CSV::generate(stream, data));
auto expected_output = R"~(1,2,3
@ -37,7 +37,7 @@ TEST_CASE(can_write_with_header)
{ 7, 8, 9 },
};
Core::Stream::AllocatingMemoryStream stream;
AllocatingMemoryStream stream;
MUST(Writer::CSV::generate(stream, data, { "A"sv, "B\""sv, "C"sv }));
auto expected_output = R"~(A,"B""",C
@ -57,7 +57,7 @@ TEST_CASE(can_write_with_different_behaviors)
{ "We\"ll", "Hello,", " Friends" },
};
Core::Stream::AllocatingMemoryStream stream;
AllocatingMemoryStream stream;
MUST(Writer::CSV::generate(stream, data, { "A"sv, "B\""sv, "C"sv }, Writer::WriterBehavior::QuoteOnlyInFieldStart | Writer::WriterBehavior::WriteHeaders));
auto expected_output = R"~(A,B",C