ElementBuilder Class

Summary

[Editor-Only] Base class for building any element in a procedural script such as namespaces, types, fields, etc.
Assembly
Weaver.dll
Namespace
Weaver.Editor.Procedural.Scripting
Base Types
  • Object
Derived Types
graph BT Type-->Base0["Object"] Type["ElementBuilder"] class Type type-node Derived0["MemberBuilder"]-->Type click Derived0 "/weaver/api/Weaver.Editor.Procedural.Scripting/MemberBuilder" Derived1["NamespaceBuilder"]-->Type click Derived1 "/weaver/api/Weaver.Editor.Procedural.Scripting/NamespaceBuilder"

Syntax

public abstract class ElementBuilder

Constructors

Name Summary
ElementBuilder() Creates a new Weaver.Editor.Procedural.Scripting.MemberBuilder with the default values.

Consider using one of the overloads of Get instead, in order to utilise object pooling to minimise memory allocation and garbage collection.

Fields

Name Constant Value Summary
DefaultCommentBuilder
The default delegate to use to build the XML comment for this element. Assigned using the return value of Weaver.Editor.Procedural.Scripting.ElementBuilder.GetDefaultCommentBuilder.

Properties

Name Value Summary
CommentBuilder Action<StringBuilder>
This delegate is used to append the XML comment for this element. By default it will simply append the Weaver.Editor.Procedural.Scripting.ElementBuilder.NameSource.
CompilationSymbolIndex int
The index in Weaver.Editor.Procedural.Scripting.ScriptBuilder.CompilationSymbols of the symbol in which this element will be declared, I.E. #if SYMBOL.
FullName string
Returns the full name of this element, including its Weaver.Editor.Procedural.Scripting.ElementBuilder.Parent (and any types and namespaces it is nested inside).
HasExistingMember bool
Returns true if this element is associated with an existing System.Reflection.MemberInfo.
IsFallbackName bool
Indicates whether the current Weaver.Editor.Procedural.Scripting.ElementBuilder.Name of this element is the primary name derived from the Weaver.Editor.Procedural.Scripting.ElementBuilder.NameSource. A value of false means that there was a name conflict between this element and another, and the Weaver.Editor.Procedural.Scripting.ElementBuilder.Name was re-derived using Weaver.Editor.Procedural.Scripting.ScriptBuilder.GetFallbackMemberName(System.String,System.String).
MemberType MemberTypes
The type of member which this element builds.
Name string
The actual Weaver.Editor.Procedural.Scripting.ElementBuilder.Name of this element. This value is derived from Weaver.Editor.Procedural.Scripting.ElementBuilder.NameSource during Weaver.Editor.Procedural.Scripting.ElementBuilder.PrepareToBuild(System.Boolean,System.Boolean@).
NameSource string
The source string which will be used to determine the actual Weaver.Editor.Procedural.Scripting.ElementBuilder.Name of this element.
Namespace string
The name of the Weaver.Editor.Procedural.Scripting.NamespaceBuilder containing this type (or null if there isn't one).
Parent IElementBuilderGroup
The builder of the type in which this element will be declared.
RegionIndex int
The index in Weaver.Editor.Procedural.Scripting.ScriptBuilder.Regions of the region in which this element will be declared, I.E. #region Region Name.
ScriptBuilder ScriptBuilder
The Weaver.Editor.Procedural.Scripting.ScriptBuilder in which this element is currently being used.

Methods

Name Value Summary
AppendDescription(StringBuilder, int) void
Appends a description of this element by calling Weaver.Editor.Procedural.Scripting.ElementBuilder.ToString on it.
AppendFullName(StringBuilder) void
Appends the full name of this element, including its Weaver.Editor.Procedural.Scripting.ElementBuilder.Parent (and any types and namespaces it is nested inside).
AppendHeader(StringBuilder, int) void
Appends a C# XML comment using the Weaver.Editor.Procedural.Scripting.ElementBuilder.CommentBuilder.
AppendScript(StringBuilder, int) void
Appends the declaration of this element in C# code to the specified `text`.
DetermineMemberName(ScriptBuilder) void
Uses the specified Weaver.Editor.Procedural.Scripting.ScriptBuilder.GetMemberName(System.String,System.String,System.Boolean@) to determine the Weaver.Editor.Procedural.Scripting.ElementBuilder.Name of this element.
GetDefaultCommentBuilder() Action<StringBuilder>
Returns the default method to use to build XML comments for this element. Called once by the constructor.
GetDescription() string
Gets a description of this element by calling Weaver.Editor.Procedural.Scripting.ElementBuilder.ToString on it and any sub-members.
Initialize(IElementBuilderGroup, string) void
Assigns the specified parameters to this element and determines the Weaver.Editor.Procedural.Scripting.ElementBuilder.Name.
IsExistingMember(MemberInfo, bool) bool
Checks if the `existingMember` corresponds to this element.
ReleaseToPool() void
Resets this element and adds it to its object pool to be reused later.
Reset() void
Resets all of the fields and properties of this element to their default values.
SetName(string) void
Sets the Weaver.Editor.Procedural.Scripting.ElementBuilder.Name and Weaver.Editor.Procedural.Scripting.ElementBuilder.NameSource.
ToString() string
Returns a summary of this element including its type, Weaver.Editor.Procedural.Scripting.ElementBuilder.NameSource, Weaver.Editor.Procedural.Scripting.ElementBuilder.Name, and Weaver.Editor.Procedural.Scripting.ElementBuilder.FullName.