00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef PALUDIS_GUARD_PALUDIS_HOOKER_HH
00021 #define PALUDIS_GUARD_PALUDIS_HOOKER_HH 1
00022
00023 #include <paludis/util/instantiation_policy.hh>
00024 #include <paludis/util/private_implementation_pattern.hh>
00025 #include <paludis/util/graph-fwd.hh>
00026 #include <paludis/util/sequence-fwd.hh>
00027 #include <tr1/memory>
00028 #include <string>
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 namespace paludis
00041 {
00042 class FSEntry;
00043 class Environment;
00044 class Hook;
00045 class HookResult;
00046
00047
00048
00049
00050
00051
00052
00053 class PALUDIS_VISIBLE HookFile :
00054 private InstantiationPolicy<HookFile, instantiation_method::NonCopyableTag>
00055 {
00056 public:
00057
00058
00059
00060 virtual ~HookFile();
00061
00062
00063
00064 virtual HookResult run(const Hook &) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
00065 virtual const FSEntry file_name() const = 0;
00066 virtual void add_dependencies(const Hook &, DirectedGraph<std::string, int> &) = 0;
00067 virtual const std::tr1::shared_ptr<const Sequence<std::string> > auto_hook_names() const = 0;
00068 };
00069
00070
00071
00072
00073
00074
00075
00076 class PALUDIS_VISIBLE Hooker :
00077 private PrivateImplementationPattern<Hooker>,
00078 private InstantiationPolicy<Hooker, instantiation_method::NonCopyableTag>
00079 {
00080 private:
00081 std::tr1::shared_ptr<Sequence<std::tr1::shared_ptr<HookFile> > > _find_hooks(const Hook &) const;
00082
00083 public:
00084
00085
00086
00087 Hooker(const Environment * const) PALUDIS_ATTRIBUTE((nonnull(1)));
00088 ~Hooker();
00089
00090
00091
00092
00093
00094
00095 HookResult perform_hook(const Hook &) const PALUDIS_ATTRIBUTE((warn_unused_result));
00096
00097
00098
00099
00100 void add_dir(const FSEntry &, const bool output_prefixed);
00101 };
00102 }
00103
00104 #endif