paludis  Version 2.0.0
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 
30 namespace paludis
31 {
32  /**
33  * Create a PackageDepSpec from user input.
34  *
35  * \ingroup g_dep_spec
36  * \since 0.28
37  */
38  PackageDepSpec parse_user_package_dep_spec(
39  const std::string &,
40  const Environment * const,
42  const Filter & = filter::All()) PALUDIS_VISIBLE;
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  virtual const std::pair<SlotName, SlotName> slots() const PALUDIS_ATTRIBUTE((warn_unused_result));
66  virtual const std::string as_string() const PALUDIS_ATTRIBUTE((warn_unused_result));
67  virtual const std::shared_ptr<const SlotRequirement> maybe_original_requirement_if_rewritten() const PALUDIS_ATTRIBUTE((warn_unused_result));
68  };
69 
72  {
73  private:
74  const SlotName _s;
75 
76  public:
77  ///\name Basic operations
78  ///\{
79 
81 
82  ///\}
83 
84  virtual const SlotName slot() const PALUDIS_ATTRIBUTE((warn_unused_result));
85  virtual const std::string as_string() const PALUDIS_ATTRIBUTE((warn_unused_result));
86  virtual const std::shared_ptr<const SlotRequirement> maybe_original_requirement_if_rewritten() const 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  */
97  {
98  private:
100 
101  public:
102  ///\name Basic operations
103  ///\{
104 
105  UserKeyRequirement(const std::string &);
107 
108  ///\}
109 
110  virtual 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 PALUDIS_ATTRIBUTE((warn_unused_result));
115 
116  virtual const std::string as_human_string(
117  const std::shared_ptr<const PackageID> &) const PALUDIS_ATTRIBUTE((warn_unused_result));
118 
119  virtual const std::string as_raw_string() const PALUDIS_ATTRIBUTE((warn_unused_result));
120 
121  virtual Tribool accumulate_changes_to_make_met(
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 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  */
138  {
139  private:
140  PackageDepSpec _s;
141 
142  public:
143  ///\name Basic operations
144  ///\{
145 
148 
149  ///\}
150 
151  virtual 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 PALUDIS_ATTRIBUTE((warn_unused_result));
156 
157  virtual const std::string as_human_string(
158  const std::shared_ptr<const PackageID> &) const PALUDIS_ATTRIBUTE((warn_unused_result));
159 
160  virtual const std::string as_raw_string() const PALUDIS_ATTRIBUTE((warn_unused_result));
161 
162  virtual Tribool accumulate_changes_to_make_met(
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 PALUDIS_ATTRIBUTE((warn_unused_result));
168  };
169 }
170 
171 #endif
Definition: pimp.hh:51
PackageDepSpec envless_parse_package_dep_spec_for_tests(const std::string &) PALUDIS_VISIBLE
Definition: additional_package_dep_spec_requirement.hh:40
Definition: user_dep_spec.hh:56
Definition: slot_requirement.hh:83
Definition: changed_choices.hh:35
Definition: user_dep_spec.hh:70
Definition: slot_requirement.hh:65
Definition: dep_spec.hh:345
Definition: environment.hh:200
PackageDepSpec parse_user_package_dep_spec(const std::string &, const Environment *const, const UserPackageDepSpecOptions &, const Filter &=filter::All()) PALUDIS_VISIBLE
Options< UserPackageDepSpecOption > UserPackageDepSpecOptions
Definition: user_dep_spec-fwd.hh:44
Definition: wrapped_value-fwd.hh:29
Definition: user_dep_spec.hh:95
Definition: tribool.hh:27
Definition: user_dep_spec.hh:136
#define PALUDIS_ATTRIBUTE(x)
Definition: attributes.hh:64
#define PALUDIS_VISIBLE
Definition: attributes.hh:71