]> git.tdb.fi Git - builder.git/blob - source/condition.h
Fix a bug in condition evaluation
[builder.git] / source / condition.h
1 /* $Id$
2
3 This file is part of builder
4 Copyright © 2007, 2009  Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #ifndef CONDITION_H_
9 #define CONDITION_H_
10
11 #include <msp/datafile/loader.h>
12 #include "buildinfo.h"
13 #include "misc.h"
14
15 class Config;
16 class SourcePackage;
17
18 class Condition
19 {
20 public:
21         class Loader: public Msp::DataFile::Loader
22         {
23         private:
24                 Condition &cond;
25
26         public:
27                 Loader(Condition &);
28         private:
29                 void require(const std::string &);
30                 void build_info();
31         };
32
33 private:
34         SourcePackage &pkg;
35         StringMap expression;
36         StringList requires;
37         BuildInfo build_info;
38
39 public:
40         Condition(SourcePackage &, const std::string &);
41         const StringList &get_requires() const { return requires; }
42         const BuildInfo &get_build_info() const { return build_info; }
43         bool eval();
44 };
45 typedef std::list<Condition> ConditionList;
46
47 #endif