Table of Contents

Class Restriction

Namespace
ZeroInstall.Model
Assembly
ZeroInstall.Model.dll

Restricts the versions of an Implementation that are allowed without creating a dependency on the implementation if its was not already chosen.

[Serializable]
[Equatable]
public class Restriction : FeedElement, IEquatable<XmlUnknown>, IEquatable<FeedElement>, IInterfaceUri, ICloneable<Restriction>, IEquatable<Restriction>
Inheritance
Restriction
Implements
Derived
Inherited Members

Fields

DistributionZeroInstall

Special value for Distributions that requires require an implementation provided by Zero Install (i.e. one not provided by a PackageImplementation).

public const string DistributionZeroInstall = "0install"

Field Value

string

Properties

Constraints

A list of version Constraints that must be fulfilled.

[Browsable(false)]
[OrderedEquality]
public List<Constraint> Constraints { get; }

Property Value

List<Constraint>

Distributions

Specifies that the selected implementation must be from one of the given distributions (e.g. Debian, RPM). The special value DistributionZeroInstall may be used to require an implementation provided by Zero Install (i.e. one not provided by a PackageImplementation).

[Browsable(false)]
[OrderedEquality]
public List<string> Distributions { get; }

Property Value

List<string>

DistributionsString

Specifies that the selected implementation must be from one of the space-separated distributions (e.g. Debian, RPM). The special value '0install' may be used to require an implementation provided by Zero Install (i.e. one not provided by a PackageImplementation).

[TypeConverter(typeof(DistributionNameConverter))]
[IgnoreEquality]
public string DistributionsString { get; set; }

Property Value

string
See Also

InterfaceUri

The URI or local path used to identify the interface.

public required FeedUri InterfaceUri { get; set; }

Property Value

FeedUri

OS

Determines for which operating systems this dependency is required.

public OS OS { get; set; }

Property Value

OS

Versions

A more flexible alternative to Constraints. Each range is in the form "START..!END". The range matches versions where START <= VERSION < END. The start or end may be omitted. A single version number may be used instead of a range to match only that version, or !VERSION to match everything except that version.

public VersionRange? Versions { get; set; }

Property Value

VersionRange

XmlTagName

protected virtual string XmlTagName { get; }

Property Value

string

Methods

Clone()

Creates a deep copy of this Restriction instance.

public virtual Restriction Clone()

Returns

Restriction

The new copy of the Restriction.

Equals(object?)

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

Equals(Restriction?)

protected bool Equals(Restriction? other)

Parameters

other Restriction

Returns

bool

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

IsApplicable(Requirements)

Determines whether this reference is applicable for the given requirements.

public virtual bool IsApplicable(Requirements requirements)

Parameters

requirements Requirements

Returns

bool

Normalize()

Flattens inheritance structures, Converts legacy elements, sets default values, etc..

public virtual void Normalize()

Exceptions

InvalidDataException

A required property is not set or invalid.

ToString()

Returns the dependency in the form "Interface". Not safe for parsing!

public override string ToString()

Returns

string

Operators

operator ==(Restriction?, Restriction?)

Indicates whether the object on the left is equal to the object on the right.

public static bool operator ==(Restriction? left, Restriction? right)

Parameters

left Restriction

The left object

right Restriction

The right object

Returns

bool

true if the objects are equal; otherwise, false.

operator !=(Restriction?, Restriction?)

Indicates whether the object on the left is not equal to the object on the right.

public static bool operator !=(Restriction? left, Restriction? right)

Parameters

left Restriction

The left object

right Restriction

The right object

Returns

bool

true if the objects are not equal; otherwise, false.