ndbam_unmerger.hh

00001 /* vim: set sw=4 sts=4 et foldmethod=syntax : */
00002 
00003 /*
00004  * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
00005  * Copyright (c) 2007 Piotr JaroszyƄski
00006  *
00007  * This file is part of the Paludis package manager. Paludis is free software;
00008  * you can redistribute it and/or modify it under the terms of the GNU General
00009  * Public License version 2, as published by the Free Software Foundation.
00010  *
00011  * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
00012  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00013  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
00014  * details.
00015  *
00016  * You should have received a copy of the GNU General Public License along with
00017  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00018  * Place, Suite 330, Boston, MA  02111-1307  USA
00019  */
00020 
00021 #ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_UNPACKAGED_NDBAM_UNMERGER_HH
00022 #define PALUDIS_GUARD_PALUDIS_REPOSITORIES_UNPACKAGED_NDBAM_UNMERGER_HH 1
00023 
00024 #include <paludis/util/private_implementation_pattern.hh>
00025 #include <paludis/util/fs_entry.hh>
00026 #include <paludis/output_manager-fwd.hh>
00027 #include <paludis/unmerger.hh>
00028 #include <paludis/environment-fwd.hh>
00029 #include <paludis/package_id-fwd.hh>
00030 #include <tr1/functional>
00031 
00032 namespace paludis
00033 {
00034     namespace n
00035     {
00036         struct config_protect;
00037         struct config_protect_mask;
00038         struct contents_file;
00039         struct environment;
00040         struct ignore;
00041         struct ndbam;
00042         struct output_manager;
00043         struct package_id;
00044         struct root;
00045     }
00046 
00047     class NDBAM;
00048 
00049     struct NDBAMUnmergerOptions
00050     {
00051         NamedValue<n::config_protect, std::string> config_protect;
00052         NamedValue<n::config_protect_mask, std::string> config_protect_mask;
00053         NamedValue<n::contents_file, FSEntry> contents_file;
00054         NamedValue<n::environment, const Environment *> environment;
00055         NamedValue<n::ignore, const std::tr1::function<bool (const FSEntry &)> > ignore;
00056         NamedValue<n::ndbam, const NDBAM *> ndbam;
00057         NamedValue<n::output_manager, std::tr1::shared_ptr<OutputManager> > output_manager;
00058         NamedValue<n::package_id, std::tr1::shared_ptr<const PackageID> > package_id;
00059         NamedValue<n::root, FSEntry> root;
00060     };
00061 
00062     class PALUDIS_VISIBLE NDBAMUnmergerError :
00063         public UnmergerError
00064     {
00065         public:
00066             NDBAMUnmergerError(const std::string &) throw ();
00067     };
00068 
00069     /**
00070      * Unmerger implementation for NDBAM.
00071      *
00072      * \ingroup g_ndbam
00073      * \since 0.26
00074      */
00075     class PALUDIS_VISIBLE NDBAMUnmerger :
00076         public Unmerger,
00077         private PrivateImplementationPattern<NDBAMUnmerger>
00078     {
00079         private:
00080             Implementation<NDBAMUnmerger> * _imp;
00081 
00082             void _add_file(const std::tr1::shared_ptr<const ContentsEntry> &);
00083             void _add_dir(const std::tr1::shared_ptr<const ContentsEntry> &);
00084             void _add_sym(const std::tr1::shared_ptr<const ContentsEntry> &);
00085 
00086         protected:
00087             bool config_protected(const FSEntry &) const;
00088             std::string make_tidy(const FSEntry &) const;
00089 
00090             void populate_unmerge_set();
00091 
00092             void display(const std::string &) const;
00093 
00094             bool check_file(const std::tr1::shared_ptr<const ContentsEntry> &) const;
00095             bool check_dir(const std::tr1::shared_ptr<const ContentsEntry> &) const;
00096             bool check_sym(const std::tr1::shared_ptr<const ContentsEntry> &) const;
00097             bool check_misc(const std::tr1::shared_ptr<const ContentsEntry> &) const;
00098 
00099         public:
00100             ///\name Basic operations
00101             ///\{
00102 
00103             NDBAMUnmerger(const NDBAMUnmergerOptions &);
00104             ~NDBAMUnmerger();
00105 
00106             ///\}
00107 
00108             virtual Hook extend_hook(const Hook &) const;
00109     };
00110 }
00111 
00112 #endif

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