paludis Version 3.0.2
The one true package mangler
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
27#include <paludis/util/visitor.hh>
28#include <paludis/util/pimp.hh>
30#include <paludis/util/type_list.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
46namespace paludis
47{
48 /**
49 * URI label base class.
50 *
51 * \since 0.26
52 * \ingroup g_dep_spec
53 * \nosubgrouping
54 */
55 class PALUDIS_VISIBLE URILabel :
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() override;
97
98 ///\}
99
100 const std::string text() const override 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 */
112 class PALUDIS_VISIBLE DependenciesLabel :
113 public virtual DeclareAbstractAcceptMethods<DependenciesLabel, MakeTypeList<
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_>
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 visitor.hh:326
virtual const std::string text() const PALUDIS_ATTRIBUTE((warn_unused_result))=0
Our text.
virtual bool enabled(const Environment *const, const std::shared_ptr< const PackageID > &) const PALUDIS_ATTRIBUTE((warn_unused_result))=0
Definition environment.hh:203
Definition visitor.hh:411
Definition package_id.hh:99
Definition sequence.hh:51
Definition dep_label.hh:153
DependenciesBuildLabelTag Tag
Definition dep_label.hh:156
Definition dep_label.hh:87
const std::string text() const override PALUDIS_ATTRIBUTE((warn_unused_result))
Our text.
URIMirrorsThenListedLabelTag Tag
Definition dep_label.hh:103
virtual const std::string text() const PALUDIS_ATTRIBUTE((warn_unused_result))=0
Our text.
Definition wrapped_forward_iterator.hh:42
SpecificDependenciesLabel< DependenciesCompileAgainstLabelTag > DependenciesCompileAgainstLabel
Definition dep_label-fwd.hh:133
SpecificDependenciesLabel< DependenciesPostLabelTag > DependenciesPostLabel
Definition dep_label-fwd.hh:117
SpecificDependenciesLabel< DependenciesSuggestionLabelTag > DependenciesSuggestionLabel
Definition dep_label-fwd.hh:181
SpecificDependenciesLabel< DependenciesTestLabelTag > DependenciesTestLabel
Definition dep_label-fwd.hh:213
SpecificDependenciesLabel< DependenciesBuildLabelTag > DependenciesBuildLabel
Definition dep_label-fwd.hh:85
SpecificDependenciesLabel< DependenciesFetchLabelTag > DependenciesFetchLabel
Definition dep_label-fwd.hh:149
SpecificDependenciesLabel< DependenciesRecommendationLabelTag > DependenciesRecommendationLabel
Definition dep_label-fwd.hh:197
SpecificDependenciesLabel< DependenciesInstallLabelTag > DependenciesInstallLabel
Definition dep_label-fwd.hh:165
SpecificDependenciesLabel< DependenciesRunLabelTag > DependenciesRunLabel
Definition dep_label-fwd.hh:101
#define PALUDIS_ATTRIBUTE(x)
Definition attributes.hh:53
#define PALUDIS_VISIBLE
Definition attributes.hh:59
Definition about_metadata-fwd.hh:24
Definition type_list-fwd.hh:31