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

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