ndbam_merger.hh

00001 /* vim: set sw=4 sts=4 et foldmethod=syntax : */
00002 
00003 /*
00004  * Copyright (c) 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_REPOSITORIES_UNPACKAGED_NDBAM_MERGER_HH
00021 #define PALUDIS_GUARD_PALUDIS_REPOSITORIES_UNPACKAGED_NDBAM_MERGER_HH 1
00022 
00023 #include <paludis/merger.hh>
00024 #include <paludis/package_id-fwd.hh>
00025 #include <paludis/util/named_value.hh>
00026 #include <paludis/output_manager-fwd.hh>
00027 #include <tr1/functional>
00028 
00029 namespace paludis
00030 {
00031     namespace n
00032     {
00033         struct config_protect;
00034         struct config_protect_mask;
00035         struct contents_file;
00036         struct environment;
00037         struct get_new_ids_or_minus_one;
00038         struct image;
00039         struct install_under;
00040         struct options;
00041         struct output_manager;
00042         struct package_id;
00043         struct root;
00044     }
00045 
00046     struct NDBAMMergerParams
00047     {
00048         NamedValue<n::config_protect, std::string> config_protect;
00049         NamedValue<n::config_protect_mask, std::string> config_protect_mask;
00050         NamedValue<n::contents_file, FSEntry> contents_file;
00051         NamedValue<n::environment, Environment *> environment;
00052         NamedValue<n::get_new_ids_or_minus_one, std::tr1::function<std::pair<uid_t, gid_t> (const FSEntry &)> > get_new_ids_or_minus_one;
00053         NamedValue<n::image, FSEntry> image;
00054         NamedValue<n::install_under, FSEntry> install_under;
00055         NamedValue<n::options, MergerOptions> options;
00056         NamedValue<n::output_manager, std::tr1::shared_ptr<OutputManager> > output_manager;
00057         NamedValue<n::package_id, std::tr1::shared_ptr<const PackageID> > package_id;
00058         NamedValue<n::root, FSEntry> root;
00059     };
00060 
00061     /**
00062      * Merger subclass for NDBAM.
00063      *
00064      * \ingroup g_ndbam
00065      * \since 0.26
00066      */
00067     class PALUDIS_VISIBLE NDBAMMerger :
00068         public Merger,
00069         private PrivateImplementationPattern<NDBAMMerger>
00070     {
00071         private:
00072             void display_override(const std::string &) const;
00073             std::string make_arrows(const MergeStatusFlags &) const;
00074 
00075             PrivateImplementationPattern<NDBAMMerger>::ImpPtr & _imp;
00076 
00077         public:
00078             NDBAMMerger(const NDBAMMergerParams &);
00079             ~NDBAMMerger();
00080 
00081             virtual Hook extend_hook(const Hook &);
00082 
00083             virtual void record_install_file(const FSEntry &, const FSEntry &, const std::string &, const MergeStatusFlags &);
00084             virtual void record_install_dir(const FSEntry &, const FSEntry &, const MergeStatusFlags &);
00085             virtual void record_install_under_dir(const FSEntry &, const MergeStatusFlags &);
00086             virtual void record_install_sym(const FSEntry &, const FSEntry &, const MergeStatusFlags &);
00087 
00088             virtual void on_error(bool is_check, const std::string &);
00089             virtual void on_warn(bool is_check, const std::string &);
00090             virtual void on_enter_dir(bool is_check, const FSEntry);
00091 
00092             virtual bool config_protected(const FSEntry &, const FSEntry &);
00093             virtual std::string make_config_protect_name(const FSEntry &, const FSEntry &);
00094 
00095             virtual void merge();
00096             virtual bool check();
00097     };
00098 }
00099 
00100 #endif

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