4 #error "This file must be compiled as C++." 7 #include <arbiter/Requirement.h> 31 virtual bool satisfiedBy (
const ArbiterSelectedVersion &selectedVersion)
const = 0;
76 virtual void operator() (
const ArbiterRequirement &requirement) = 0;
82 class Any final :
public ArbiterRequirement
97 return (
bool)
dynamic_cast<
const Any *>(&
other);
118 class AtLeast final :
public ArbiterRequirement
142 std::ostream &
describe (std::ostream &os)
const override;
178 std::ostream &
describe (std::ostream &os)
const override;
187 class Exactly final :
public ArbiterRequirement
211 std::ostream &
describe (std::ostream &os)
const override;
217 class Unversioned
final :
public ArbiterRequirement
232 return std::make_unique<Unversioned>(*
this);
235 std::ostream &
describe (std::ostream &os)
const override;
236 bool satisfiedBy (
const ArbiterSelectedVersion &selectedVersion)
const override;
239 size_t
hash ()
const noexcept override;
242 class Custom
final :
public ArbiterRequirement
245 explicit Custom (ArbiterRequirementPredicate predicate, std::shared_ptr<
const void> context)
246 : _predicate(std::move(predicate))
247 , _context(std::move(context))
252 std::ostream &
describe (std::ostream &os)
const override 254 return os <<
"(custom predicate)";
259 return std::make_unique<Custom>(*
this);
262 bool satisfiedBy (
const ArbiterSelectedVersion &selectedVersion)
const override;
265 size_t
hash ()
const noexcept override;
268 ArbiterRequirementPredicate _predicate;
269 std::shared_ptr<
const void> _context;
272 class Compound
final :
public ArbiterRequirement
283 return std::make_unique<Compound>(*
this);
290 int priority ()
const noexcept override;
292 bool satisfiedBy (
const ArbiterSelectedVersion &selectedVersion)
const override;
294 std::ostream &
describe (std::ostream &os)
const override;
296 size_t
hash ()
const noexcept override;
307 , _priority(priority)
312 return std::make_unique<Prioritized>(*
this);
322 std::ostream &
describe (std::ostream &os)
const override;
337 struct hash<ArbiterRequirement>
final 340 size_t
operator() (
const ArbiterRequirement &requirement)
const std::ostream & describe(std::ostream &os) const override
std::unique_ptr< ArbiterRequirement > intersect(const ArbiterRequirement &rhs) const override
Attempts to create a requirement which expresses the intersection of this requirement and the given o...
bool satisfiedBy(const ArbiterSelectedVersion &selectedVersion) const override
Returns whether this requirement would be satisfied by using the given selected version.
bool satisfiedBy(const ArbiterSemanticVersion &version) const noexcept
ArbiterSemanticVersion _baseVersion
bool operator==(const Arbiter::Base &other) const override
int priority() const noexcept override
Returns the minimum priority index of all the requirements held by this compound requirement.
std::unique_ptr< ArbiterRequirement > intersect(const ArbiterRequirement &rhs) const override
Attempts to create a requirement which expresses the intersection of this requirement and the given o...
size_t hash() const noexcept override
std::unique_ptr< ArbiterRequirement > intersect(const ArbiterRequirement &rhs) const override
Attempts to create a requirement which expresses the intersection of this requirement and the given o...
auto makeIteratorRange(const Collection &collection)
Creates an IteratorRange encompassing the entirety of the given read-only collection.
bool operator==(const Arbiter::Base &other) const override
std::unique_ptr< ArbiterRequirement > intersect(const ArbiterRequirement &rhs) const override
Attempts to create a requirement which expresses the intersection of this requirement and the given o...
Unversioned(Metadata metadata)
bool operator==(const Arbiter::Base &other) const override
ArbiterSemanticVersion _minimumVersion
std::unique_ptr< ArbiterRequirement > intersect(const ArbiterRequirement &rhs) const override
Attempts to create a requirement which expresses the intersection of this requirement and the given o...
bool operator==(const Arbiter::Base &other) const override
std::shared_ptr< ArbiterRequirement > _requirement
std::ostream & describe(std::ostream &os) const override
virtual int priority() const noexcept
Returns the priority of this requirement.
bool satisfiedBy(const ArbiterSelectedVersion &selectedVersion) const override
Returns whether this requirement would be satisfied by using the given selected version.
size_t hash() const noexcept override
size_t hash() const noexcept override
virtual ~Visitor()=default
std::ostream & describe(std::ostream &os) const override
size_t hash() const noexcept override
virtual void visit(Arbiter::Requirement::Visitor &visitor) const
Visits the requirement, then any child requirements.
Exactly(ArbiterSemanticVersion version) noexcept
std::ostream & describe(std::ostream &os) const override
std::unique_ptr< ArbiterRequirement > intersect(const ArbiterRequirement &rhs) const override
Attempts to create a requirement which expresses the intersection of this requirement and the given o...
std::unique_ptr< Base > clone() const override
ArbiterSemanticVersion _version
Custom(ArbiterRequirementPredicate predicate, std::shared_ptr< const void > context)
std::unique_ptr< ArbiterRequirement > cloneRequirement() const
virtual void operator()(const ArbiterRequirement &requirement)=0
bool satisfiedBy(const ArbiterSemanticVersion &version) const noexcept
Compound(std::vector< std::shared_ptr< ArbiterRequirement >> requirements)
virtual size_t hash() const noexcept=0
std::unique_ptr< ArbiterRequirement > intersect(const ArbiterRequirement &rhs) const override
Attempts to create a requirement which expresses the intersection of this requirement and the given o...
std::unique_ptr< ArbiterRequirement > intersect(const ArbiterRequirement &rhs) const override
Attempts to create a requirement which expresses the intersection of this requirement and the given o...
bool operator==(const Arbiter::Base &other) const override
size_t operator()(const ArbiterRequirement &requirement) const
size_t hash() const noexcept override
AtLeast(ArbiterSemanticVersion version) noexcept
std::unique_ptr< Base > clone() const override
Prioritized(std::shared_ptr< ArbiterRequirement > requirement, int priority)
CompatibleWith(ArbiterSemanticVersion version, ArbiterRequirementStrictness strictness) noexcept
size_t hash() const noexcept override
std::ostream & describe(std::ostream &os) const override
bool satisfiedBy(const ArbiterSemanticVersion &) const noexcept
bool operator==(const Arbiter::Base &other) const override
ArbiterRequirementStrictness _strictness
size_t hash() const noexcept override
std::ostream & describe(std::ostream &os) const override
virtual std::unique_ptr< ArbiterRequirement > intersect(const ArbiterRequirement &rhs) const =0
Attempts to create a requirement which expresses the intersection of this requirement and the given o...
bool satisfiedBy(const ArbiterSelectedVersion &selectedVersion) const override
Returns whether this requirement would be satisfied by using the given selected version.
std::unique_ptr< Base > clone() const override
std::vector< std::shared_ptr< ArbiterRequirement > > _requirements
Base class for objects that want to visit requirements.
virtual bool satisfiedBy(const ArbiterSelectedVersion &selectedVersion) const =0
Returns whether this requirement would be satisfied by using the given selected version.
void visit(Visitor &visitor) const override
Visits the requirement, then any child requirements.
bool satisfiedBy(const ArbiterSelectedVersion &selectedVersion) const override
Returns whether this requirement would be satisfied by using the given selected version.
std::ostream & describe(std::ostream &os) const override
std::ostream & describe(std::ostream &os) const override
bool operator==(const Arbiter::Base &other) const override
bool satisfiedBy(const ArbiterSemanticVersion &version) const noexcept
void visit(Visitor &visitor) const override
Visits the requirement, then any child requirements.
std::unique_ptr< Base > clone() const override
virtual std::unique_ptr< Base > clone() const =0
size_t hash() const noexcept override
int priority() const noexcept override
Returns the priority of this requirement.