19 #ifndef SBUILD_CHROOT_CHROOT_H
20 #define SBUILD_CHROOT_CHROOT_H
22 #include <sbuild/chroot/facet/facet.h>
23 #include <sbuild/custom-error.h>
24 #include <sbuild/environment.h>
25 #include <sbuild/format-detail.h>
26 #include <sbuild/keyfile.h>
27 #include <sbuild/regex.h>
28 #include <sbuild/util.h>
103 typedef std::shared_ptr<chroot>
ptr;
130 create (
const std::string& type);
151 const std::string& alias,
152 const std::string& user,
568 template <
typename T>
579 template <
typename T>
580 const std::shared_ptr<const T>
590 template <
typename T>
601 template <
typename T>
602 const std::shared_ptr<const T>
628 template <
typename T>
650 template <
typename T>
659 template <
typename T>
668 template <
typename T>
702 rhs->print_details(stream);
718 rhs->set_keyfile(keyfile);
734 rhs->get_keyfile(keyfile);
831 template <
typename T>
835 std::shared_ptr<T> ret;
837 for (
const auto& facet :
facets)
839 if (ret = std::dynamic_pointer_cast<T>(facet))
846 template <
typename T>
847 const std::shared_ptr<const T>
848 chroot::get_facet ()
const
850 std::shared_ptr<T> ret;
852 for (
const auto& facet :
facets)
854 if (ret = std::dynamic_pointer_cast<T>(facet))
858 return std::const_pointer_cast<T>(ret);
861 template <
typename T>
863 chroot::get_facet_strict ()
865 auto ret = get_facet<T>();
873 template <
typename T>
874 const std::shared_ptr<const T>
875 chroot::get_facet_strict ()
const
877 auto ret = get_facet<T>();
885 template <
typename T>
887 chroot::add_facet (std::shared_ptr<T> facet,
894 for (
const auto& facet :
facets)
896 if (std::dynamic_pointer_cast<T>(facet))
900 new_facet->set_chroot(*
this, copy);
901 facets.push_back(new_facet);
908 for (facet_list::iterator lfacet =
facets.begin();
911 facet_list::iterator current = lfacet++;
912 if ((*current)->get_name() == facet->get_name())
916 facet->set_chroot(*
this, copy);
920 template <
typename T>
922 chroot::remove_facet ()
924 for (facet_list::iterator facet =
facets.begin();
928 if (std::dynamic_pointer_cast<T>(*facet))
936 template <
typename T>
938 chroot::remove_facet (std::shared_ptr<T> facet)
943 template <
typename T>
945 chroot::replace_facet (std::shared_ptr<T> facet)