paludis  Version 2.6.0
dep_label.hh
Go to the documentation of this file.
1 /* vim: set sw=4 sts=4 et foldmethod=syntax : */
2 
3 /*
4  * Copyright (c) 2007, 2008, 2009, 2010, 2011 Ciaran McCreesh
5  *
6  * This file is part of the Paludis package manager. Paludis is free software;
7  * you can redistribute it and/or modify it under the terms of the GNU General
8  * Public License version 2, as published by the Free Software Foundation.
9  *
10  * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
11  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13  * details.
14  *
15  * You should have received a copy of the GNU General Public License along with
16  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
17  * Place, Suite 330, Boston, MA 02111-1307 USA
18  */
19 
20 #ifndef PALUDIS_GUARD_PALUDIS_DEP_LABEL_HH
21 #define PALUDIS_GUARD_PALUDIS_DEP_LABEL_HH 1
22 
23 #include <paludis/dep_label-fwd.hh>
24 #include <paludis/dep_spec-fwd.hh>
27 #include <paludis/util/visitor.hh>
28 #include <paludis/util/pimp.hh>
30 #include <paludis/util/type_list.hh>
31 #include <paludis/util/sequence.hh>
32 #include <paludis/util/wrapped_forward_iterator.hh>
33 
34 /** \file
35  * Declarations for dependency label-related classes.
36  *
37  * \ingroup g_dep_spec
38  *
39  * \section Examples
40  *
41  * - \ref example_dep_label.cc "example_dep_label.cc"
42  * - \ref example_dep_spec.cc "example_dep_spec.cc" (for specifications)
43  * - \ref example_dep_tag.cc "example_dep_tag.cc" (for tags)
44  */
45 
46 namespace paludis
47 {
48  /**
49  * URI label base class.
50  *
51  * \since 0.26
52  * \ingroup g_dep_spec
53  * \nosubgrouping
54  */
56  public virtual DeclareAbstractAcceptMethods<URILabel, MakeTypeList<
57  URIMirrorsThenListedLabel, URIMirrorsOnlyLabel, URIListedOnlyLabel, URIListedThenMirrorsLabel,
58  URILocalMirrorsOnlyLabel, URIManualOnlyLabel>::Type>
59  {
60  public:
61  ///\name Basic operations
62  ///\{
63 
64  URILabel() = default;
65  virtual ~URILabel() = 0;
66 
67  URILabel(const URILabel &) = delete;
68  URILabel & operator= (const URILabel &) = delete;
69 
70  ///\}
71 
72  /// Our text.
73  virtual const std::string text() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
74  };
75 
76  /**
77  * A concrete URI label class.
78  *
79  * \since 0.26
80  * \ingroup g_dep_spec
81  * \nosubgrouping
82  */
83  template <typename T_>
84  class PALUDIS_VISIBLE SpecificURILabel :
85  public URILabel,
86  public ImplementAcceptMethods<URILabel, SpecificURILabel<T_> >
87  {
88  private:
89  const std::string _text;
90 
91  public:
92  ///\name Basic operations
93  ///\{
94 
95  SpecificURILabel(const std::string &);
96  ~SpecificURILabel();
97 
98  ///\}
99 
100  virtual const std::string text() const PALUDIS_ATTRIBUTE((warn_unused_result));
101 
102  /// Convenience typedef alias to obtain our tag.
103  typedef T_ Tag;
104  };
105 
106  /**
107  * Dependencies label base class.
108  *
109  * \since 0.42
110  * \ingroup g_dep_spec
111  */
113  public virtual DeclareAbstractAcceptMethods<DependenciesLabel, MakeTypeList<
114  DependenciesBuildLabel, DependenciesRunLabel, DependenciesPostLabel, DependenciesCompileAgainstLabel,
115  DependenciesFetchLabel, DependenciesInstallLabel, DependenciesSuggestionLabel,
116  DependenciesRecommendationLabel, DependenciesTestLabel>::Type>
117  {
118  public:
119  ///\name Basic operations
120  ///\{
121 
122  DependenciesLabel() = default;
123  virtual ~DependenciesLabel() = 0;
124 
125  DependenciesLabel(const DependenciesLabel &) = delete;
126  DependenciesLabel & operator= (const DependenciesLabel &) = delete;
127 
128  ///\}
129 
130  /// Our text.
131  virtual const std::string text() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
132 
133  /**
134  * Are we enabled?
135  *
136  * \since 0.58 takes env, package_id
137  */
138  virtual bool enabled(
139  const Environment * const,
140  const std::shared_ptr<const PackageID> &) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
141  };
142 
143  /**
144  * A concrete dependencies label class.
145  *
146  * \since 0.42
147  * \ingroup g_dep_spec
148  */
149  template <typename T_>
150  class PALUDIS_VISIBLE SpecificDependenciesLabel :
151  public DependenciesLabel,
152  public ImplementAcceptMethods<DependenciesLabel, SpecificDependenciesLabel<T_> >
153  {
154  public:
155  /// Convenience typedef alias to obtain our tag.
156  typedef T_ Tag;
157  };
158 
165 
175 
178  const std::shared_ptr<const DependenciesLabel> >;
179 }
180 
181 #endif
Definition: about_metadata-fwd.hh:23
Definition: visitor-fwd.hh:52
T_ Tag
Convenience typedef alias to obtain our tag.
Definition: dep_label.hh:156
Definition: dep_label-fwd.hh:38
Definition: sequence-fwd.hh:32
Definition: environment.hh:200
Definition: dep_label.hh:55
Definition: dep_label.hh:112
Definition: dep_label-fwd.hh:69
Definition: wrapped_forward_iterator-fwd.hh:26
Definition: visitor-fwd.hh:49
T_ Tag
Convenience typedef alias to obtain our tag.
Definition: dep_label.hh:103
#define PALUDIS_ATTRIBUTE(x)
Definition: attributes.hh:53
#define PALUDIS_VISIBLE
Definition: attributes.hh:59