paludis  Version 2.6.0
additional_package_dep_spec_requirement.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_ADDITIONAL_PACKAGE_DEP_SPEC_REQUIREMENT_HH
21 #define PALUDIS_GUARD_PALUDIS_ADDITIONAL_PACKAGE_DEP_SPEC_REQUIREMENT_HH 1
22 
23 #include <paludis/additional_package_dep_spec_requirement-fwd.hh>
24 #include <paludis/util/sequence.hh>
25 #include <paludis/util/wrapped_forward_iterator.hh>
26 #include <paludis/util/tribool-fwd.hh>
28 #include <paludis/changed_choices-fwd.hh>
30 #include <utility>
31 
32 namespace paludis
33 {
34  /**
35  * An additional requirement for a PackageDepSpec.
36  *
37  * \since 0.26
38  * \ingroup g_dep_spec
39  */
41  {
42  public:
45 
48 
49  /**
50  * Is our requirement met for a given PackageID?
51  *
52  * The string in the return type might be a description of why the
53  * requirement was not met. Sometimes better messages can be given
54  * than simply the return value of as_human_string() when the ID to
55  * be matched is known. If the bool is true, the string is
56  * meaningless.
57  *
58  * \param spec_id The PackageID the spec comes from. May be null. Used for
59  * [use=] style dependencies.
60  *
61  * \since 0.44 returns pair<bool, std::string>
62  * \since 0.51 takes optional ChangedChoices arguments
63  * \since 0.58 takes id by shared_ptr
64  * \since 0.58 takes spec_id
65  */
66  virtual const std::pair<bool, std::string> requirement_met(
67  const Environment * const,
68  const ChangedChoices * const maybe_changes_to_owner,
69  const std::shared_ptr<const PackageID> & target_id,
70  const std::shared_ptr<const PackageID> & spec_id,
71  const ChangedChoices * const maybe_changes_to_target) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
72 
73  /**
74  * If possible, indicate which choices to change to make our
75  * requirement met for a particular ID.
76  *
77  * Verifies that the ID has the appropriate choice, and that that
78  * choice isn't locked.
79  *
80  * Returns true for changes made, false for not possible,
81  * indeterminate for nothing needs changing.
82  *
83  * \param spec_id The PackageID the spec comes from. May be null. Used for
84  * [use=] style dependencies.
85  *
86  * \since 0.51
87  * \since 0.55 returns Tribool
88  * \since 0.58 takes spec_id
89  */
90  virtual Tribool accumulate_changes_to_make_met(
91  const Environment * const,
92  const ChangedChoices * const maybe_changes_to_owner,
93  const std::shared_ptr<const PackageID> &,
94  const std::shared_ptr<const PackageID> & spec_id,
95  ChangedChoices &) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
96 
97  /**
98  * Return a human readable string representation of ourself.
99  *
100  * \param spec_id The PackageID the spec comes from. May be null. Used for
101  * [use=] style dependencies.
102  *
103  * \since 0.58 takes spec_id
104  */
105  virtual const std::string as_human_string(
106  const std::shared_ptr<const PackageID> & spec_id) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
107 
108  /**
109  * Return a raw string representation of ourself.
110  */
111  virtual const std::string as_raw_string() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
112  };
113 
116  const std::shared_ptr<const AdditionalPackageDepSpecRequirement> >;
117 }
118 
119 #endif
Definition: about_metadata-fwd.hh:23
Definition: sequence-fwd.hh:35
Definition: additional_package_dep_spec_requirement.hh:40
Definition: changed_choices.hh:35
Definition: sequence-fwd.hh:32
Definition: environment.hh:200
Definition: wrapped_forward_iterator-fwd.hh:26
Definition: tribool.hh:27
#define PALUDIS_ATTRIBUTE(x)
Definition: attributes.hh:53
#define PALUDIS_VISIBLE
Definition: attributes.hh:59