aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Processors/Formats/Impl/CustomSeparatedRowOutputFormat.h
blob: 34fe1ce965c40a75c6aeff6403a89941be882e94 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#pragma once

#include <Processors/Formats/IRowOutputFormat.h>
#include <Formats/ParsedTemplateFormatString.h>

namespace DB
{

class WriteBuffer;

class CustomSeparatedRowOutputFormat final : public IRowOutputFormat
{
public:
    CustomSeparatedRowOutputFormat(const Block & header_, WriteBuffer & out_, const FormatSettings & format_settings_, bool with_names_, bool with_types_);

    String getName() const override { return "CustomSeparatedRowOutputFormat"; }

private:
    using EscapingRule = FormatSettings::EscapingRule;

    void writeField(const IColumn & column, const ISerialization & serialization, size_t row_num) override;
    void writeFieldDelimiter() override;
    void writeRowStartDelimiter() override;
    void writeRowEndDelimiter() override;
    void writeRowBetweenDelimiter() override;
    void writePrefix() override;
    void writeSuffix() override;

    void writeLine(const std::vector<String> & values);
    bool with_names;
    bool with_types;
    const FormatSettings format_settings;
    EscapingRule escaping_rule;
};

}