]> git.tdb.fi Git - builder.git/blob - source/component.h
d0b3cc2aff060c8031ff8111ad3c0725bfcc8ece
[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
10 class Package;
11
12 class Component
13 {
14 public:
15         class Loader: public Msp::Parser::Loader
16         {
17         public:
18                 Loader(Component &);
19                 Component &get_object() { return comp; }
20         private:
21                 Component &comp;
22
23                 void source(const std::string &);
24                 void cflag(const std::string &);
25         };
26         
27         enum Type
28         {
29                 PROGRAM,
30                 LIBRARY,
31                 MODULE,
32                 HEADERS
33         };
34
35         Component(Package &, Type, const std::string &);
36         const Package     &get_package() const         { return pkg; }
37         Type              get_type() const             { return type; }
38         const std::string &get_name() const            { return name; }
39         const PathList    &get_sources() const         { return sources; }
40         const BuildInfo   &get_build_info() const      { return build_info; }
41         bool              get_install() const          { return install; }
42         const std::string &get_install_headers() const { return install_headers; }
43         void              create_build_info();
44 protected:
45         Package     &pkg;
46         Type        type;
47         std::string name;
48         PathList    sources;
49         bool        install;
50         std::string install_headers;
51         BuildInfo   build_info;
52 };
53 typedef std::list<Component> ComponentList;
54
55 #endif