]> git.tdb.fi Git - builder.git/blob - source/copy.h
Add comments
[builder.git] / source / copy.h
1 #ifndef COPY_H_
2 #define COPY_H_
3
4 #include <msp/core/thread.h>
5 #include <msp/path/path.h>
6 #include "action.h"
7
8 class Package;
9
10 /**
11 Copies a file to another place.  Used by the Install target.
12 */
13 class Copy: public Action
14 {
15 public:
16         Copy(Builder &, const Package &, const Msp::Path::Path &, const Msp::Path::Path &);
17         int check();
18         ~Copy();
19 private:
20         /**
21         A worker thread that actually does the data transfer.
22         */
23         class Worker: public Msp::Thread
24         {
25         public:
26                 Worker(Copy &i): copy(i), done(false), error(false) { launch(); }
27                 bool get_done() const  { return done; }
28                 bool get_error() const { return error; }
29         private:
30                 Copy &copy;
31                 bool done;
32                 bool error;
33
34                 void main();
35         };
36
37         Msp::Path::Path src;
38         Msp::Path::Path dest;
39         Worker *worker;
40 };
41
42 #endif