#pragma once #include "config_formats.h" #if USE_CAPNP #include #include #include #include #include namespace DB { // Wrapper for classes that could throw in destructor // https://github.com/capnproto/capnproto/issues/553 template struct DestructorCatcher { T impl; template DestructorCatcher(Arg && ... args) : impl(kj::fwd(args)...) {} ~DestructorCatcher() noexcept try { } catch (...) { return; } }; class CapnProtoSchemaParser : public DestructorCatcher { public: CapnProtoSchemaParser() {} capnp::StructSchema getMessageSchema(const FormatSchemaInfo & schema_info); }; bool compareEnumNames(const String & first, const String & second, FormatSettings::EnumComparingMode mode); std::pair getStructBuilderAndFieldByColumnName(capnp::DynamicStruct::Builder struct_builder, const String & name); capnp::DynamicValue::Reader getReaderByColumnName(const capnp::DynamicStruct::Reader & struct_reader, const String & name); void checkCapnProtoSchemaStructure(const capnp::StructSchema & schema, const Block & header, FormatSettings::EnumComparingMode mode); } #endif