| 1170 | }; |
| 1171 | |
| 1172 | Status BlockParser::Make(MemoryPool* pool, const ParseOptions& options, |
| 1173 | std::unique_ptr<BlockParser>* out) { |
| 1174 | DCHECK(options.unexpected_field_behavior == UnexpectedFieldBehavior::InferType || |
| 1175 | options.explicit_schema != nullptr); |
| 1176 | |
| 1177 | switch (options.unexpected_field_behavior) { |
| 1178 | case UnexpectedFieldBehavior::Ignore: { |
| 1179 | *out = std::make_unique<Handler<UnexpectedFieldBehavior::Ignore>>(pool); |
| 1180 | break; |
| 1181 | } |
| 1182 | case UnexpectedFieldBehavior::Error: { |
| 1183 | *out = std::make_unique<Handler<UnexpectedFieldBehavior::Error>>(pool); |
| 1184 | break; |
| 1185 | } |
| 1186 | case UnexpectedFieldBehavior::InferType: |
| 1187 | *out = std::make_unique<Handler<UnexpectedFieldBehavior::InferType>>(pool); |
| 1188 | break; |
| 1189 | } |
| 1190 | return static_cast<HandlerBase&>(**out).Initialize(options.explicit_schema); |
| 1191 | } |
| 1192 | |
| 1193 | Status BlockParser::Make(const ParseOptions& options, std::unique_ptr<BlockParser>* out) { |
| 1194 | return BlockParser::Make(default_memory_pool(), options, out); |
nothing calls this directly
no test coverage detected