uninstall_task.hh

Go to the documentation of this file.
00001 /* vim: set sw=4 sts=4 et foldmethod=syntax : */
00002 
00003 /*
00004  * Copyright (c) 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_UNINSTALL_TASK_HH
00021 #define PALUDIS_GUARD_PALUDIS_UNINSTALL_TASK_HH 1
00022 
00023 #include <paludis/dep_spec-fwd.hh>
00024 #include <paludis/dep_tree.hh>
00025 #include <paludis/package_id.hh>
00026 #include <paludis/util/instantiation_policy.hh>
00027 #include <paludis/util/private_implementation_pattern.hh>
00028 #include <paludis/util/exception.hh>
00029 #include <paludis/util/wrapped_forward_iterator-fwd.hh>
00030 
00031 /** \file
00032  * Declarations for UninstallTask.
00033  *
00034  * \ingroup g_tasks
00035  *
00036  * \section Examples
00037  *
00038  * - None at this time.
00039  */
00040 
00041 namespace paludis
00042 {
00043     class Environment;
00044     class UninstallListEntry;
00045 
00046     /**
00047      * Thrown if an ambiguous unmerge target is supplied.
00048      *
00049      * \ingroup g_exceptions
00050      * \ingroup g_tasks
00051      */
00052     class PALUDIS_VISIBLE AmbiguousUnmergeTargetError :
00053         public Exception
00054     {
00055         private:
00056             const std::string _t;
00057             const std::tr1::shared_ptr<const PackageIDSequence> _p;
00058 
00059         public:
00060             ///\name Basic operations
00061             ///\{
00062 
00063             AmbiguousUnmergeTargetError(const std::string & our_target,
00064                     const std::tr1::shared_ptr<const PackageIDSequence> matches) throw ();
00065 
00066             ~AmbiguousUnmergeTargetError() throw ();
00067 
00068             ///\}
00069 
00070             ///\name Iterate over our entries
00071             ///\{
00072 
00073             struct ConstIteratorTag;
00074             typedef WrappedForwardIterator<ConstIteratorTag, const std::tr1::shared_ptr<const PackageID> > ConstIterator;
00075             ConstIterator begin() const;
00076             ConstIterator end() const;
00077 
00078             ///\}
00079 
00080             /**
00081              * What was our target?
00082              */
00083             std::string target() const;
00084     };
00085 
00086     /**
00087      * Task used to uninstall one or more targets.
00088      *
00089      * \ingroup g_tasks
00090      * \nosubgrouping
00091      */
00092     class PALUDIS_VISIBLE UninstallTask :
00093         PrivateImplementationPattern<UninstallTask>,
00094         InstantiationPolicy<UninstallTask, instantiation_method::NonCopyableTag>
00095     {
00096         protected:
00097             ///\name Basic operations
00098             ///\{
00099 
00100             UninstallTask(Environment * const env);
00101 
00102             ///\}
00103 
00104         public:
00105             ///\name Basic operations
00106             ///\{
00107 
00108             virtual ~UninstallTask();
00109 
00110             ///\}
00111 
00112             ///\name Behaviour options
00113             ///\{
00114 
00115             void set_pretend(const bool value);
00116             void set_preserve_world(const bool value);
00117             void set_all_versions(const bool value);
00118             void set_with_unused_dependencies(const bool value);
00119             void set_with_dependencies(const bool value);
00120             void set_check_safety(const bool value);
00121 
00122             ///\}
00123 
00124             ///\name Add targets
00125             ///\{
00126 
00127             void add_target(const std::string &);
00128             void add_unused();
00129 
00130             ///\}
00131 
00132             ///\name Event callbacks
00133             ///\{
00134 
00135             virtual void on_build_unmergelist_pre() = 0;
00136             virtual void on_build_unmergelist_post() = 0;
00137 
00138             virtual void on_display_unmerge_list_pre() = 0;
00139             virtual void on_display_unmerge_list_post() = 0;
00140             virtual void on_display_unmerge_list_entry(const UninstallListEntry &) = 0;
00141 
00142             virtual void on_uninstall_all_pre() = 0;
00143             virtual void on_uninstall_pre(const UninstallListEntry &) = 0;
00144             virtual void on_uninstall_post(const UninstallListEntry &) = 0;
00145             virtual void on_uninstall_all_post() = 0;
00146 
00147             virtual void on_not_continuing_due_to_errors() = 0;
00148 
00149             virtual void on_update_world_pre() = 0;
00150             virtual void on_update_world(const PackageDepSpec &) = 0;
00151             virtual void on_update_world(const SetName &) = 0;
00152             virtual void on_update_world_post() = 0;
00153             virtual void on_preserve_world() = 0;
00154 
00155             ///\}
00156 
00157             ///\name Logic
00158             ///\{
00159 
00160             virtual void world_remove_set(const SetName &);
00161             virtual void world_remove_packages(const std::tr1::shared_ptr<const SetSpecTree::ConstItem> &);
00162 
00163             ///\}
00164 
00165             /**
00166              * Run the task.
00167              */
00168             void execute();
00169     };
00170 }
00171 
00172 #endif

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