]> git.tdb.fi Git - builder.git/blob - source/filetarget.h
Move some file-related things from Target to FileTarget
[builder.git] / source / filetarget.h
1 /* $Id$
2
3 This file is part of builder
4 Copyright © 2009  Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #ifndef FILETARGET_H_
9 #define FILETARGET_H_
10
11 #include <msp/fs/path.h>
12 #include "target.h"
13
14 /**
15 An intermediate base class for targets that represent files.  Almost all target
16 classes are derived from this.
17 */
18 class FileTarget: public Target
19 {
20 protected:
21         Msp::FS::Path path;
22         Msp::Time::TimeStamp mtime;
23         unsigned size;
24
25         FileTarget(Builder &, const Package *, const Msp::FS::Path &);
26 public:
27         const Msp::FS::Path &get_path() const { return path; }
28         const Msp::Time::TimeStamp &get_mtime() const { return mtime; }
29         unsigned get_size() const { return size; }
30
31         /**
32         Changes the mtime of the target to the current time.
33         */
34         void touch();
35
36 protected:
37         virtual void check_rebuild();
38 };
39
40 #endif