#pragma once #include #include #include #include namespace DB { class ReadBuffer; class WriteBuffer; struct FormatSettings; class IColumn; /** Allow to customize an existing data type and set a different name and/or text serialization/deserialization methods. * See use in IPv4 and IPv6 data types, and also in SimpleAggregateFunction. */ class IDataTypeCustomName { public: virtual ~IDataTypeCustomName() = default; virtual String getName() const = 0; }; using DataTypeCustomNamePtr = std::unique_ptr; /** Describe a data type customization */ struct DataTypeCustomDesc { DataTypeCustomNamePtr name; SerializationPtr serialization; explicit DataTypeCustomDesc( DataTypeCustomNamePtr name_, SerializationPtr serialization_ = nullptr) : name(std::move(name_)) , serialization(std::move(serialization_)) {} }; using DataTypeCustomDescPtr = std::unique_ptr; /** A simple implementation of IDataTypeCustomName */ class DataTypeCustomFixedName : public IDataTypeCustomName { private: String name; public: explicit DataTypeCustomFixedName(String name_) : name(name_) {} String getName() const override { return name; } }; }