1 /*  Copyright (C) 2012-2021 by László Nagy
2     This file is part of Bear.
3 
4     Bear is a tool to generate compilation database for clang tooling.
5 
6     Bear is free software: you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation, either version 3 of the License, or
9     (at your option) any later version.
10 
11     Bear is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15 
16     You should have received a copy of the GNU General Public License
17     along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #pragma once
21 
22 #include "libresult/Result.h"
23 
24 #include <memory>
25 
26 namespace ps {
27 
28     struct Command {
29         virtual ~Command() noexcept = default;
30 
31         [[nodiscard]]
32         virtual rust::Result<int> execute() const = 0;
33     };
34 
35     using CommandPtr = std::unique_ptr<Command>;
36 
37     struct Application {
38         virtual ~Application() noexcept = default;
39 
40         [[nodiscard]]
41         virtual rust::Result<CommandPtr> command(int argc, const char** argv, const char** envp) const = 0;
42     };
43 }
44