| 1 | //===----------------------------------------------------------------------===// |
| 2 | // DuckDB |
| 3 | // |
| 4 | // duckdb/parser/parsed_data/parse_info.hpp |
| 5 | // |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #pragma once |
| 10 | |
| 11 | #include "duckdb/common/common.hpp" |
| 12 | |
| 13 | namespace duckdb { |
| 14 | |
| 15 | struct ParseInfo { |
| 16 | virtual ~ParseInfo() { |
| 17 | } |
| 18 | |
| 19 | public: |
| 20 | template <class TARGET> |
| 21 | TARGET &Cast() { |
| 22 | D_ASSERT(dynamic_cast<TARGET *>(this)); |
| 23 | return reinterpret_cast<TARGET &>(*this); |
| 24 | } |
| 25 | |
| 26 | template <class TARGET> |
| 27 | const TARGET &Cast() const { |
| 28 | D_ASSERT(dynamic_cast<const TARGET *>(this)); |
| 29 | return reinterpret_cast<const TARGET &>(*this); |
| 30 | } |
| 31 | }; |
| 32 | |
| 33 | } // namespace duckdb |
| 34 | |