sbuild  1.6.10
sbuild-chroot-facet.h
1 /* Copyright © 2005-2009 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_H
20 #define SBUILD_CHROOT_FACET_H
21 
22 #include <sbuild/sbuild-environment.h>
23 #include <sbuild/sbuild-format-detail.h>
24 #include <sbuild/sbuild-keyfile.h>
25 #include <sbuild/sbuild-types.h>
26 #include <sbuild/sbuild-chroot.h>
27 
28 #include <string>
29 
30 namespace sbuild
31 {
32 
41  {
42  public:
44  typedef std::shared_ptr<chroot_facet> ptr;
45 
47  typedef std::shared_ptr<const chroot_facet> const_ptr;
48 
49  protected:
51  chroot_facet(): owner(0) {};
52 
58  void
60  {
61  this->owner = &chroot;
62  }
63 
64  friend class chroot;
65 
66  public:
68  virtual ~chroot_facet () {};
69 
75  virtual ptr
76  clone () const = 0;
77 
83  virtual std::string const&
84  get_name () const = 0;
85 
93  virtual void
94  setup_env (chroot const& chroot,
95  environment& env) const = 0;
96 
104  virtual chroot::session_flags
105  get_session_flags (chroot const& chroot) const = 0;
106 
113  virtual void
114  get_details (chroot const& chroot,
115  format_detail& detail) const = 0;
116 
125  virtual void
126  get_keyfile (chroot const& chroot,
127  keyfile& keyfile) const = 0;
128 
138  virtual void
139  set_keyfile (chroot& chroot,
140  keyfile const& keyfile,
141  string_list& used_keys) = 0;
142 
143  protected:
145  chroot *owner;
146  };
147 
148 }
149 
150 #endif /* SBUILD_CHROOT_FACET_H */
151 
152 /*
153  * Local Variables:
154  * mode:C++
155  * End:
156  */
virtual std::string const & get_name() const =0
Get the name of the chroot facet.
virtual ptr clone() const =0
Copy the chroot facet.
virtual void get_keyfile(chroot const &chroot, keyfile &keyfile) const =0
Copy the chroot properties into a keyfile.
std::shared_ptr< const chroot_facet > const_ptr
A shared_ptr to a const chroot facet object.
Definition: sbuild-chroot-facet.h:47
Debian source builder components.
Definition: sbuild-auth-null.h:24
virtual ~chroot_facet()
The destructor.
Definition: sbuild-chroot-facet.h:68
virtual void setup_env(chroot const &chroot, environment &env) const =0
Set environment.
chroot_facet()
The constructor.
Definition: sbuild-chroot-facet.h:51
Container of environment variables.
Definition: sbuild-environment.h:38
Configuration file parser.
Definition: sbuild-basic-keyfile.h:138
std::vector< std::string > string_list
A string vector.
Definition: sbuild-types.h:38
session_flags
Chroot session properties.
Definition: sbuild-chroot.h:57
std::shared_ptr< chroot_facet > ptr
A shared_ptr to a chroot facet object.
Definition: sbuild-chroot-facet.h:44
Format names and values for output.
Definition: sbuild-format-detail.h:38
virtual chroot::session_flags get_session_flags(chroot const &chroot) const =0
Get the session flags of the chroot.
Common chroot data.
Definition: sbuild-chroot.h:45
void set_chroot(chroot &chroot)
Set containing chroot.
Definition: sbuild-chroot-facet.h:59
chroot * owner
Chroot owning this facet.
Definition: sbuild-chroot-facet.h:145
virtual void set_keyfile(chroot &chroot, keyfile const &keyfile, string_list &used_keys)=0
Set the chroot properties from a keyfile.
Common chroot data.
Definition: sbuild-chroot-facet.h:40
virtual void get_details(chroot const &chroot, format_detail &detail) const =0
Get detailed information about the chroot for output.