xref: /openbmc/bmcweb/redfish-core/include/filter_expr_printer.hpp (revision d78572018fc2022091ff8b8eb5a7fef2172ba3d6)
1 // SPDX-License-Identifier: Apache-2.0
2 // SPDX-FileCopyrightText: Copyright OpenBMC Authors
3 #pragma once
4 
5 #include "filter_expr_parser_ast.hpp"
6 
7 #include <cstdint>
8 #include <optional>
9 #include <string>
10 #include <string_view>
11 
12 namespace redfish
13 {
14 struct FilterExpressionPrinter
15 {
16     using result_type = std::string;
17     std::string operator()(double x) const;
18     std::string operator()(int64_t x) const;
19     std::string operator()(const filter_ast::QuotedString& x) const;
20     std::string operator()(const filter_ast::UnquotedString& x) const;
21     std::string operator()(const filter_ast::LogicalNot& x) const;
22     std::string operator()(const filter_ast::LogicalOr& x) const;
23     std::string operator()(const filter_ast::LogicalAnd& x) const;
24     std::string operator()(const filter_ast::Comparison& x) const;
25     std::string operator()(const filter_ast::BooleanOp& operation) const;
26 };
27 
28 std::optional<filter_ast::LogicalAnd> parseFilter(std::string_view expr);
29 } // namespace redfish
30