]> git.tdb.fi Git - builder.git/blob - source/component.h
ab3906854f79e38ca192fead4ca744f79ff4291f
[builder.git] / source / component.h
1 #ifndef COMPONENT_H_
2 #define COMPONENT_H_
3
4 #include <string>
5 #include <msp/parser/loader.h>
6 #include <msp/path/path.h>
7 #include "buildinfo.h"
8 #include "misc.h"
9 #include "packageref.h"
10
11 class Package;
12
13 class Component
14 {
15 public:
16         class Loader: public Msp::Parser::Loader
17         {
18         public:
19                 Loader(Component &);
20                 Component &get_object() { return comp; }
21         private:
22                 Component &comp;
23
24                 void source(const std::string &);
25                 void require(const std::string &);
26                 void build_info();
27         };
28         
29         enum Type
30         {
31                 PROGRAM,
32                 LIBRARY,
33                 MODULE,
34                 HEADERS
35         };
36
37         Component(Package &, Type, const std::string &);
38         const Package     &get_package() const         { return pkg; }
39         Type              get_type() const             { return type; }
40         const std::string &get_name() const            { return name; }
41         const PathList    &get_sources() const         { return sources; }
42         const BuildInfo   &get_build_info() const      { return build_info; }
43         bool              get_install() const          { return install; }
44         const std::string &get_install_headers() const { return install_headers; }
45         void              resolve_refs();
46         void              create_build_info();
47 protected:
48         Package     &pkg;
49         Type        type;
50         std::string name;
51         PathList    sources;
52         bool        install;
53         std::string install_headers;
54         BuildInfo   build_info;
55         PkgRefList  requires;
56 };
57 typedef std::list<Component> ComponentList;
58
59 #endif