Zero Install .NET API 2.20.0
ZeroInstall.Model.Element Class Referenceabstract

Abstract base class for ImplementationBase and Group. Contains those parameters that can be transferred from a Group to an Implementation. More...

Inheritance diagram for ZeroInstall.Model.Element:
ZeroInstall.Model.TargetBase ZeroInstall.Model.IBindingContainer ZeroInstall.Model.IDependencyContainer NanoByte.Common.ICloneable< Element > ZeroInstall.Model.FeedElement ZeroInstall.Model.XmlUnknown ZeroInstall.Model.Group ZeroInstall.Model.ImplementationBase ZeroInstall.Model.PackageImplementation ZeroInstall.Model.Implementation ZeroInstall.Model.Selection.ImplementationSelection ZeroInstall.Services.Native.ExternalImplementation

Public Member Functions

bool ContainsCommand (string name)
 Determines whether Commands contains a Command with a specific name. More...
 
CommandGetCommand (string name)
 Returns the Command with a specific name. Safe for missing elements. More...
 
virtual void Normalize (FeedUri? feedUri=null)
 Flattens inheritance structures, Converts legacy elements, sets default values, etc.. More...
 
abstract Element Clone ()
 Creates a deep copy of this Element instance. More...
 
override int GetHashCode ()
 
- Public Member Functions inherited from ZeroInstall.Model.TargetBase
override int GetHashCode ()
 
- Public Member Functions inherited from ZeroInstall.Model.FeedElement
override int GetHashCode ()
 
- Public Member Functions inherited from ZeroInstall.Model.XmlUnknown
string ToShortXml ()
 Returns a shortened XML representation (with attributes but without child elements). More...
 
override int GetHashCode ()
 
- Public Member Functions inherited from NanoByte.Common.ICloneable< Element >
Element Clone ()
 

Static Public Attributes

const string ReleaseDateFormat = "yyyy-MM-dd"
 The string.Format(string,object[]) format used by ReleasedString
 

Protected Member Functions

virtual void EnsureAttributes ()
 Ensures that required values deserialized from XML attributes are set (not null). More...
 
bool Equals (Element? other)
 
- Protected Member Functions inherited from ZeroInstall.Model.TargetBase
bool Equals (TargetBase? other)
 
- Protected Member Functions inherited from ZeroInstall.Model.FeedElement
bool Equals (FeedElement? other)
 
- Protected Member Functions inherited from ZeroInstall.Model.XmlUnknown
void EnsureAttribute (object? value, string attributeName)
 Ensures that a value deserialized from an XML attribute is set (not null). More...
 
void EnsureAttributeSafeID (string? value, string attributeName)
 Ensures that a value deserialized from an XML attribute is set (not null) and only contains alphanumeric characters, spaces ( ), dots (.), underscores (_), hyphens (-) and plus signs (+). More...
 
bool Equals (XmlUnknown? other)
 

Static Protected Member Functions

static void CloneFromTo (Element from, Element to)
 Copies all known values from one instance to another. Helper method for instance cloning.
 
- Static Protected Member Functions inherited from ZeroInstall.Model.TargetBase
static void CloneFromTo (TargetBase from, TargetBase to)
 Copies all known values from one instance to another. Helper method for instance cloning.
 
- Static Protected Member Functions inherited from ZeroInstall.Model.FeedElement
static bool FilterMismatch (IRecipeStep step)
 Checks whether an element passes the specified IfZeroInstallVersion restriction, if any.
 

Protected Attributes

string? ReleasedVerbatim
 Used to store the unparsed release date string (instead of Released) if it ModelUtils.ContainsTemplateVariables.
 

Package Functions

void InheritFrom (Element parent)
 Transfers attributes from another Element object to this one. Existing values are not replaced. Provides an inheritance-like relation. More...
 

Properties

abstract IEnumerable< ImplementationImplementations [get]
 A flat list of all Implementations contained in this element. May be the element itself or its children.
 
virtual ? ImplementationVersion Version [getset]
 The version number of the implementation.
 
virtual ? string?? VersionString [getset]
 Used for XML serialization. More...
 
virtual ? string VersionModifier [getset]
 A string to be appended to the version. The purpose of this is to allow complex version numbers (such as "1.0-rc2") in older versions of the injector.
 
virtual DateTime Released [getset]
 The date this implementation was made available. For development versions checked out from version control this attribute should not be present.
 
virtual ? string? ReleasedString [getset]
 The string form of Released. Only use this if the string ModelUtils.ContainsTemplateVariables. More...
 
virtual Stability Stability = Stability.Unset [getset]
 The default stability rating for this implementation.
 
virtual int RolloutPercentage [getset]
 The percentage (0-100) of users that should treat this as Model.Stability.Stable. May only be set if Stability is Model.Stability.Unset or Model.Stability.Testing. This can be used to perform staged rollouts.
 
string? License [getset]
 License terms (typically a Trove category, as used on freshmeat.net).
 
string? Main [getset]
 The relative path of an executable inside the implementation that should be executed by default when the interface is run. If an implementation has no main setting, then it cannot be executed without specifying one manually. This typically means that the interface is for a library. More...
 
string? SelfTest [getset]
 The relative path of an executable inside the implementation that can be executed to test the program. The program must be non-interactive (e.g. it can't open any windows or prompt for input). It should return with an exit status of 0 if the tests pass. Any other status indicates failure. More...
 
string? DocDir [getset]
 The relative path of a directory inside the implementation that contains the package's documentation. This is the directory that would end up inside /usr/share/doc on a traditional Linux system.
 
List< DependencyDependencies = new() [get]
 A list of interfaces this implementation depends upon.
 
List< RestrictionRestrictions = new() [get]
 A list of interfaces that are restricted to specific versions when used.
 
List< BindingBindings = new() [get]
 A list of Bindings for Implementations to locate Dependencys.
 
List< CommandCommands = new() [get]
 A list of commands that can be used to launch this implementation. More...
 
Commandthis[string name] [get]
 Returns the Command with a specific name. More...
 
- Properties inherited from ZeroInstall.Model.TargetBase
LanguageSet?? Languages [getset]
 The natural language(s) which an Implementation supports. More...
 
Architecture Architecture [getset]
 For platform-specific binaries, the platform for which an Implementation was compiled. More...
 
string LanguagesString [getset]
 Used for XML serialization. More...
 
string ArchitectureString [getset]
 Used for XML serialization. More...
 
- Properties inherited from ZeroInstall.Model.FeedElement
VersionRangeIfZeroInstallVersion [getset]
 Only process this element if the current Zero Install version matches the range.
 
string??? IfZeroInstallVersionString [getset]
 Used for XML serialization. More...
 
- Properties inherited from ZeroInstall.Model.IBindingContainer
List< BindingBindings [get]
 A list of Bindings for Implementations to locate Dependencys.
 
- Properties inherited from ZeroInstall.Model.IDependencyContainer
List< DependencyDependencies [get]
 A list of interfaces this implementation depends upon.
 
List< RestrictionRestrictions [get]
 A list of interfaces that are restricted to specific versions when used.
 

Additional Inherited Members

- Public Attributes inherited from ZeroInstall.Model.XmlUnknown
XmlAttribute?[] UnknownAttributes
 Contains any unknown additional XML attributes.
 
XmlElement?[] UnknownElements
 Contains any unknown additional XML elements.
 
- Static Package Functions inherited from ZeroInstall.Model.FeedElement
static bool FilterMismatch< T > (T element)
 Checks whether an element passes the specified IfZeroInstallVersion restriction, if any. More...
 

Detailed Description

Abstract base class for ImplementationBase and Group. Contains those parameters that can be transferred from a Group to an Implementation.

Member Function Documentation

◆ Clone()

abstract Element ZeroInstall.Model.Element.Clone ( )
pure virtual

◆ ContainsCommand()

bool ZeroInstall.Model.Element.ContainsCommand ( string  name)
inline

Determines whether Commands contains a Command with a specific name.

Parameters
nameThe Command.Name to look for; string.Empty for none.
Returns
true if a matching command was found or if name is string.Empty; false otherwise.

◆ EnsureAttributes()

virtual void ZeroInstall.Model.Element.EnsureAttributes ( )
protectedvirtual

Ensures that required values deserialized from XML attributes are set (not null).

Exceptions
InvalidDataExceptionA required property is not set or invalid.

Reimplemented in ZeroInstall.Model.PackageImplementation.

◆ GetCommand()

Command? ZeroInstall.Model.Element.GetCommand ( string  name)
inline

Returns the Command with a specific name. Safe for missing elements.

Parameters
nameThe Command.Name to look for.
Returns
The first matching command; null if no matching one was found.

Should only be called after Normalize has been called, otherwise nested Implementations will not be considered.

◆ InheritFrom()

void ZeroInstall.Model.Element.InheritFrom ( Element  parent)
inlinepackage

Transfers attributes from another Element object to this one. Existing values are not replaced. Provides an inheritance-like relation.

Parameters
parentThe object to take the attributes from.

◆ Normalize()

virtual void ZeroInstall.Model.Element.Normalize ( FeedUri feedUri = null)
inlinevirtual

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

Parameters
feedUriThe feed the data was originally loaded from.
Exceptions
InvalidDataExceptionA required property is not set or invalid.

Reimplemented in ZeroInstall.Model.Group, ZeroInstall.Model.Implementation, ZeroInstall.Model.ImplementationBase, and ZeroInstall.Model.Selection.ImplementationSelection.

Property Documentation

◆ Commands

List<Command> ZeroInstall.Model.Element.Commands = new()
get

A list of commands that can be used to launch this implementation.

This will eventually replace Main and SelfTest.

◆ Main

string? ZeroInstall.Model.Element.Main
getset

The relative path of an executable inside the implementation that should be executed by default when the interface is run. If an implementation has no main setting, then it cannot be executed without specifying one manually. This typically means that the interface is for a library.

This is deprecated in favor of Commands. null corresponds to no Commands. An empty string corresponds to a Command with no Command.Path.

◆ ReleasedString

virtual ? string? ZeroInstall.Model.Element.ReleasedString
getset

The string form of Released. Only use this if the string ModelUtils.ContainsTemplateVariables.

See also
Released

◆ SelfTest

string? ZeroInstall.Model.Element.SelfTest
getset

The relative path of an executable inside the implementation that can be executed to test the program. The program must be non-interactive (e.g. it can't open any windows or prompt for input). It should return with an exit status of 0 if the tests pass. Any other status indicates failure.

This is deprecated in favor of Commands. null corresponds to no Commands. An empty string corresponds to a Command with no Command.Path.

◆ this[string name]

Command? ZeroInstall.Model.Element.this[string name]
get

Returns the Command with a specific name.

Parameters
nameThe Command.Name to look for; string.Empty for none.
Returns
The first matching command; null if name is string.Empty.
Exceptions
KeyNotFoundExceptionNo matching Command was found.

Should only be called after Normalize has been called, otherwise nested Implementations will not be considered.

◆ VersionString

virtual ? string?? ZeroInstall.Model.Element.VersionString
getset

Used for XML serialization.

See also
Version

The documentation for this class was generated from the following file: