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