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 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 std::tr1::shared_ptr<SetSpecTree::ConstItem> local_set(const SetName &) const
00051                 PALUDIS_ATTRIBUTE((warn_unused_result));
00052 
00053             virtual std::tr1::shared_ptr<SetSpecTree::ConstItem> world_set() const
00054                 PALUDIS_ATTRIBUTE((warn_unused_result));
00055 
00056             virtual void need_keys_added() const;
00057 
00058         public:
00059             ///\name Basic operations
00060             ///\{
00061 
00062             TestEnvironment();
00063             TestEnvironment(const FSEntry &);
00064 
00065             ~TestEnvironment();
00066 
00067             ///\}
00068 
00069             virtual std::tr1::shared_ptr<PackageDatabase> package_database()
00070                 PALUDIS_ATTRIBUTE((warn_unused_result));
00071 
00072             virtual std::tr1::shared_ptr<const PackageDatabase> package_database() const
00073                 PALUDIS_ATTRIBUTE((warn_unused_result));
00074 
00075             virtual std::string paludis_command() const
00076                 PALUDIS_ATTRIBUTE((warn_unused_result));
00077 
00078             virtual void set_paludis_command(const std::string &);
00079 
00080             /**
00081              * Convenience way of getting a package id.
00082              */
00083             const std::tr1::shared_ptr<const PackageID> fetch_package_id(const QualifiedPackageName &,
00084                     const VersionSpec &, const RepositoryName &) const PALUDIS_ATTRIBUTE((warn_unused_result));
00085 
00086             virtual bool accept_license(const std::string &, const PackageID &) const
00087                 PALUDIS_ATTRIBUTE((warn_unused_result));
00088 
00089             virtual bool accept_keywords(const std::tr1::shared_ptr<const KeywordNameSet> &, const PackageID &) const
00090                 PALUDIS_ATTRIBUTE((warn_unused_result));
00091 
00092             virtual const std::tr1::shared_ptr<const Mask> mask_for_breakage(const PackageID &) const
00093                 PALUDIS_ATTRIBUTE((warn_unused_result));
00094 
00095             virtual const std::tr1::shared_ptr<const Mask> mask_for_user(const PackageID &) const
00096                 PALUDIS_ATTRIBUTE((warn_unused_result));
00097 
00098             virtual bool unmasked_by_user(const PackageID &) const
00099                 PALUDIS_ATTRIBUTE((warn_unused_result));
00100 
00101             virtual std::tr1::shared_ptr<const FSEntrySequence> hook_dirs() const
00102                 PALUDIS_ATTRIBUTE((warn_unused_result));
00103 
00104             virtual const FSEntry root() const;
00105 
00106             virtual uid_t reduced_uid() const;
00107 
00108             virtual gid_t reduced_gid() const;
00109 
00110             virtual std::tr1::shared_ptr<const MirrorsSequence> mirrors(const std::string &) const
00111                 PALUDIS_ATTRIBUTE((warn_unused_result));
00112 
00113             virtual HookResult perform_hook(const Hook &) const
00114                 PALUDIS_ATTRIBUTE((warn_unused_result));
00115 
00116             virtual void add_to_world(const QualifiedPackageName &) const;
00117 
00118             virtual void add_to_world(const SetName &) const;
00119 
00120             virtual void remove_from_world(const QualifiedPackageName &) const;
00121 
00122             virtual void remove_from_world(const SetName &) const;
00123 
00124             virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > format_key() const;
00125             virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > config_location_key() const;
00126 
00127             void add_set(const SetName &, const std::string &);
00128 
00129             virtual const Tribool want_choice_enabled(
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     };
00143 }
00144 
00145 #endif

Generated on Mon Dec 22 19:43:50 2008 for paludis by  doxygen 1.5.7.1