X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcopy.h;h=a5044d8ba50a58bfcf5c56866ab59c962ac556fd;hb=451ef4f33b5a57dcb56bd7cb671bed359ac86247;hp=e39be16baedeb4793634533030f441761df8019a;hpb=97001ddfa2463e6a3526eff772962acdad45f995;p=builder.git diff --git a/source/copy.h b/source/copy.h index e39be16..a5044d8 100644 --- a/source/copy.h +++ b/source/copy.h @@ -2,30 +2,37 @@ #define COPY_H_ #include -#include -#include "action.h" +#include +#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 © - bool done; + const InstalledFile ⌖ - 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 &, const std::string &) override; + Task *run(const Target &) const override; }; #endif