sbuild  1.6.4
sbuild-chroot-facet-userdata.h
1 /* Copyright © 2005-2009,2012 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_USERDATA_H
20 #define SBUILD_CHROOT_FACET_USERDATA_H
21 
22 #include <sbuild/sbuild-chroot-facet.h>
23 #include <sbuild/sbuild-custom-error.h>
24 #include <sbuild/sbuild-types.h>
25 
26 namespace sbuild
27 {
28 
36  {
37  public:
40  {
45  };
46 
49 
51  typedef std::shared_ptr<chroot_facet_userdata> ptr;
52 
54  typedef std::shared_ptr<const chroot_facet_userdata> const_ptr;
55 
56  private:
59 
60  public:
62  virtual ~chroot_facet_userdata ();
63 
69  static ptr
70  create ();
71 
72  virtual chroot_facet::ptr
73  clone () const;
74 
75  virtual std::string const&
76  get_name () const;
77 
78  virtual void
79  setup_env (chroot const& chroot,
80  environment& env) const;
81 
82  virtual chroot::session_flags
83  get_session_flags (chroot const& chroot) const;
84 
85  virtual void
86  get_details (chroot const& chroot,
87  format_detail& detail) const;
88 
89  virtual void
90  get_keyfile (chroot const& chroot,
91  keyfile& keyfile) const;
92 
93  virtual void
95  keyfile const& keyfile,
96  string_list& used_keys);
97 
103  string_map const&
104  get_data () const;
105 
114  bool
115  get_data (std::string const& key,
116  std::string& value) const;
117 
124  void
125  set_data (string_map const& data);
126 
134  void
135  set_data (std::string const& key,
136  std::string const& value);
137 
145  void
146  set_system_data (std::string const& key,
147  std::string const& value);
148 
154  void
155  remove_data (std::string const& key);
156 
162  string_set const&
163  get_user_modifiable_keys () const;
164 
170  void
171  set_user_modifiable_keys (string_set const& keys);
172 
178  string_set const&
179  get_root_modifiable_keys () const;
180 
186  void
187  set_root_modifiable_keys (string_set const& keys);
188 
196  void
197  set_user_data(string_map const& data);
198 
206  void
207  set_root_data(string_map const& data);
208 
214  void
215  set_system_data(string_map const& data);
216 
217  private:
225  void
226  set_data(string_map const& data,
227  string_set const& allowed_keys,
228  bool root);
229 
238  };
239 
240 }
241 
242 #endif /* SBUILD_CHROOT_FACET_USERDATA_H */
243 
244 /*
245  * Local Variables:
246  * mode:C++
247  * End:
248  */