mask.hh

Go to the documentation of this file.
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_MASK_HH
00021 #define PALUDIS_GUARD_PALUDIS_MASK_HH 1
00022 
00023 #include <paludis/mask-fwd.hh>
00024 #include <paludis/metadata_key-fwd.hh>
00025 #include <paludis/package_id-fwd.hh>
00026 #include <paludis/util/simple_visitor.hh>
00027 #include <paludis/util/attributes.hh>
00028 #include <paludis/util/fs_entry.hh>
00029 #include <paludis/util/sequence-fwd.hh>
00030 #include <paludis/util/named_value.hh>
00031 #include <paludis/util/type_list.hh>
00032 #include <string>
00033 
00034 /** \file
00035  * Declarations for mask classes.
00036  *
00037  * \ingroup g_mask
00038  *
00039  * \section Examples
00040  *
00041  * - \ref example_mask.cc "example_mask.cc" (for masks)
00042  */
00043 
00044 namespace paludis
00045 {
00046     namespace n
00047     {
00048         struct comment;
00049         struct mask;
00050         struct mask_file;
00051         struct override_reason;
00052     }
00053 
00054     /**
00055      * Information about a RepositoryMask.
00056      *
00057      * The mask_file key holds the file whence the mask originates.
00058      *
00059      * The comment key is a sequence of lines explaining the mask.
00060      *
00061      * \ingroup g_package_id
00062      * \since 0.30
00063      * \nosubgrouping
00064      */
00065     struct RepositoryMaskInfo
00066     {
00067         NamedValue<n::comment, std::tr1::shared_ptr<const Sequence<std::string> > > comment;
00068         NamedValue<n::mask_file, FSEntry> mask_file;
00069     };
00070 
00071     /**
00072      * A Mask represents one reason why a PackageID is masked (not available to
00073      * be installed).
00074      *
00075      * A basic Mask has:
00076      *
00077      * - A single character key, which can be used by clients if they need a
00078      *   very compact way of representing a mask.
00079      *
00080      * - A description.
00081      *
00082      * Subclasses provide additional information.
00083      *
00084      * \ingroup g_mask
00085      * \since 0.26
00086      * \nosubgrouping
00087      */
00088     class PALUDIS_VISIBLE Mask :
00089         public virtual DeclareAbstractAcceptMethods<Mask, MakeTypeList<
00090             UserMask, UnacceptedMask, RepositoryMask, UnsupportedMask, AssociationMask>::Type>
00091     {
00092         public:
00093             ///\name Basic operations
00094             ///\{
00095 
00096             virtual ~Mask() = 0;
00097 
00098             ///\}
00099 
00100             /**
00101              * A single character key, which can be used by clients if they need
00102              * a very compact way of representing a mask.
00103              */
00104             virtual char key() const = 0;
00105 
00106             /**
00107              * A description of the mask.
00108              */
00109             virtual const std::string description() const = 0;
00110     };
00111 
00112     /**
00113      * A UserMask is a Mask due to user configuration.
00114      *
00115      * \ingroup g_mask
00116      * \since 0.26
00117      * \nosubgrouping
00118      */
00119     class PALUDIS_VISIBLE UserMask :
00120         public Mask,
00121         public ImplementAcceptMethods<Mask, UserMask>
00122     {
00123     };
00124 
00125     /**
00126      * An UnacceptedMask is a Mask that signifies that a particular value or
00127      * combination of values in (for example) a MetadataCollectionKey or
00128      * MetadataSpecTreeKey is not accepted by user configuration.
00129      *
00130      * \ingroup g_mask
00131      * \since 0.26
00132      * \nosubgrouping
00133      */
00134     class PALUDIS_VISIBLE UnacceptedMask :
00135         public Mask,
00136         public ImplementAcceptMethods<Mask, UnacceptedMask>
00137     {
00138         public:
00139             /**
00140              * Fetch the metadata key that is not accepted.
00141              */
00142             virtual const std::tr1::shared_ptr<const MetadataKey> unaccepted_key() const = 0;
00143     };
00144 
00145     /**
00146      * A RepositoryMask is a Mask that signifies that a PackageID has been
00147      * marked as masked by a Repository.
00148      *
00149      * \ingroup g_mask
00150      * \since 0.26
00151      * \nosubgrouping
00152      */
00153     class PALUDIS_VISIBLE RepositoryMask :
00154         public Mask,
00155         public ImplementAcceptMethods<Mask, RepositoryMask>
00156     {
00157         public:
00158             /**
00159              * Fetch a metadata key explaining the mask. May return a zero
00160              * pointer, if no more information is available.
00161              */
00162             virtual const std::tr1::shared_ptr<const MetadataKey> mask_key() const = 0;
00163     };
00164 
00165     /**
00166      * An UnsupportedMask is a Mask that signifies that a PackageID is not
00167      * supported, for example because it is broken or because it uses an
00168      * unrecognised EAPI.
00169      *
00170      * \ingroup g_mask
00171      * \since 0.26
00172      * \nosubgrouping
00173      */
00174     class PALUDIS_VISIBLE UnsupportedMask :
00175         public Mask,
00176         public ImplementAcceptMethods<Mask, UnsupportedMask>
00177     {
00178         public:
00179             /**
00180              * An explanation of why we are unsupported.
00181              */
00182             virtual const std::string explanation() const = 0;
00183     };
00184 
00185     /**
00186      * An AssociationMask is a Mask that signifies that a PackageID is masked
00187      * because of its association with another PackageID that is itself masked.
00188      *
00189      * This is used by old-style virtuals. If the provider of a virtual is
00190      * masked then the virtual itself is masked by association.
00191      *
00192      * \ingroup g_mask
00193      * \since 0.26
00194      * \nosubgrouping
00195      */
00196     class PALUDIS_VISIBLE AssociationMask :
00197         public Mask,
00198         public ImplementAcceptMethods<Mask, AssociationMask>
00199     {
00200         public:
00201             /**
00202              * Fetch the associated package.
00203              */
00204             virtual const std::tr1::shared_ptr<const PackageID> associated_package() const = 0;
00205     };
00206 
00207     /**
00208      * An OverriddenMask holds a Mask and an explanation of why it has been overridden.
00209      *
00210      * \ingroup g_mask
00211      * \since 0.34
00212      */
00213     struct OverriddenMask
00214     {
00215         NamedValue<n::mask, std::tr1::shared_ptr<const Mask> > mask;
00216         NamedValue<n::override_reason, MaskOverrideReason> override_reason;
00217 
00218     };
00219 }
00220 
00221 #endif

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