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

Spreadsheet: Move to a non-owning model for Stream in Writer::XSV

This commit is contained in:
Lucas CHOLLET 2023-01-14 12:11:29 -05:00 committed by Ali Mohammad Pur
parent fc413711ee
commit 4952cdfe2b
5 changed files with 75 additions and 59 deletions

View file

@ -12,12 +12,18 @@
namespace Writer {
template<typename ContainerType>
class CSV : public XSV<ContainerType> {
class CSV {
public:
CSV(Core::Stream::Handle<Core::Stream::Stream> output, ContainerType const& data, Vector<StringView> headers = {}, WriterBehavior behaviors = default_behaviors())
: XSV<ContainerType>(move(output), data, { ",", "\"", WriterTraits::Repeat }, move(headers), behaviors)
template<typename ContainerType>
static ErrorOr<void> generate(Core::Stream::Stream& output, ContainerType const& data, Vector<StringView> headers = {}, WriterBehavior behaviors = default_behaviors())
{
return XSV<ContainerType>::generate(output, data, { ",", "\"", WriterTraits::Repeat }, move(headers), behaviors);
}
template<typename ContainerType>
static ErrorOr<void> generate_preview(Core::Stream::Stream& output, ContainerType const& data, Vector<StringView> headers = {}, WriterBehavior behaviors = default_behaviors())
{
return XSV<ContainerType>::generate_preview(output, data, { ",", "\"", WriterTraits::Repeat }, move(headers), behaviors);
}
};