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
TContainerThe type of the container to be described.
- Inheritance
-
ContainerDescription<TContainer>
- Implements
-
IContainerDescription<TContainer>
- 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
Returns
- IListDescription<TContainer, TList>
A list description, enabling you to specify explicit sub-types of
TListallowed in the list.
Type Parameters
TListThe 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
namestringThe name of the element type.
getListFunc<TContainer, IList<TElement>>A function to retrieve the list from the container.
factoryFunc<TElement>Callback to create a new instance of the element.
editorTEditorDummy element used for type inference of the editor class.
Returns
- IContainerDescription<TContainer>
The "this" pointer for use in a "Fluent API" style.
Type Parameters
TElementThe type of elements in the list.
TEditorAn 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
namestringThe name of the property.
getPointerFunc<TContainer, PropertyPointer<TProperty>>A function to retrieve a pointer to property in the container.
factoryFunc<TProperty>Callback to create a new instance of the property.
editorTEditorDummy element used for type inference of the editor class.
Returns
- IContainerDescription<TContainer>
The "this" pointer for use in a "Fluent API" style.
Type Parameters
TPropertyThe type of the property.
TEditorAn 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
containerTContainerThe container instance to look at.
Returns
GetNodesIn(TContainer)
Returns information about nodes found in a specific instance of the container.
public IEnumerable<Node> GetNodesIn(TContainer container)
Parameters
containerTContainerThe container instance to look in to.