paludis Version 3.0.2
The one true package mangler
user_dep_spec.hh
1/* vim: set sw=4 sts=4 et foldmethod=syntax : */
2
3/*
4 * Copyright (c) 2005, 2006, 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_USER_DEP_SPEC_HH
21#define PALUDIS_GUARD_PALUDIS_USER_DEP_SPEC_HH 1
22
23#include <paludis/user_dep_spec-fwd.hh>
24#include <paludis/dep_spec.hh>
25#include <paludis/slot_requirement.hh>
26#include <paludis/filter.hh>
27#include <paludis/additional_package_dep_spec_requirement.hh>
28#include <paludis/util/pimp.hh>
29
30namespace paludis
31{
32 /**
33 * Create a PackageDepSpec from user input.
34 *
35 * \ingroup g_dep_spec
36 * \since 0.28
37 */
39 const std::string &,
40 const Environment * const,
43
44 /**
45 * Create a PackageDepSpec from user input, restricted to not having
46 * an Environment available.
47 *
48 * For use in test cases; should not be used elsewhere.
49 *
50 * \ingroup g_dep_spec
51 * \since 0.61
52 */
54 const std::string &) PALUDIS_VISIBLE;
55
56 class PALUDIS_VISIBLE UserSlotExactFullRequirement :
58 {
59 private:
60 const std::pair<SlotName, SlotName> _s;
61
62 public:
63 UserSlotExactFullRequirement(const std::pair<SlotName, SlotName> &);
64
65 const std::pair<SlotName, SlotName> slots() const override PALUDIS_ATTRIBUTE((warn_unused_result));
66 const std::string as_string() const override PALUDIS_ATTRIBUTE((warn_unused_result));
67 const std::shared_ptr<const SlotRequirement> maybe_original_requirement_if_rewritten() const override PALUDIS_ATTRIBUTE((warn_unused_result));
68 };
69
70 class PALUDIS_VISIBLE UserSlotExactPartialRequirement :
72 {
73 private:
74 const SlotName _s;
75
76 public:
77 ///\name Basic operations
78 ///\{
79
80 UserSlotExactPartialRequirement(const SlotName &);
81
82 ///\}
83
84 const SlotName slot() const override PALUDIS_ATTRIBUTE((warn_unused_result));
85 const std::string as_string() const override PALUDIS_ATTRIBUTE((warn_unused_result));
86 const std::shared_ptr<const SlotRequirement> maybe_original_requirement_if_rewritten() const override PALUDIS_ATTRIBUTE((warn_unused_result));
87 };
88
89 /**
90 * A key requirement for a user PackageDepSpec.
91 *
92 * \since 0.36
93 * \ingroup g_dep_spec
94 */
95 class PALUDIS_VISIBLE UserKeyRequirement :
96 public AdditionalPackageDepSpecRequirement
97 {
98 private:
100
101 public:
102 ///\name Basic operations
103 ///\{
104
105 UserKeyRequirement(const std::string &);
106 ~UserKeyRequirement() override;
107
108 ///\}
109
110 const std::pair<bool, std::string> requirement_met(
111 const Environment * const, const ChangedChoices *,
112 const std::shared_ptr<const PackageID> &,
113 const std::shared_ptr<const PackageID> &,
114 const ChangedChoices * const) const override PALUDIS_ATTRIBUTE((warn_unused_result));
115
116 const std::string as_human_string(
117 const std::shared_ptr<const PackageID> &) const override PALUDIS_ATTRIBUTE((warn_unused_result));
118
119 const std::string as_raw_string() const override PALUDIS_ATTRIBUTE((warn_unused_result));
120
122 const Environment * const,
123 const ChangedChoices * const,
124 const std::shared_ptr<const PackageID> &,
125 const std::shared_ptr<const PackageID> &,
126 ChangedChoices &) const override PALUDIS_ATTRIBUTE((warn_unused_result));
127 };
128
129 extern template class Pimp<UserKeyRequirement>;
130
131 /**
132 * An exclude requirement for a PackageDepSpec.
133 *
134 * \ingroup g_dep_spec
135 */
136 class PALUDIS_VISIBLE ExcludeRequirement :
137 public AdditionalPackageDepSpecRequirement
138 {
139 private:
141
142 public:
143 ///\name Basic operations
144 ///\{
145
146 ExcludeRequirement(const PackageDepSpec &);
147 ~ExcludeRequirement() override;
148
149 ///\}
150
151 const std::pair<bool, std::string> requirement_met(
152 const Environment * const, const ChangedChoices *,
153 const std::shared_ptr<const PackageID> &,
154 const std::shared_ptr<const PackageID> &,
155 const ChangedChoices * const) const override PALUDIS_ATTRIBUTE((warn_unused_result));
156
157 const std::string as_human_string(
158 const std::shared_ptr<const PackageID> &) const override PALUDIS_ATTRIBUTE((warn_unused_result));
159
160 const std::string as_raw_string() const override PALUDIS_ATTRIBUTE((warn_unused_result));
161
163 const Environment * const,
164 const ChangedChoices * const,
165 const std::shared_ptr<const PackageID> &,
166 const std::shared_ptr<const PackageID> &,
167 ChangedChoices &) const override PALUDIS_ATTRIBUTE((warn_unused_result));
168 };
169}
170
171#endif
Definition changed_choices.hh:36
Definition environment.hh:203
const std::string as_human_string(const std::shared_ptr< const PackageID > &) const override PALUDIS_ATTRIBUTE((warn_unused_result))
const std::pair< bool, std::string > requirement_met(const Environment *const, const ChangedChoices *, const std::shared_ptr< const PackageID > &, const std::shared_ptr< const PackageID > &, const ChangedChoices *const) const override PALUDIS_ATTRIBUTE((warn_unused_result))
Tribool accumulate_changes_to_make_met(const Environment *const, const ChangedChoices *const, const std::shared_ptr< const PackageID > &, const std::shared_ptr< const PackageID > &, ChangedChoices &) const override PALUDIS_ATTRIBUTE((warn_unused_result))
const std::string as_raw_string() const override PALUDIS_ATTRIBUTE((warn_unused_result))
Definition filter.hh:59
Definition dep_spec.hh:348
Definition package_id.hh:99
Definition pimp.hh:52
Definition slot_requirement.hh:88
Definition slot_requirement.hh:70
Definition slot_requirement.hh:41
Definition tribool.hh:28
const std::pair< bool, std::string > requirement_met(const Environment *const, const ChangedChoices *, const std::shared_ptr< const PackageID > &, const std::shared_ptr< const PackageID > &, const ChangedChoices *const) const override PALUDIS_ATTRIBUTE((warn_unused_result))
Tribool accumulate_changes_to_make_met(const Environment *const, const ChangedChoices *const, const std::shared_ptr< const PackageID > &, const std::shared_ptr< const PackageID > &, ChangedChoices &) const override PALUDIS_ATTRIBUTE((warn_unused_result))
const std::string as_raw_string() const override PALUDIS_ATTRIBUTE((warn_unused_result))
const std::string as_human_string(const std::shared_ptr< const PackageID > &) const override PALUDIS_ATTRIBUTE((warn_unused_result))
const std::string as_string() const override PALUDIS_ATTRIBUTE((warn_unused_result))
const std::shared_ptr< const SlotRequirement > maybe_original_requirement_if_rewritten() const override PALUDIS_ATTRIBUTE((warn_unused_result))
const std::pair< SlotName, SlotName > slots() const override PALUDIS_ATTRIBUTE((warn_unused_result))
const SlotName slot() const override PALUDIS_ATTRIBUTE((warn_unused_result))
const std::shared_ptr< const SlotRequirement > maybe_original_requirement_if_rewritten() const override PALUDIS_ATTRIBUTE((warn_unused_result))
const std::string as_string() const override PALUDIS_ATTRIBUTE((warn_unused_result))
Definition filter.hh:141
Options< UserPackageDepSpecOption > UserPackageDepSpecOptions
Definition user_dep_spec-fwd.hh:44
PackageDepSpec envless_parse_package_dep_spec_for_tests(const std::string &) PALUDIS_VISIBLE
PackageDepSpec parse_user_package_dep_spec(const std::string &, const Environment *const, const UserPackageDepSpecOptions &, const Filter &=filter::All()) PALUDIS_VISIBLE
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