00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef PALUDIS_GUARD_PALUDIS_MERGER_UNMERGER_HH
00022 #define PALUDIS_GUARD_PALUDIS_MERGER_UNMERGER_HH 1
00023
00024 #include <paludis/util/exception.hh>
00025 #include <paludis/util/fs_entry.hh>
00026 #include <paludis/util/private_implementation_pattern.hh>
00027 #include <paludis/util/named_value.hh>
00028 #include <paludis/merger_entry_type.hh>
00029 #include <paludis/contents-fwd.hh>
00030 #include <tr1/functional>
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 namespace paludis
00044 {
00045 class Hook;
00046 class Environment;
00047
00048 namespace n
00049 {
00050 struct environment;
00051 struct ignore;
00052 struct root;
00053 }
00054
00055
00056
00057
00058
00059
00060
00061
00062 struct UnmergerOptions
00063 {
00064 NamedValue<n::environment, const Environment *> environment;
00065 NamedValue<n::ignore, const std::tr1::function<bool (const FSEntry &)> > ignore;
00066 NamedValue<n::root, FSEntry> root;
00067 };
00068
00069
00070
00071
00072
00073
00074
00075
00076 class PALUDIS_VISIBLE UnmergerError :
00077 public Exception
00078 {
00079 public:
00080
00081
00082
00083 UnmergerError(const std::string & msg) throw ();
00084
00085
00086 };
00087
00088
00089
00090
00091
00092
00093
00094 class PALUDIS_VISIBLE Unmerger :
00095 private PrivateImplementationPattern<Unmerger>
00096 {
00097 protected:
00098
00099
00100
00101 Unmerger(const UnmergerOptions &);
00102
00103
00104
00105
00106
00107
00108 void add_unmerge_entry(const EntryType, const std::tr1::shared_ptr<const ContentsEntry> &);
00109
00110
00111
00112
00113 virtual void populate_unmerge_set() = 0;
00114
00115
00116
00117
00118 virtual Hook extend_hook(const Hook &) const;
00119
00120
00121
00122
00123 virtual void unmerge_file(const std::tr1::shared_ptr<const ContentsEntry> &) const;
00124 virtual void unmerge_dir(const std::tr1::shared_ptr<const ContentsEntry> &) const;
00125 virtual void unmerge_sym(const std::tr1::shared_ptr<const ContentsEntry> &) const;
00126 virtual void unmerge_misc(const std::tr1::shared_ptr<const ContentsEntry> &) const;
00127
00128
00129
00130
00131
00132
00133 virtual bool check_file(const std::tr1::shared_ptr<const ContentsEntry> &) const;
00134 virtual bool check_dir(const std::tr1::shared_ptr<const ContentsEntry> &) const;
00135 virtual bool check_sym(const std::tr1::shared_ptr<const ContentsEntry> &) const;
00136 virtual bool check_misc(const std::tr1::shared_ptr<const ContentsEntry> &) const;
00137
00138
00139
00140
00141
00142
00143 virtual void unlink_file(FSEntry, const std::tr1::shared_ptr<const ContentsEntry> &) const;
00144 virtual void unlink_dir(FSEntry, const std::tr1::shared_ptr<const ContentsEntry> &) const;
00145 virtual void unlink_sym(FSEntry, const std::tr1::shared_ptr<const ContentsEntry> &) const;
00146 virtual void unlink_misc(FSEntry, const std::tr1::shared_ptr<const ContentsEntry> &) const;
00147
00148
00149
00150 virtual void display(const std::string &) const = 0;
00151
00152 public:
00153
00154
00155
00156 virtual ~Unmerger() = 0;
00157
00158
00159
00160
00161
00162
00163 void unmerge();
00164 };
00165 }
00166
00167 #endif