]> git.tdb.fi Git - builder.git/blobdiff - source/copy.h
Refactor InternalTask to take a functor
[builder.git] / source / copy.h
index 0f30ecfee28fa270c5920e5c34866e5009ba6a2c..c0a433996a9c0a14625ebf918c9c6092eac6d9e0 100644 (file)
@@ -1,43 +1,23 @@
-/* $Id$
-
-This file is part of builder
-Copyright © 2006-2009  Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
 #ifndef COPY_H_
 #define COPY_H_
 
-#include <msp/core/thread.h>
-#include <msp/fs/path.h>
-#include "internalaction.h"
+#include "tool.h"
 
-class Package;
+class InstalledFile;
 
 /**
-Copies a file to another place.  Used by the Install target.
+Copies a file to another place.  Used by the InstalledFile target.
 */
-class Copy: public InternalAction
+class Copy: public Tool
 {
-private:
-       /**
-       A worker thread that actually does the data transfer.
-       */
-       class Worker: public InternalAction::Worker
-       {
-       public:
-               Worker(Copy &);
-       private:
-               Copy &copy;
-
-               void main();
-       };
+public:
+       Copy(Builder &b): Tool(b, "CP") { }
 
-       Msp::FS::Path src;
-       Msp::FS::Path dest;
+       Target *create_target(const std::vector<Target *> &, const std::string &) override;
+       Task *run(const Target &) const override;
 
-public:
-       Copy(Builder &, const Package &, const Msp::FS::Path &, const Msp::FS::Path &);
+private:
+       static bool _run(const InstalledFile &);
 };
 
 #endif