| 1 | //===----------------------------------------------------------------------===// |
|---|---|
| 2 | // DuckDB |
| 3 | // |
| 4 | // duckdb/planner/expression_iterator.hpp |
| 5 | // |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #pragma once |
| 10 | |
| 11 | #include "duckdb/common/common.hpp" |
| 12 | #include "duckdb/planner/expression.hpp" |
| 13 | |
| 14 | #include <functional> |
| 15 | |
| 16 | namespace duckdb { |
| 17 | class BoundQueryNode; |
| 18 | class BoundTableRef; |
| 19 | |
| 20 | class ExpressionIterator { |
| 21 | public: |
| 22 | static void EnumerateChildren(const Expression &expression, |
| 23 | const std::function<void(const Expression &child)> &callback); |
| 24 | static void EnumerateChildren(Expression &expression, const std::function<void(Expression &child)> &callback); |
| 25 | static void EnumerateChildren(Expression &expression, |
| 26 | const std::function<void(unique_ptr<Expression> &child)> &callback); |
| 27 | |
| 28 | static void EnumerateExpression(unique_ptr<Expression> &expr, |
| 29 | const std::function<void(Expression &child)> &callback); |
| 30 | |
| 31 | static void EnumerateTableRefChildren(BoundTableRef &ref, const std::function<void(Expression &child)> &callback); |
| 32 | static void EnumerateQueryNodeChildren(BoundQueryNode &node, |
| 33 | const std::function<void(Expression &child)> &callback); |
| 34 | }; |
| 35 | |
| 36 | } // namespace duckdb |
| 37 |