Class Restriction
Restricts the versions of an Implementation that are allowed without creating a dependency on the implementation if its was not already chosen.
Implements
Inherited Members
Namespace: ZeroInstall.Model
Assembly: ZeroInstall.Model.dll
Syntax
public class Restriction : FeedElement, IInterfaceUri
Constructors
Restriction()
Declaration
public Restriction()
Fields
DistributionZeroInstall
Special value for Distributions that requires require an implementation provided by Zero Install (i.e. one not provided by a PackageImplementation).
Declaration
public const string DistributionZeroInstall = "0install"
Field Value
Type | Description |
---|---|
String |
Properties
Constraints
A list of version Constraints that must be fulfilled.
Declaration
public List<Constraint> Constraints { get; }
Property Value
Type | Description |
---|---|
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).
Declaration
public List<string> Distributions { get; }
Property Value
Type | Description |
---|---|
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).
Declaration
public string DistributionsString { get; set; }
Property Value
Type | Description |
---|---|
String |
See Also
InterfaceUri
The URI or local path used to identify the interface.
Declaration
public FeedUri InterfaceUri { get; set; }
Property Value
Type | Description |
---|---|
FeedUri |
InterfaceUriString
Used for XML serialization.
Declaration
public string InterfaceUriString { get; set; }
Property Value
Type | Description |
---|---|
String |
See Also
OS
Determines for which operating systems this dependency is required.
Declaration
public OS OS { get; set; }
Property Value
Type | Description |
---|---|
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.
Declaration
public VersionRange Versions { get; set; }
Property Value
Type | Description |
---|---|
VersionRange |
VersionsString
Used for XML serialization.
Declaration
public string VersionsString { get; set; }
Property Value
Type | Description |
---|---|
String |
See Also
XmlTagName
Declaration
protected virtual string XmlTagName { get; }
Property Value
Type | Description |
---|---|
String |
Methods
Clone()
Creates a deep copy of this Restriction instance.
Declaration
public virtual Restriction Clone()
Returns
Type | Description |
---|---|
Restriction | The new copy of the Restriction. |
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj |
Returns
Type | Description |
---|---|
Boolean |
Overrides
Equals(Restriction)
Declaration
public bool Equals(Restriction other)
Parameters
Type | Name | Description |
---|---|---|
Restriction | other |
Returns
Type | Description |
---|---|
Boolean |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 |
Overrides
IsApplicable(Requirements)
Determines whether this reference is applicable for the given requirements
.
Declaration
public virtual bool IsApplicable(Requirements requirements)
Parameters
Type | Name | Description |
---|---|---|
Requirements | requirements |
Returns
Type | Description |
---|---|
Boolean |
Normalize()
Flattens inheritance structures, Converts legacy elements, sets default values, etc..
Declaration
public virtual void Normalize()
Exceptions
Type | Condition |
---|---|
InvalidDataException | A required property is not set or invalid. |
ToString()
Returns the dependency in the form "Interface". Not safe for parsing!
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String |
Operators
Equality(Restriction, Restriction)
Indicates whether the object on the left is equal to the object on the right.
Declaration
public static bool operator ==(Restriction left, Restriction right)
Parameters
Type | Name | Description |
---|---|---|
Restriction | left | The left object |
Restriction | right | The right object |
Returns
Type | Description |
---|---|
Boolean | true if the objects are equal; otherwise, false. |
Inequality(Restriction, Restriction)
Indicates whether the object on the left is not equal to the object on the right.
Declaration
public static bool operator !=(Restriction left, Restriction right)
Parameters
Type | Name | Description |
---|---|---|
Restriction | left | The left object |
Restriction | right | The right object |
Returns
Type | Description |
---|---|
Boolean | true if the objects are not equal; otherwise, false. |