]> git.tdb.fi Git - builder.git/blob - source/tool.h
Big rewrite for a more tool-centric approach
[builder.git] / source / tool.h
1 #ifndef TOOL_H_
2 #define TOOL_H_
3
4 #include <list>
5 #include <string>
6 #include <msp/fs/path.h>
7
8 class Builder;
9 class Component;
10 class Target;
11 class Task;
12
13 class Tool
14 {
15 protected:
16         Builder &builder;
17         std::string tag;
18         std::list<std::string> input_suffixes;
19
20         Tool(Builder &, const std::string &);
21
22 public:
23         const std::string &get_tag() const { return tag; }
24         const std::list<std::string> &get_input_suffixes() const { return input_suffixes; }
25         bool accepts_suffix(const std::string &) const;
26
27         virtual Target *create_source(const Component &, const Msp::FS::Path &) const { return 0; }
28         Target *create_target(Target &, const std::string & = std::string()) const;
29         virtual Target *create_target(const std::list<Target *> &, const std::string & = std::string()) const = 0;
30         virtual Task *run(const Target &) const = 0;
31 };
32
33 #endif