dep_label.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_DEP_LABEL_HH
00021 #define PALUDIS_GUARD_PALUDIS_DEP_LABEL_HH 1
00022 
00023 #include <paludis/dep_label-fwd.hh>
00024 #include <paludis/dep_spec-fwd.hh>
00025 #include <paludis/util/simple_visitor.hh>
00026 #include <paludis/util/instantiation_policy.hh>
00027 #include <paludis/util/private_implementation_pattern.hh>
00028 #include <paludis/util/attributes.hh>
00029 #include <paludis/util/type_list.hh>
00030 
00031 /** \file
00032  * Declarations for dependency label-related classes.
00033  *
00034  * \ingroup g_dep_spec
00035  *
00036  * \section Examples
00037  *
00038  * - \ref example_dep_label.cc "example_dep_label.cc"
00039  * - \ref example_dep_spec.cc "example_dep_spec.cc" (for specifications)
00040  * - \ref example_dep_tree.cc "example_dep_tree.cc" (for specification trees)
00041  * - \ref example_dep_tag.cc "example_dep_tag.cc" (for tags)
00042  */
00043 
00044 namespace paludis
00045 {
00046     /**
00047      * URI label base class.
00048      *
00049      * \since 0.26
00050      * \ingroup g_dep_spec
00051      * \nosubgrouping
00052      */
00053     class PALUDIS_VISIBLE URILabel :
00054         private InstantiationPolicy<URILabel, instantiation_method::NonCopyableTag>,
00055         public virtual DeclareAbstractAcceptMethods<URILabel, MakeTypeList<
00056             URIMirrorsThenListedLabel, URIMirrorsOnlyLabel, URIListedOnlyLabel, URIListedThenMirrorsLabel,
00057             URILocalMirrorsOnlyLabel, URIManualOnlyLabel>::Type>
00058     {
00059         public:
00060             ///\name Basic operations
00061             ///\{
00062 
00063             virtual ~URILabel() = 0;
00064 
00065             ///\}
00066 
00067             /// Our text.
00068             virtual const std::string text() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
00069     };
00070 
00071     /**
00072      * A concrete URI label class.
00073      *
00074      * \since 0.26
00075      * \ingroup g_dep_spec
00076      * \nosubgrouping
00077      */
00078     template <typename T_>
00079     class PALUDIS_VISIBLE ConcreteURILabel :
00080         public URILabel,
00081         public ImplementAcceptMethods<URILabel, ConcreteURILabel<T_> >,
00082         private PrivateImplementationPattern<ConcreteURILabel<T_> >
00083     {
00084         private:
00085             using PrivateImplementationPattern<ConcreteURILabel<T_> >::_imp;
00086 
00087         public:
00088             ///\name Basic operations
00089             ///\{
00090 
00091             ConcreteURILabel(const std::string &);
00092             ~ConcreteURILabel();
00093 
00094             ///\}
00095 
00096             virtual const std::string text() const PALUDIS_ATTRIBUTE((warn_unused_result));
00097 
00098             /// Convenience typedef alias to obtain our tag.
00099             typedef T_ Tag;
00100     };
00101 
00102     /**
00103      * Dependency label base class.
00104      *
00105      * \since 0.26
00106      * \ingroup g_dep_spec
00107      * \nosubgrouping
00108      */
00109     class PALUDIS_VISIBLE DependencyLabel :
00110         private InstantiationPolicy<DependencyLabel, instantiation_method::NonCopyableTag>,
00111         public virtual DeclareAbstractAcceptMethods<DependencyLabel, MakeTypeList<
00112             DependencySystemLabel, DependencyTypeLabel, DependencySuggestLabel, DependencyABIsLabel>::Type>
00113     {
00114         public:
00115             ///\name Basic operations
00116             ///\{
00117 
00118             virtual ~DependencyLabel() = 0;
00119 
00120             ///\}
00121 
00122             /// Our text.
00123             virtual const std::string text() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
00124     };
00125 
00126     /**
00127      * System dependency label base class.
00128      *
00129      * \since 0.26
00130      * \ingroup g_dep_spec
00131      * \nosubgrouping
00132      */
00133     struct PALUDIS_VISIBLE DependencySystemLabel :
00134         public DependencyLabel,
00135         public ImplementAcceptMethods<DependencyLabel, DependencySystemLabel>,
00136         public virtual DeclareAbstractAcceptMethods<DependencySystemLabel, MakeTypeList<
00137             DependencyHostLabel, DependencyTargetLabel>::Type>
00138     {
00139         typedef DeclareAbstractAcceptMethods<DependencySystemLabel, MakeTypeList<
00140             DependencyHostLabel, DependencyTargetLabel>::Type>::VisitableTypeList VisitableTypeList;
00141 
00142         using DeclareAbstractAcceptMethods<DependencySystemLabel, MakeTypeList<
00143             DependencyHostLabel, DependencyTargetLabel>::Type>::accept;
00144         using DeclareAbstractAcceptMethods<DependencySystemLabel, MakeTypeList<
00145             DependencyHostLabel, DependencyTargetLabel>::Type>::accept_returning;
00146     };
00147 
00148     /**
00149      * Type dependency label base class.
00150      *
00151      * \since 0.26
00152      * \ingroup g_dep_spec
00153      * \nosubgrouping
00154      */
00155     struct PALUDIS_VISIBLE DependencyTypeLabel :
00156         public DependencyLabel,
00157         public ImplementAcceptMethods<DependencyLabel, DependencyTypeLabel>,
00158         public virtual DeclareAbstractAcceptMethods<DependencyTypeLabel, MakeTypeList<
00159             DependencyBuildLabel, DependencyRunLabel, DependencyPostLabel, DependencyInstallLabel,
00160             DependencyCompileLabel>::Type>
00161     {
00162         typedef DeclareAbstractAcceptMethods<DependencyTypeLabel, MakeTypeList<
00163             DependencyBuildLabel, DependencyRunLabel, DependencyPostLabel, DependencyInstallLabel,
00164             DependencyCompileLabel>::Type>::VisitableTypeList VisitableTypeList;
00165 
00166         using DeclareAbstractAcceptMethods<DependencyTypeLabel, MakeTypeList<
00167             DependencyBuildLabel, DependencyRunLabel, DependencyPostLabel, DependencyInstallLabel,
00168             DependencyCompileLabel>::Type>::accept;
00169         using DeclareAbstractAcceptMethods<DependencyTypeLabel, MakeTypeList<
00170             DependencyBuildLabel, DependencyRunLabel, DependencyPostLabel, DependencyInstallLabel,
00171             DependencyCompileLabel>::Type>::accept_returning;
00172     };
00173 
00174     /**
00175      * Suggest dependency label base class.
00176      *
00177      * \since 0.26
00178      * \ingroup g_dep_spec
00179      * \nosubgrouping
00180      */
00181     struct PALUDIS_VISIBLE DependencySuggestLabel :
00182         public DependencyLabel,
00183         public ImplementAcceptMethods<DependencyLabel, DependencySuggestLabel>,
00184         public virtual DeclareAbstractAcceptMethods<DependencySuggestLabel, MakeTypeList<
00185             DependencySuggestedLabel, DependencyRecommendedLabel, DependencyRequiredLabel>::Type>
00186     {
00187         typedef DeclareAbstractAcceptMethods<DependencySuggestLabel, MakeTypeList<
00188             DependencySuggestedLabel, DependencyRecommendedLabel,
00189             DependencyRequiredLabel>::Type>::VisitableTypeList VisitableTypeList;
00190 
00191         using DeclareAbstractAcceptMethods<DependencySuggestLabel, MakeTypeList<
00192             DependencySuggestedLabel, DependencyRecommendedLabel,
00193             DependencyRequiredLabel>::Type>::accept;
00194         using DeclareAbstractAcceptMethods<DependencySuggestLabel, MakeTypeList<
00195             DependencySuggestedLabel, DependencyRecommendedLabel,
00196             DependencyRequiredLabel>::Type>::accept_returning;
00197     };
00198 
00199     /**
00200      * ABI dependency label base class.
00201      *
00202      * \since 0.26
00203      * \ingroup g_dep_spec
00204      * \nosubgrouping
00205      */
00206     struct PALUDIS_VISIBLE DependencyABIsLabel :
00207         public DependencyLabel,
00208         public ImplementAcceptMethods<DependencyLabel, DependencyABIsLabel>,
00209         public virtual DeclareAbstractAcceptMethods<DependencyABIsLabel, MakeTypeList<
00210             DependencyAnyLabel, DependencyMineLabel, DependencyPrimaryLabel, DependencyABILabel>::Type>
00211     {
00212         typedef DeclareAbstractAcceptMethods<DependencyABIsLabel, MakeTypeList<
00213             DependencyAnyLabel, DependencyMineLabel, DependencyPrimaryLabel,
00214             DependencyABILabel>::Type>::VisitableTypeList VisitableTypeList;
00215 
00216         using DeclareAbstractAcceptMethods<DependencyABIsLabel, MakeTypeList<
00217             DependencyAnyLabel, DependencyMineLabel, DependencyPrimaryLabel,
00218             DependencyABILabel>::Type>::accept;
00219         using DeclareAbstractAcceptMethods<DependencyABIsLabel, MakeTypeList<
00220             DependencyAnyLabel, DependencyMineLabel, DependencyPrimaryLabel,
00221             DependencyABILabel>::Type>::accept_returning;
00222     };
00223 
00224     /**
00225      * A concrete dependency label class.
00226      *
00227      * \since 0.26
00228      * \ingroup g_dep_spec
00229      * \nosubgrouping
00230      */
00231     template <typename T_, typename C_>
00232     class PALUDIS_VISIBLE ConcreteDependencyLabel :
00233         public C_,
00234         public ImplementAcceptMethods<C_, ConcreteDependencyLabel<T_, C_> >,
00235         private PrivateImplementationPattern<ConcreteDependencyLabel<T_, C_> >
00236     {
00237         private:
00238             using PrivateImplementationPattern<ConcreteDependencyLabel<T_, C_> >::_imp;
00239 
00240         public:
00241             ///\name Basic operations
00242             ///\{
00243 
00244             ConcreteDependencyLabel(const std::string &);
00245             ~ConcreteDependencyLabel();
00246 
00247             ///\}
00248 
00249             virtual const std::string text() const PALUDIS_ATTRIBUTE((warn_unused_result));
00250 
00251             /// Convenience typedef alias to obtain our tag.
00252             typedef T_ Tag;
00253     };
00254 
00255     /**
00256      * A collection of each dependency label type.
00257      *
00258      * \since 0.26
00259      * \ingroup g_dep_spec
00260      */
00261     class PALUDIS_VISIBLE ActiveDependencyLabels :
00262         private PrivateImplementationPattern<ActiveDependencyLabels>
00263     {
00264         public:
00265             ///\name Basic operations
00266             ///\{
00267 
00268             ActiveDependencyLabels(const DependencyLabelsDepSpec &);
00269             ActiveDependencyLabels(const DependencyLabelSequence &);
00270             ActiveDependencyLabels(const ActiveDependencyLabels &);
00271             ActiveDependencyLabels(const ActiveDependencyLabels &, const DependencyLabelsDepSpec &);
00272             ~ActiveDependencyLabels();
00273 
00274             ActiveDependencyLabels & operator= (const ActiveDependencyLabels &);
00275 
00276             ///\}
00277 
00278             ///\name Current label selections
00279             ///\{
00280 
00281             const std::tr1::shared_ptr<const DependencySystemLabelSequence> system_labels() const PALUDIS_ATTRIBUTE((warn_unused_result));
00282             const std::tr1::shared_ptr<const DependencyTypeLabelSequence> type_labels() const PALUDIS_ATTRIBUTE((warn_unused_result));
00283             const std::tr1::shared_ptr<const DependencyABIsLabelSequence> abi_labels() const PALUDIS_ATTRIBUTE((warn_unused_result));
00284             const std::tr1::shared_ptr<const DependencySuggestLabelSequence> suggest_labels() const PALUDIS_ATTRIBUTE((warn_unused_result));
00285 
00286             ///\}
00287     };
00288 
00289 #ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
00290     extern template class InstantiationPolicy<DependencyLabel, instantiation_method::NonCopyableTag>;
00291     extern template class InstantiationPolicy<URILabel, instantiation_method::NonCopyableTag>;
00292 
00293     extern template class ConcreteDependencyLabel<DependencyHostLabelTag, DependencySystemLabel>;
00294     extern template class ConcreteDependencyLabel<DependencyTargetLabelTag, DependencySystemLabel>;
00295     extern template class ConcreteDependencyLabel<DependencyBuildLabelTag, DependencyTypeLabel>;
00296     extern template class ConcreteDependencyLabel<DependencyRunLabelTag, DependencyTypeLabel>;
00297     extern template class ConcreteDependencyLabel<DependencyPostLabelTag, DependencyTypeLabel>;
00298     extern template class ConcreteDependencyLabel<DependencyInstallLabelTag, DependencyTypeLabel>;
00299     extern template class ConcreteDependencyLabel<DependencyCompileLabelTag, DependencyTypeLabel>;
00300     extern template class ConcreteDependencyLabel<DependencySuggestedLabelTag, DependencySuggestLabel>;
00301     extern template class ConcreteDependencyLabel<DependencyRecommendedLabelTag, DependencySuggestLabel>;
00302     extern template class ConcreteDependencyLabel<DependencyRequiredLabelTag, DependencySuggestLabel>;
00303     extern template class ConcreteDependencyLabel<DependencyAnyLabelTag, DependencyABIsLabel>;
00304     extern template class ConcreteDependencyLabel<DependencyMineLabelTag, DependencyABIsLabel>;
00305     extern template class ConcreteDependencyLabel<DependencyPrimaryLabelTag, DependencyABIsLabel>;
00306     extern template class ConcreteDependencyLabel<DependencyABILabelTag, DependencyABIsLabel>;
00307 
00308     extern template class ConcreteURILabel<URIMirrorsThenListedLabelTag>;
00309     extern template class ConcreteURILabel<URIMirrorsOnlyLabelTag>;
00310     extern template class ConcreteURILabel<URIListedOnlyLabelTag>;
00311     extern template class ConcreteURILabel<URIListedThenMirrorsLabelTag>;
00312     extern template class ConcreteURILabel<URILocalMirrorsOnlyLabelTag>;
00313     extern template class ConcreteURILabel<URIManualOnlyLabelTag>;
00314 
00315     extern template class PrivateImplementationPattern<ConcreteURILabel<URIMirrorsThenListedLabel> >;
00316     extern template class PrivateImplementationPattern<ConcreteURILabel<URIMirrorsOnlyLabel> >;
00317     extern template class PrivateImplementationPattern<ConcreteURILabel<URIListedOnlyLabel> >;
00318     extern template class PrivateImplementationPattern<ConcreteURILabel<URIListedThenMirrorsLabel> >;
00319     extern template class PrivateImplementationPattern<ConcreteURILabel<URILocalMirrorsOnlyLabel> >;
00320     extern template class PrivateImplementationPattern<ConcreteURILabel<URIManualOnlyLabel> >;
00321 
00322     extern template class PrivateImplementationPattern<ConcreteDependencyLabel<DependencyHostLabelTag, DependencySystemLabel> >;
00323     extern template class PrivateImplementationPattern<ConcreteDependencyLabel<DependencyTargetLabelTag, DependencySystemLabel> >;
00324     extern template class PrivateImplementationPattern<ConcreteDependencyLabel<DependencyBuildLabelTag, DependencyTypeLabel> >;
00325     extern template class PrivateImplementationPattern<ConcreteDependencyLabel<DependencyRunLabelTag, DependencyTypeLabel> >;
00326     extern template class PrivateImplementationPattern<ConcreteDependencyLabel<DependencyPostLabelTag, DependencyTypeLabel> >;
00327     extern template class PrivateImplementationPattern<ConcreteDependencyLabel<DependencyInstallLabelTag, DependencyTypeLabel> >;
00328     extern template class PrivateImplementationPattern<ConcreteDependencyLabel<DependencyCompileLabelTag, DependencyTypeLabel> >;
00329     extern template class PrivateImplementationPattern<ConcreteDependencyLabel<DependencySuggestedLabelTag, DependencySuggestLabel> >;
00330     extern template class PrivateImplementationPattern<ConcreteDependencyLabel<DependencyRecommendedLabelTag, DependencySuggestLabel> >;
00331     extern template class PrivateImplementationPattern<ConcreteDependencyLabel<DependencyRequiredLabelTag, DependencySuggestLabel> >;
00332     extern template class PrivateImplementationPattern<ConcreteDependencyLabel<DependencyAnyLabelTag, DependencyABIsLabel> >;
00333     extern template class PrivateImplementationPattern<ConcreteDependencyLabel<DependencyMineLabelTag, DependencyABIsLabel> >;
00334     extern template class PrivateImplementationPattern<ConcreteDependencyLabel<DependencyPrimaryLabelTag, DependencyABIsLabel> >;
00335     extern template class PrivateImplementationPattern<ConcreteDependencyLabel<DependencyABILabelTag, DependencyABIsLabel> >;
00336 
00337     extern template class PrivateImplementationPattern<ActiveDependencyLabels>;
00338 #endif
00339 }
00340 
00341 #endif

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