Branch data Line data Source code
1 : : #pragma once
2 : :
3 : : #include <map>
4 : : #include <memory>
5 : : #include <string>
6 : : #include <vector>
7 : :
8 : : namespace hpactor {
9 : : namespace cli {
10 : :
11 : : struct TreeNode {
12 : : std::string name;
13 : : std::string description;
14 : : std::vector<TreeNode> children;
15 : : };
16 : :
17 : : class OutputFormatter {
18 : : public:
19 : 17 : virtual ~OutputFormatter() = default;
20 : : virtual void header(const std::string& title) = 0;
21 : : virtual void table(const std::vector<std::string>& columns,
22 : : const std::vector<std::vector<std::string>>& rows) = 0;
23 : : virtual void key_value(const std::map<std::string, std::string>& pairs) = 0;
24 : : virtual void tree(const TreeNode& root) = 0;
25 : : virtual void raw(const std::string& text) = 0;
26 : : virtual void error(const std::string& message) = 0;
27 : : virtual std::string finalize() = 0;
28 : :
29 : : static std::unique_ptr<OutputFormatter> create(const std::string& format);
30 : : };
31 : :
32 : : } // namespace cli
33 : : } // namespace hpactor
|