Table of Contents

Class ContainerDescription<TContainer>

Namespace
NanoByte.StructureEditor
Assembly
NanoByte.StructureEditor.dll

Describes an object that contains nodes (properties and/or lists). Provides information about how to edit this content.

public class ContainerDescription<TContainer> : IContainerDescription<TContainer> where TContainer : class

Type Parameters

TContainer

The type of the container to be described.

Inheritance
ContainerDescription<TContainer>
Implements
Inherited Members
Extension Methods

Methods

AddList<TList>(Func<TContainer, IList<TList>>)

Adds a list to the description.

public IListDescription<TContainer, TList> AddList<TList>(Func<TContainer, IList<TList>> getList) where TList : class

Parameters

getList Func<TContainer, IList<TList>>

A function to retrieve the list from the container.

Returns

IListDescription<TContainer, TList>

A list description, enabling you to specify explicit sub-types of TList allowed in the list.

Type Parameters

TList

The type of elements in the list.

AddPlainList<TElement, TEditor>(string, Func<TContainer, IList<TElement>>, Func<TElement>, TEditor)

Adds a list with only one type of element to the description.

public IContainerDescription<TContainer> AddPlainList<TElement, TEditor>(string name, Func<TContainer, IList<TElement>> getList, Func<TElement> factory, TEditor editor) where TElement : class, IEquatable<TElement> where TEditor : INodeEditor<TElement>, new()

Parameters

name string

The name of the element type.

getList Func<TContainer, IList<TElement>>

A function to retrieve the list from the container.

factory Func<TElement>

Callback to create a new instance of the element.

editor TEditor

Dummy element used for type inference of the editor class.

Returns

IContainerDescription<TContainer>

The "this" pointer for use in a "Fluent API" style.

Type Parameters

TElement

The type of elements in the list.

TEditor

An editor for modifying this type of element.

AddProperty<TProperty, TEditor>(string, Func<TContainer, PropertyPointer<TProperty?>>, Func<TProperty>, TEditor)

Adds a property to the description.

public IContainerDescription<TContainer> AddProperty<TProperty, TEditor>(string name, Func<TContainer, PropertyPointer<TProperty?>> getPointer, Func<TProperty> factory, TEditor editor) where TProperty : class, IEquatable<TProperty> where TEditor : INodeEditor<TProperty>, new()

Parameters

name string

The name of the property.

getPointer Func<TContainer, PropertyPointer<TProperty>>

A function to retrieve a pointer to property in the container.

factory Func<TProperty>

Callback to create a new instance of the property.

editor TEditor

Dummy element used for type inference of the editor class.

Returns

IContainerDescription<TContainer>

The "this" pointer for use in a "Fluent API" style.

Type Parameters

TProperty

The type of the property.

TEditor

An editor for modifying the content of the property.

GetCandidatesFor(TContainer)

Returns information about possible new child nodes for a specific instance of the container.

public IEnumerable<NodeCandidate?> GetCandidatesFor(TContainer container)

Parameters

container TContainer

The container instance to look at.

Returns

IEnumerable<NodeCandidate>

GetNodesIn(TContainer)

Returns information about nodes found in a specific instance of the container.

public IEnumerable<Node> GetNodesIn(TContainer container)

Parameters

container TContainer

The container instance to look in to.

Returns

IEnumerable<Node>