]> git.tdb.fi Git - builder.git/blob - source/toolchain.cpp
Add a list of auxiliary suffixes to Tool
[builder.git] / source / toolchain.cpp
1 #include <msp/core/maputils.h>
2 #include "tool.h"
3 #include "toolchain.h"
4
5 using namespace std;
6 using namespace Msp;
7
8 Toolchain::~Toolchain()
9 {
10         for(ToolMap::iterator i=tools.begin(); i!=tools.end(); ++i)
11                 delete i->second;
12 }
13
14 void Toolchain::add_tool(Tool *tool)
15 {
16         insert_unique(tools, tool->get_tag(), tool);
17 }
18
19 const Tool &Toolchain::get_tool(const string &tag) const
20 {
21         return *get_item(tools, tag);
22 }
23
24 const Tool *Toolchain::get_tool_for_suffix(const string &suffix, bool aux) const
25 {
26         for(ToolMap::const_iterator i=tools.begin(); i!=tools.end(); ++i)
27                 if(i->second->accepts_suffix(suffix, aux))
28                         return i->second;
29
30         return 0;
31 }