no_config_environment.hh

00001 /* vim: set sw=4 sts=4 et foldmethod=syntax : */
00002 
00003 /*
00004  * Copyright (c) 2006, 2007, 2008, 2009 Ciaran McCreesh
00005  *
00006  * This file is part of the Paludis package manager. Paludis is free software;
00007  * you can redistribute it and/or modify it under the terms of the GNU General
00008  * Public License version 2, as published by the Free Software Foundation.
00009  *
00010  * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
00011  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00012  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
00013  * details.
00014  *
00015  * You should have received a copy of the GNU General Public License along with
00016  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00017  * Place, Suite 330, Boston, MA  02111-1307  USA
00018  */
00019 
00020 #ifndef PALUDIS_GUARD_PALUDIS_ENVIRONMENT_NO_CONFIG_NO_CONFIG_ENVIRONMENT_HH
00021 #define PALUDIS_GUARD_PALUDIS_ENVIRONMENT_NO_CONFIG_NO_CONFIG_ENVIRONMENT_HH 1
00022 
00023 #include <paludis/environment_implementation.hh>
00024 #include <paludis/util/fs_entry.hh>
00025 #include <paludis/util/private_implementation_pattern.hh>
00026 #include <paludis/util/map-fwd.hh>
00027 
00028 namespace paludis
00029 {
00030     namespace n
00031     {
00032         struct accept_unstable;
00033         struct disable_metadata_cache;
00034         struct extra_accept_keywords;
00035         struct extra_params;
00036         struct extra_repository_dirs;
00037         struct master_repository_name;
00038         struct repository_dir;
00039         struct repository_type;
00040         struct write_cache;
00041     }
00042 
00043     namespace no_config_environment
00044     {
00045 #include <paludis/environments/no_config/no_config_environment-se.hh>
00046 
00047         /**
00048          * Parameters for a NoConfigEnvironment.
00049          *
00050          * \see NoConfigEnvironment
00051          * \ingroup grpnoconfigenvironment
00052          * \nosubgrouping
00053          */
00054         struct Params
00055         {
00056             NamedValue<n::accept_unstable, bool> accept_unstable;
00057             NamedValue<n::disable_metadata_cache, bool> disable_metadata_cache;
00058             NamedValue<n::extra_accept_keywords, std::string> extra_accept_keywords;
00059             NamedValue<n::extra_params, std::tr1::shared_ptr<Map<std::string, std::string> > > extra_params;
00060             NamedValue<n::extra_repository_dirs, std::tr1::shared_ptr<const FSEntrySequence> > extra_repository_dirs;
00061             NamedValue<n::master_repository_name, std::string> master_repository_name;
00062             NamedValue<n::repository_dir, FSEntry> repository_dir;
00063             NamedValue<n::repository_type, no_config_environment::RepositoryType> repository_type;
00064             NamedValue<n::write_cache, FSEntry> write_cache;
00065         };
00066     }
00067 
00068     /**
00069      * An environment that uses a single repository, with no user configuration.
00070      *
00071      * \ingroup grpnoconfigenvironment
00072      * \nosubgrouping
00073      */
00074     class PALUDIS_VISIBLE NoConfigEnvironment :
00075         public EnvironmentImplementation,
00076         private PrivateImplementationPattern<NoConfigEnvironment>,
00077         private InstantiationPolicy<NoConfigEnvironment, instantiation_method::NonCopyableTag>
00078     {
00079         private:
00080             PrivateImplementationPattern<NoConfigEnvironment>::ImpPtr & _imp;
00081 
00082             virtual void need_keys_added() const;
00083 
00084         protected:
00085             virtual void populate_sets() const;
00086 
00087         public:
00088             ///\name Basic operations
00089             ///\{
00090 
00091             NoConfigEnvironment(const no_config_environment::Params & params);
00092 
00093             virtual ~NoConfigEnvironment();
00094 
00095             ///\}
00096 
00097             ///\name NoConfigEnvironment-specific configuration options
00098             ///\{
00099 
00100             /**
00101              * What is our top level directory for our main repository?
00102              */
00103             FSEntry main_repository_dir() const;
00104 
00105             /**
00106              * Should we accept unstable keywords?
00107              */
00108             void set_accept_unstable(const bool value);
00109 
00110             ///\}
00111 
00112             ///\name NoConfigEnvironment-specific repository information
00113             ///\{
00114 
00115             /**
00116              * Fetch our 'main' repository.
00117              */
00118             std::tr1::shared_ptr<Repository> main_repository();
00119 
00120             /**
00121              * Fetch our 'main' repository.
00122              */
00123             std::tr1::shared_ptr<const Repository> main_repository() const;
00124 
00125             /**
00126              * Fetch our 'master' repository (may be zero).
00127              */
00128             std::tr1::shared_ptr<Repository> master_repository();
00129 
00130             /**
00131              * Fetch our 'master' repository (may be zero).
00132              */
00133             std::tr1::shared_ptr<const Repository> master_repository() const;
00134 
00135             ///\}
00136 
00137             virtual const Tribool want_choice_enabled(
00138                     const std::tr1::shared_ptr<const PackageID> &,
00139                     const std::tr1::shared_ptr<const Choice> &,
00140                     const UnprefixedChoiceName &
00141                     ) const
00142                 PALUDIS_ATTRIBUTE((warn_unused_result));
00143 
00144             virtual const std::string value_for_choice_parameter(
00145                     const std::tr1::shared_ptr<const PackageID> &,
00146                     const std::tr1::shared_ptr<const Choice> &,
00147                     const UnprefixedChoiceName &
00148                     ) const
00149                 PALUDIS_ATTRIBUTE((warn_unused_result));
00150 
00151             virtual std::tr1::shared_ptr<const Set<UnprefixedChoiceName> > known_choice_value_names(
00152                     const std::tr1::shared_ptr<const PackageID> &,
00153                     const std::tr1::shared_ptr<const Choice> &
00154                     ) const
00155                 PALUDIS_ATTRIBUTE((warn_unused_result));
00156 
00157             virtual std::tr1::shared_ptr<PackageDatabase> package_database()
00158                 PALUDIS_ATTRIBUTE((warn_unused_result));
00159 
00160             virtual std::tr1::shared_ptr<const PackageDatabase> package_database() const
00161                 PALUDIS_ATTRIBUTE((warn_unused_result));
00162 
00163             virtual std::string paludis_command() const
00164                 PALUDIS_ATTRIBUTE((warn_unused_result));
00165 
00166             virtual void set_paludis_command(const std::string &);
00167 
00168             virtual bool accept_license(const std::string &, const PackageID &) const
00169                 PALUDIS_ATTRIBUTE((warn_unused_result));
00170 
00171             virtual bool accept_keywords(const std::tr1::shared_ptr<const KeywordNameSet> &, const PackageID &) const
00172                 PALUDIS_ATTRIBUTE((warn_unused_result));
00173 
00174             virtual const std::tr1::shared_ptr<const Mask> mask_for_breakage(const PackageID &) const
00175                 PALUDIS_ATTRIBUTE((warn_unused_result));
00176 
00177             virtual const std::tr1::shared_ptr<const Mask> mask_for_user(const PackageID &, const bool will_be_used_for_overridden) const
00178                 PALUDIS_ATTRIBUTE((warn_unused_result));
00179 
00180             virtual bool unmasked_by_user(const PackageID &) const
00181                 PALUDIS_ATTRIBUTE((warn_unused_result));
00182 
00183             virtual std::tr1::shared_ptr<const FSEntrySequence> hook_dirs() const
00184                 PALUDIS_ATTRIBUTE((warn_unused_result));
00185 
00186             virtual const FSEntry root() const;
00187 
00188             virtual uid_t reduced_uid() const;
00189 
00190             virtual gid_t reduced_gid() const;
00191 
00192             virtual std::tr1::shared_ptr<const MirrorsSequence> mirrors(const std::string &) const
00193                 PALUDIS_ATTRIBUTE((warn_unused_result));
00194 
00195             virtual HookResult perform_hook(const Hook &) const
00196                 PALUDIS_ATTRIBUTE((warn_unused_result));
00197 
00198             virtual void add_to_world(const QualifiedPackageName &) const;
00199 
00200             virtual void add_to_world(const SetName &) const;
00201 
00202             virtual void remove_from_world(const QualifiedPackageName &) const;
00203 
00204             virtual void remove_from_world(const SetName &) const;
00205 
00206             virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > format_key() const;
00207             virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > config_location_key() const;
00208 
00209             virtual const std::tr1::shared_ptr<OutputManager> create_output_manager(
00210                     const CreateOutputManagerInfo &) const;
00211     };
00212 }
00213 
00214 #endif

Generated on Mon Sep 21 10:36:08 2009 for paludis by  doxygen 1.5.4