00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef PALUDIS_GUARD_PALUDIS_ENVIRONMENT_FACTORY_HH
00021 #define PALUDIS_GUARD_PALUDIS_ENVIRONMENT_FACTORY_HH 1
00022
00023 #include <paludis/environment_factory-fwd.hh>
00024 #include <paludis/util/attributes.hh>
00025 #include <paludis/util/instantiation_policy.hh>
00026 #include <paludis/util/private_implementation_pattern.hh>
00027 #include <paludis/util/set-fwd.hh>
00028 #include <paludis/util/fs_entry-fwd.hh>
00029 #include <paludis/environment-fwd.hh>
00030 #include <tr1/memory>
00031 #include <tr1/functional>
00032
00033 namespace paludis
00034 {
00035 class PALUDIS_VISIBLE FallBackToAnotherFormatError
00036 {
00037 };
00038
00039
00040
00041
00042
00043
00044
00045 class PALUDIS_VISIBLE EnvironmentFactory :
00046 private PrivateImplementationPattern<EnvironmentFactory>,
00047 public InstantiationPolicy<EnvironmentFactory, instantiation_method::SingletonTag>
00048 {
00049 friend class InstantiationPolicy<EnvironmentFactory, instantiation_method::SingletonTag>;
00050
00051 private:
00052 EnvironmentFactory();
00053 ~EnvironmentFactory();
00054
00055 void _load_dir(const FSEntry &);
00056
00057 public:
00058 typedef std::tr1::function<const std::tr1::shared_ptr<Environment>(const std::string &)> CreateFunction;
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074 const std::tr1::shared_ptr<Environment> create(const std::string & spec) const
00075 PALUDIS_ATTRIBUTE((warn_unused_result));
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085 void add_environment_format(
00086 const std::tr1::shared_ptr<const Set<std::string> > & formats,
00087 const CreateFunction & create_function
00088 );
00089 };
00090
00091 #ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
00092 extern template class PrivateImplementationPattern<EnvironmentFactory>;
00093 extern template class InstantiationPolicy<EnvironmentFactory, instantiation_method::SingletonTag>;
00094 #endif
00095 }
00096
00097 #endif