ClickHouse/dbms/include/DB/Parsers/ASTEnumElement.h
Alexey Milovidov d89ee33ce2 Squashed commit of the following:
commit c567d4e1fe
Author: Alexey Milovidov <milovidov@yandex-team.ru>
Date:   Fri Jan 6 20:35:01 2017 +0300

    Style [#METR-2944].

commit 26bf3e1228
Author: Alexey Milovidov <milovidov@yandex-team.ru>
Date:   Fri Jan 6 20:33:11 2017 +0300

    Miscellaneous [#METR-2944].

commit eb946f4c6f
Author: Alexey Milovidov <milovidov@yandex-team.ru>
Date:   Fri Jan 6 20:30:19 2017 +0300

    Miscellaneous [#METR-2944].

commit 78c867a147
Author: Alexey Milovidov <milovidov@yandex-team.ru>
Date:   Fri Jan 6 20:11:41 2017 +0300

    Miscellaneous [#METR-2944].

commit 6604c5c83c
Author: Alexey Milovidov <milovidov@yandex-team.ru>
Date:   Fri Jan 6 19:56:15 2017 +0300

    Miscellaneous [#METR-2944].

commit 23fbf05c1d
Author: Alexey Milovidov <milovidov@yandex-team.ru>
Date:   Fri Jan 6 19:47:52 2017 +0300

    Miscellaneous [#METR-2944].

commit 98772faf11
Author: Alexey Milovidov <milovidov@yandex-team.ru>
Date:   Fri Jan 6 19:46:05 2017 +0300

    Miscellaneous [#METR-2944].

commit 3dc636ab9f
Author: Alexey Milovidov <milovidov@yandex-team.ru>
Date:   Fri Jan 6 19:39:46 2017 +0300

    Miscellaneous [#METR-2944].

commit 3e16aee954
Author: Alexey Milovidov <milovidov@yandex-team.ru>
Date:   Fri Jan 6 19:38:03 2017 +0300

    Miscellaneous [#METR-2944].

commit ae7e7e90eb
Author: Alexey Milovidov <milovidov@yandex-team.ru>
Date:   Fri Jan 6 19:34:15 2017 +0300

    Miscellaneous [#METR-2944].
2017-01-06 20:41:19 +03:00

39 lines
853 B
C++

#pragma once
#include <DB/Parsers/IAST.h>
#include <DB/Parsers/ASTLiteral.h>
namespace DB
{
class ASTEnumElement : public IAST
{
public:
String name;
Field value;
ASTEnumElement(const StringRange range, const String & name, const Field & value)
: IAST{range}, name{name}, value {value} {}
String getID() const override { return "EnumElement"; }
ASTPtr clone() const override
{
return std::make_shared<ASTEnumElement>(StringRange(), name, value);
}
protected:
void formatImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const override
{
frame.need_parens = false;
const std::string indent_str = settings.one_line ? "" : std::string(4 * frame.indent, ' ');
settings.ostr << settings.nl_or_ws << indent_str << '\'' << name << "' = " << applyVisitor(FieldVisitorToString{}, value);
}
};
}