]> git.tdb.fi Git - builder.git/blob - source/tool.h
Comment updates
[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 /**
14 Base class for tools.  Tools are used to turn targets into other targets.
15 Examples include compilers and linkers.
16 */
17 class Tool
18 {
19 public:
20         typedef std::list<Msp::FS::Path> SearchPath;
21         typedef std::list<std::string> SuffixList;
22
23 protected:
24         Builder &builder;
25         std::string tag;
26         SuffixList input_suffixes;
27         SuffixList aux_suffixes;
28         SearchPath system_path;
29
30         Tool(Builder &, const std::string &);
31 public:
32         virtual ~Tool() { }
33
34         const std::string &get_tag() const { return tag; }
35         const SuffixList &get_input_suffixes() const { return input_suffixes; }
36         const SuffixList &get_auxiliary_suffixes() const { return aux_suffixes; }
37         bool accepts_suffix(const std::string &, bool = false) const;
38         const SearchPath &get_system_path() const { return system_path; }
39
40         virtual Target *create_source(const Component &, const Msp::FS::Path &) const { return 0; }
41         virtual Target *create_source(const Msp::FS::Path &) const { return 0; }
42         Target *create_target(Target &, const std::string & = std::string()) const;
43         virtual Target *create_target(const std::list<Target *> &, const std::string & = std::string()) const = 0;
44         virtual Task *run(const Target &) const = 0;
45 };
46
47 #endif