]> git.tdb.fi Git - builder.git/blob - source/action.h
Reorder class members
[builder.git] / source / action.h
1 /* $Id$
2
3 This file is part of builder
4 Copyright © 2006-2007, 2009  Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #ifndef ACTION_H_
9 #define ACTION_H_
10
11 #include <string>
12 #include <sigc++/sigc++.h>
13
14 class Builder;
15
16 /**
17 Actions are executed to rebuild targets.
18 */
19 class Action
20 {
21 public:
22         /// Emitted when the action has finished
23         sigc::signal<void> signal_done;
24         
25 protected:
26         Builder &builder;
27         
28         Action(Builder &b): builder(b) { }
29 public:
30         virtual ~Action() { }
31
32         /**
33         Checks whether the action is done and emits signal_done if it is.  Returns 0
34         if the action has completed successfully, 1 if an error was encountered and
35         -1 if it is still executing.
36         */
37         virtual int check()=0;
38         
39 protected:
40         /**
41         Annouces the action by printing out the package name, tool and target name.
42         */
43         void announce(const std::string &, const std::string &, const std::string &);
44 };
45
46 #endif