test_environment.hh

Go to the documentation of this file.
00001 /* vim: set sw=4 sts=4 et foldmethod=syntax : */
00002 
00003 /*
00004  * Copyright (c) 2005, 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_TEST_ENVIRONMENT_HH
00021 #define PALUDIS_GUARD_PALUDIS_TEST_ENVIRONMENT_HH 1
00022 
00023 #include <paludis/environment_implementation.hh>
00024 #include <paludis/version_spec-fwd.hh>
00025 #include <paludis/util/private_implementation_pattern.hh>
00026 
00027 /** \file
00028  * Declarations for the TestEnvironment class.
00029  *
00030  * \ingroup grptestenvironment
00031  */
00032 
00033 namespace paludis
00034 {
00035     /**
00036      * A TestEnvironment is an environment used during testing that lets us
00037      * control all the options rather than reading them from configuration
00038      * files.
00039      *
00040      * \ingroup grptestenvironment
00041      */
00042     class PALUDIS_VISIBLE TestEnvironment :
00043         private PrivateImplementationPattern<TestEnvironment>,
00044         public EnvironmentImplementation
00045     {
00046         private:
00047             PrivateImplementationPattern<TestEnvironment>::ImpPtr & _imp;
00048 
00049         protected:
00050             virtual void need_keys_added() const;
00051             virtual void populate_sets() const;
00052 
00053         public:
00054             ///\name Basic operations
00055             ///\{
00056 
00057             TestEnvironment();
00058             TestEnvironment(const FSEntry &);
00059 
00060             ~TestEnvironment();
00061 
00062             ///\}
00063 
00064             virtual std::tr1::shared_ptr<PackageDatabase> package_database()
00065                 PALUDIS_ATTRIBUTE((warn_unused_result));
00066 
00067             virtual std::tr1::shared_ptr<const PackageDatabase> package_database() const
00068                 PALUDIS_ATTRIBUTE((warn_unused_result));
00069 
00070             virtual std::string paludis_command() const
00071                 PALUDIS_ATTRIBUTE((warn_unused_result));
00072 
00073             virtual void set_paludis_command(const std::string &);
00074 
00075             /**
00076              * Convenience way of getting a package id.
00077              */
00078             const std::tr1::shared_ptr<const PackageID> fetch_package_id(const QualifiedPackageName &,
00079                     const VersionSpec &, const RepositoryName &) const PALUDIS_ATTRIBUTE((warn_unused_result));
00080 
00081             virtual bool accept_license(const std::string &, const PackageID &) const
00082                 PALUDIS_ATTRIBUTE((warn_unused_result));
00083 
00084             virtual bool accept_keywords(const std::tr1::shared_ptr<const KeywordNameSet> &, const PackageID &) const
00085                 PALUDIS_ATTRIBUTE((warn_unused_result));
00086 
00087             virtual const std::tr1::shared_ptr<const Mask> mask_for_breakage(const PackageID &) const
00088                 PALUDIS_ATTRIBUTE((warn_unused_result));
00089 
00090             virtual const std::tr1::shared_ptr<const Mask> mask_for_user(const PackageID &, const bool) const
00091                 PALUDIS_ATTRIBUTE((warn_unused_result));
00092 
00093             virtual bool unmasked_by_user(const PackageID &) const
00094                 PALUDIS_ATTRIBUTE((warn_unused_result));
00095 
00096             virtual std::tr1::shared_ptr<const FSEntrySequence> hook_dirs() const
00097                 PALUDIS_ATTRIBUTE((warn_unused_result));
00098 
00099             virtual const FSEntry root() const;
00100 
00101             virtual uid_t reduced_uid() const;
00102 
00103             virtual gid_t reduced_gid() const;
00104 
00105             virtual std::tr1::shared_ptr<const MirrorsSequence> mirrors(const std::string &) const
00106                 PALUDIS_ATTRIBUTE((warn_unused_result));
00107 
00108             virtual HookResult perform_hook(const Hook &) const
00109                 PALUDIS_ATTRIBUTE((warn_unused_result));
00110 
00111             virtual void add_to_world(const QualifiedPackageName &) const;
00112 
00113             virtual void add_to_world(const SetName &) const;
00114 
00115             virtual void remove_from_world(const QualifiedPackageName &) const;
00116 
00117             virtual void remove_from_world(const SetName &) const;
00118 
00119             virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > format_key() const;
00120             virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > config_location_key() const;
00121 
00122             virtual const Tribool want_choice_enabled(
00123                     const std::tr1::shared_ptr<const PackageID> &,
00124                     const std::tr1::shared_ptr<const Choice> &,
00125                     const UnprefixedChoiceName &
00126                     ) const
00127                 PALUDIS_ATTRIBUTE((warn_unused_result));
00128 
00129             virtual const std::string value_for_choice_parameter(
00130                     const std::tr1::shared_ptr<const PackageID> &,
00131                     const std::tr1::shared_ptr<const Choice> &,
00132                     const UnprefixedChoiceName &
00133                     ) const
00134                 PALUDIS_ATTRIBUTE((warn_unused_result));
00135 
00136             virtual std::tr1::shared_ptr<const Set<UnprefixedChoiceName> > known_choice_value_names(
00137                     const std::tr1::shared_ptr<const PackageID> &,
00138                     const std::tr1::shared_ptr<const Choice> &
00139                     ) const
00140                 PALUDIS_ATTRIBUTE((warn_unused_result));
00141 
00142             virtual const std::tr1::shared_ptr<OutputManager> create_output_manager(
00143                     const CreateOutputManagerInfo &) const;
00144 
00145             void set_want_choice_enabled(const ChoicePrefixName &, const UnprefixedChoiceName &, const Tribool);
00146     };
00147 }
00148 
00149 #endif

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