]> git.tdb.fi Git - builder.git/blobdiff - source/tool.cpp
Support source generators that combine multiple files into one
[builder.git] / source / tool.cpp
index 3aa2db3c713716ba7d90bcafa715afe368a37302..e2afe79a204ccea8aebda5294c0dc8a0fd3f583e 100644 (file)
@@ -12,6 +12,7 @@ Tool::Tool(Builder &b, const string &t):
        architecture(0),
        tag(t),
        executable(0),
+       processing_unit(ONE_FILE),
        prepared(false)
 { }
 
@@ -20,6 +21,7 @@ Tool::Tool(Builder &b, const Architecture &a, const string &t):
        architecture(&a),
        tag(t),
        executable(0),
+       processing_unit(ONE_FILE),
        prepared(false)
 { }
 
@@ -71,3 +73,17 @@ SubTool::SubTool(Tool &p):
        Tool(p),
        parent(p)
 { }
+
+
+void operator>>(const LexicalConverter &conv, Tool::ProcessingUnit &unit)
+{
+       const string &str = conv.get();
+       if(str=="FILE")
+               unit = Tool::ONE_FILE;
+       else if(str=="DIRECTORY")
+               unit = Tool::DIRECTORY;
+       else if(str=="COMPONENT")
+               unit = Tool::COMPONENT;
+       else
+               throw lexical_error(format("conversion of '%s' to ProcessingUnit", str));
+}