]> git.tdb.fi Git - builder.git/blob - source/tool.h
Make tools capable of reporting a system-wide path used to locate input files
[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 public:
16         typedef std::list<Msp::FS::Path> SearchPath;
17         typedef std::list<std::string> SuffixList;
18
19 protected:
20         Builder &builder;
21         std::string tag;
22         SuffixList input_suffixes;
23         SuffixList aux_suffixes;
24         SearchPath system_path;
25
26         Tool(Builder &, const std::string &);
27 public:
28         virtual ~Tool() { }
29
30         const std::string &get_tag() const { return tag; }
31         const SuffixList &get_input_suffixes() const { return input_suffixes; }
32         const SuffixList &get_auxiliary_suffixes() const { return aux_suffixes; }
33         bool accepts_suffix(const std::string &, bool = false) const;
34         const SearchPath &get_system_path() const { return system_path; }
35
36         virtual Target *create_source(const Component &, const Msp::FS::Path &) const { return 0; }
37         Target *create_target(Target &, const std::string & = std::string()) const;
38         virtual Target *create_target(const std::list<Target *> &, const std::string & = std::string()) const = 0;
39         virtual Task *run(const Target &) const = 0;
40 };
41
42 #endif