]> git.tdb.fi Git - builder.git/blob - source/package.h
42c453ad2e0e99200c905dfdd05f62327b22ac54
[builder.git] / source / package.h
1 #ifndef PACKAGE_H_
2 #define PACKAGE_H_
3
4 #include <list>
5 #include <string>
6 #include <msp/parser/loader.h>
7 #include "buildinfo.h"
8 #include "component.h"
9
10 class Builder;
11 class Package;
12
13 class PackageRef
14 {
15 public:
16         PackageRef(Builder &, const std::string &);
17         Package *get_package();
18 private:
19         Builder     &builder;
20         std::string name;
21         Package     *package;
22 };
23
24 class Package
25 {
26 public:
27         class Loader: public Msp::Parser::Loader
28         {
29         public:
30                 Loader(Package &);
31                 Package &get_object() { return pkg; }
32                 ~Loader();
33         private:
34                 Package &pkg;
35                 
36                 void require(const std::string &);
37                 void program(const std::string &);
38                 void library(const std::string &);
39         };
40
41         Package(Builder &, const std::string &, const Msp::Path::Path &);
42         Package(Builder &, const std::string &, const std::list<std::string> &);
43         const std::string   &get_name() const { return name; }
44         const Msp::Path::Path &get_source() const { return source; }
45         const ComponentList &get_components() const { return components; }
46         bool                get_buildable() const { return buildable; }
47         void resolve_refs();
48
49         static Package *create(Builder &, const std::string &);
50 private:
51         Builder       &builder;
52         std::string   name;
53         std::string   version;
54         std::string   description;
55         std::list<PackageRef> requires;
56         BuildInfo     build_info;
57         BuildInfo     export_binfo;
58         Msp::Path::Path source;
59         bool          buildable;
60         ComponentList components;
61 };
62
63 #endif