00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef PALUDIS_GUARD_PALUDIS_OUTPUT_MANAGER_FACTORY_HH
00021 #define PALUDIS_GUARD_PALUDIS_OUTPUT_MANAGER_FACTORY_HH 1
00022
00023 #include <paludis/output_manager_factory-fwd.hh>
00024 #include <paludis/util/attributes.hh>
00025 #include <paludis/util/private_implementation_pattern.hh>
00026 #include <paludis/util/instantiation_policy.hh>
00027 #include <paludis/util/wrapped_forward_iterator-fwd.hh>
00028 #include <paludis/util/map-fwd.hh>
00029 #include <paludis/output_manager-fwd.hh>
00030 #include <paludis/util/set-fwd.hh>
00031 #include <tr1/functional>
00032 #include <tr1/memory>
00033
00034 namespace paludis
00035 {
00036 class PALUDIS_VISIBLE OutputManagerFactory :
00037 private PrivateImplementationPattern<OutputManagerFactory>,
00038 public InstantiationPolicy<OutputManagerFactory, instantiation_method::SingletonTag>
00039 {
00040 friend class InstantiationPolicy<OutputManagerFactory, instantiation_method::SingletonTag>;
00041
00042 private:
00043 OutputManagerFactory();
00044 ~OutputManagerFactory();
00045
00046 public:
00047 typedef std::tr1::function<std::string (const std::string &)> KeyFunction;
00048
00049 typedef std::tr1::function<const std::tr1::shared_ptr<OutputManager> (
00050 const std::string &)> CreateChildFunction;
00051
00052 typedef std::tr1::function<std::string (
00053 const std::string & pattern,
00054 const std::tr1::shared_ptr<const Map<std::string, std::string> > & extra_vars)> ReplaceVarsFunc;
00055
00056 typedef std::tr1::function<const std::tr1::shared_ptr<OutputManager>(
00057 const KeyFunction &,
00058 const CreateChildFunction &,
00059 const ReplaceVarsFunc &
00060 )> CreateFunction;
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079 const std::tr1::shared_ptr<OutputManager> create(
00080 const KeyFunction & key_function,
00081 const CreateChildFunction & create_child_function,
00082 const ReplaceVarsFunc & replace_vars_func
00083 ) const PALUDIS_ATTRIBUTE((warn_unused_result));
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093 void add_manager(
00094 const std::tr1::shared_ptr<const Set<std::string> > & managers,
00095 const CreateFunction & create_function
00096 );
00097
00098 struct ConstIteratorTag;
00099 typedef WrappedForwardIterator<ConstIteratorTag, const std::string> ConstIterator;
00100 ConstIterator begin_keys() const PALUDIS_ATTRIBUTE((warn_unused_result));
00101 ConstIterator end_keys() const PALUDIS_ATTRIBUTE((warn_unused_result));
00102 };
00103
00104 #ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
00105 extern template class PrivateImplementationPattern<OutputManagerFactory>;
00106 extern template class InstantiationPolicy<OutputManagerFactory, instantiation_method::SingletonTag>;
00107 #endif
00108 }
00109
00110 #endif