paludis Version 3.0.2
The one true package mangler
slot_requirement.hh
1/* vim: set sw=4 sts=4 et foldmethod=syntax : */
2
3/*
4 * Copyright (c) 2008, 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_SLOT_REQUIREMENT_HH
21#define PALUDIS_GUARD_PALUDIS_SLOT_REQUIREMENT_HH 1
22
23#include <paludis/slot_requirement-fwd.hh>
24#include <paludis/name-fwd.hh>
25#include <paludis/util/visitor.hh>
26#include <paludis/util/type_list.hh>
27#include <memory>
28
29namespace paludis
30{
31 /**
32 * A SlotRequirement represents a PackageDepSpec's slot
33 * requirement, such as <code>:3</code>, <code>:*</code>,
34 * <code>:=</code> or <code>:=3</code>.
35 *
36 * \ingroup g_dep_spec
37 */
39 public virtual DeclareAbstractAcceptMethods<SlotRequirement, MakeTypeList<
40 SlotExactPartialRequirement, SlotExactFullRequirement, SlotAnyAtAllLockedRequirement, SlotAnyPartialLockedRequirement, SlotAnyUnlockedRequirement, SlotUnknownRewrittenRequirement>::Type>
41 {
42 public:
43 virtual ~SlotRequirement() = default;
44
45 /**
46 * String representation, including the leading colon. Not suitable
47 * for parsing.
48 */
49 virtual const std::string as_string() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
50
51 /**
52 * If we are a rewritten slot, return what the original requirement
53 * would have been; otherwise, returns null.
54 *
55 * \since 0.79
56 */
57 virtual const std::shared_ptr<const SlotRequirement> maybe_original_requirement_if_rewritten() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
58 };
59
60 /**
61 * A SlotExactPartialRequirement is a SlotRequirement for exact slot
62 * requirements on the main part of the slot, such as <code>:3</code> or
63 * <code>:3=3</code>.
64 *
65 * \ingroup g_dep_spec
66 */
68 public SlotRequirement,
70 {
71 public:
72 /**
73 * The slot in question.
74 */
75 virtual const SlotName slot() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
76 };
77
78 /**
79 * A SlotExactFullRequirement is a SlotRequirement for exact slot
80 * requirements on both parts of the slot, such as <code>:3/4</code>
81 * or <code>:3=3/4</code>.
82 *
83 * \ingroup g_dep_spec
84 */
86 public SlotRequirement,
88 {
89 public:
90 /**
91 * The slot parts in question.
92 */
93 virtual const std::pair<SlotName, SlotName> slots() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
94 };
95
96 /**
97 * A SlotAnyAtAllLockedRequirement is a SlotRequirement for
98 * <code>:=</code> slot requirements.
99 *
100 * \ingroup g_dep_spec
101 */
107
108 /**
109 * A SlotAnyPartialLockedRequirement is a SlotRequirement for
110 * <code>:3=</code> slot requirements that do not specify a sub-slot.
111 *
112 * \ingroup g_dep_spec
113 */
115 public SlotRequirement,
116 public ImplementAcceptMethods<SlotRequirement, SlotAnyPartialLockedRequirement>
117 {
118 public:
119 /**
120 * The slot in question.
121 */
122 virtual const SlotName slot() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
123 };
124
125 /**
126 * A SlotAnyUnlockedRequirement is a SlotRequirement for
127 * <code>:*</code> slot requirements.
128 *
129 * \ingroup g_dep_spec
130 */
136
137 /**
138 * A SlotUnknownRewrittenRequirement is a SlotRequirement for the
139 * <code>maybe_original_requirement_if_written()</code> method of
140 * <code>:3/3.1=</code> slot requirements that do not indicate whether
141 * they were originally of <code>:=</code> or <code>:3=</code> type.
142 *
143 * \ingroup g_dep_spec
144 */
146 public SlotRequirement,
147 public ImplementAcceptMethods<SlotRequirement, SlotUnknownRewrittenRequirement>
148 {
149 public:
150 /**
151 * The slot that the original spec might have specified, if
152 * it was of <code>:3=</code> type.
153 */
154 virtual const SlotName slot() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
155 };
156}
157
158#endif
Definition visitor.hh:326
Definition visitor.hh:411
Definition slot_requirement.hh:105
Definition slot_requirement.hh:117
virtual const SlotName slot() const PALUDIS_ATTRIBUTE((warn_unused_result))=0
Definition slot_requirement.hh:134
Definition slot_requirement.hh:88
virtual const std::pair< SlotName, SlotName > slots() const PALUDIS_ATTRIBUTE((warn_unused_result))=0
Definition slot_requirement.hh:70
virtual const SlotName slot() const PALUDIS_ATTRIBUTE((warn_unused_result))=0
Definition slot_requirement.hh:41
virtual const std::string as_string() const PALUDIS_ATTRIBUTE((warn_unused_result))=0
virtual const std::shared_ptr< const SlotRequirement > maybe_original_requirement_if_rewritten() const PALUDIS_ATTRIBUTE((warn_unused_result))=0
Definition slot_requirement.hh:148
virtual const SlotName slot() const PALUDIS_ATTRIBUTE((warn_unused_result))=0
WrappedValue< SlotNameTag > SlotName
Definition name-fwd.hh:93
#define PALUDIS_ATTRIBUTE(x)
Definition attributes.hh:53
#define PALUDIS_VISIBLE
Definition attributes.hh:59
Definition about_metadata-fwd.hh:24