]> git.tdb.fi Git - builder.git/blobdiff - source/copy.h
Inline simple constructors
[builder.git] / source / copy.h
index e39be16baedeb4793634533030f441761df8019a..a5044d8ba50a58bfcf5c56866ab59c962ac556fd 100644 (file)
@@ -2,30 +2,37 @@
 #define COPY_H_
 
 #include <msp/core/thread.h>
-#include <msp/path/path.h>
-#include "action.h"
+#include <msp/fs/path.h>
+#include "internaltask.h"
+#include "tool.h"
 
-class Copy: public Action
+class InstalledFile;
+
+/**
+Copies a file to another place.  Used by the InstalledFile target.
+*/
+class Copy: public Tool
 {
-public:
-       Copy(Builder &, const Msp::Path::Path &, const Msp::Path::Path &);
-       int check();
 private:
-       class Worker: public Msp::Thread
+       /**
+       A worker thread that actually does the data transfer.
+       */
+       class Worker: public InternalTask::Worker
        {
-       public:
-               Worker(Copy &i): copy(i), done(false) { launch(); }
-               bool get_done() const { return done; }
        private:
-               Copy &copy;
-               bool done;
+               const InstalledFile &target;
 
-               void main();
+       public:
+               Worker(const InstalledFile &t): target(t) { }
+       private:
+               void main() override;
        };
 
-       Msp::Path::Path src;
-       Msp::Path::Path dest;
-       Worker worker;
+public:
+       Copy(Builder &b): Tool(b, "CP") { }
+
+       Target *create_target(const std::vector<Target *> &, const std::string &) override;
+       Task *run(const Target &) const override;
 };
 
 #endif