sbuild  1.7.1
factory.h
1 /* Copyright © 2011-2013 Roger Leigh <rleigh@debian.org>
2  *
3  * schroot is free software: you can redistribute it and/or modify it
4  * under the terms of the GNU General Public License as published by
5  * the Free Software Foundation, either version 3 of the License, or
6  * (at your option) any later version.
7  *
8  * schroot is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see
15  * <http://www.gnu.org/licenses/>.
16  *
17  *********************************************************************/
18 
19 #ifndef SBUILD_CHROOT_FACET_FACTORY_H
20 #define SBUILD_CHROOT_FACET_FACTORY_H
21 
22 #include <sbuild/chroot/chroot.h>
23 #include <sbuild/chroot/facet/facet.h>
24 
25 #include <map>
26 #include <ostream>
27 #include <string>
28 
29 namespace sbuild
30 {
31  namespace chroot
32  {
33  namespace facet
34  {
35 
36  class factory
37  {
38  public:
39  struct facet_info
40  {
42  std::string name;
44  std::string description;
49  };
50 
51  factory (const facet_info& info);
52 
53  ~factory ();
54 
55  static std::ostream&
56  print_facets (std::ostream& stream);
57 
58  static facet::ptr
59  create (const std::string& name);
60 
61  static std::vector<facet::ptr>
62  create_auto ();
63 
64  private:
65  typedef std::map<std::string,const facet_info *> map_type;
66 
67  static map_type&
68  registered_facets ();
69  };
70 
71  }
72  }
73 }
74 
75 #endif /* SBUILD_CHROOT_FACET_FACTORY_H */
76 
77 /*
78  * Local Variables:
79  * mode:C++
80  * End:
81  */