X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ftask.h;h=183deee40e5c8d0b6b3b60455a2e3f14e933fdb5;hb=bc85cc286c8a3f1055f1979a7ff8697cf1b61912;hp=e7e37e3f04423d525afdf44e00a2e9c854c5c4b1;hpb=0aa50a0d3e5567e9295ecf4d7ba6d4b14fa73b9b;p=builder.git diff --git a/source/task.h b/source/task.h index e7e37e3..183deee 100644 --- a/source/task.h +++ b/source/task.h @@ -3,6 +3,7 @@ #include #include +#include /** Tasks are used to manage other programs and worker threads involved in the @@ -21,11 +22,21 @@ public: sigc::signal signal_finished; + std::list files; + bool unlink; + protected: - Task() { } + Task(); public: virtual ~Task() { } + /** Associate the task with a file. */ + void add_file(const Msp::FS::Path &); + + /** If set to true, the associated files are removed before the task is + started. */ + void set_unlink(bool = true); + /** Returns the command being executed for this task. Only makes sense if an external command is involved. */ virtual std::string get_command() const = 0; @@ -33,6 +44,11 @@ public: /// Starts the task. virtual void start() = 0; +protected: + /// Ensures that the output directory exists and removes files if necessary. + void prepare(); + +public: /// Checks the status of the task and immediately returns. virtual Status check() = 0;