ScriptBuilder Class

Summary

[Editor-Only] Determines the naming conventions for a procedural C# script, as well as for #region names, #if symbols, and the messages used for obsolete members.
graph BT Type-->Base0["NamespaceBuilder"] click Base0 "/weaver/api/Weaver.Editor.Procedural.Scripting/NamespaceBuilder" Base0-->Base1["ElementBuilder"] click Base1 "/weaver/api/Weaver.Editor.Procedural.Scripting/ElementBuilder" Base1-->Base2["Object"] Type-.->Interface0["IElementBuilderGroup"] click Interface0 "/weaver/api/Weaver.Editor.Procedural.Scripting/IElementBuilderGroup" Type["ScriptBuilder"] class Type type-node Derived0["SimpleScriptBuilder"]-->Type click Derived0 "/weaver/api/Weaver.Editor.Procedural/SimpleScriptBuilder"

Syntax

public class ScriptBuilder : NamespaceBuilder, IElementBuilderGroup

Constructors

Name Summary
ScriptBuilder() Creates a new Weaver.Editor.Procedural.Scripting.ScriptBuilder.

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.
Inherited from ElementBuilder
Elements
The members to build in this type, including Weaver.Editor.Procedural.Scripting.TypeBuilders for any nested types.
Inherited from NamespaceBuilder

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.
Inherited from ElementBuilder
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.
Inherited from ElementBuilder
CompilationSymbols string[]
The conditional compilation symbols used in #if regions in the procedural script. The indices of these values are referenced by Weaver.Editor.Procedural.Scripting.ElementBuilder.CompilationSymbolIndex.
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).
Inherited from ElementBuilder
HasBuildErrors bool
Returns true if any errors occurred during the last call to Weaver.Editor.Procedural.Scripting.ElementBuilder.PrepareToBuild(System.Boolean,System.Boolean@).
static
HasExistingMember bool
Returns true if this element is associated with an existing System.Reflection.MemberInfo.
Inherited from ElementBuilder
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).
Inherited from ElementBuilder
MemberType MemberTypes
Namespaces are not members, so this property returns System.Reflection.MemberTypes.Custom.
Inherited from NamespaceBuilder
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@).
Inherited from ElementBuilder
NameSource string
The source string which will be used to determine the actual Weaver.Editor.Procedural.Scripting.ElementBuilder.Name of this element.
Inherited from ElementBuilder
Namespace string
The name of the Weaver.Editor.Procedural.Scripting.NamespaceBuilder containing this type (or null if there isn't one).
Inherited from NamespaceBuilder
ObsoleteAttributeMessage string
The message given to the [System.ObsoleteAttribute] constructor to be displayed whenever an obsolete member is referenced.
ObsoleteMembersAreEditorOnly bool
If true, obsolete members will be contained in a #if UNITY_EDITOR region to ensure that the user removes all references to them prior to compiling a build (because otherwise they would get compile errors). By default this property returns true.
Parent IElementBuilderGroup
The builder of the type in which this element will be declared.
Inherited from ElementBuilder
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.
Inherited from ElementBuilder
Regions string[]
The names used in #regions in the procedural script. The indices of these values are referenced by Weaver.Editor.Procedural.Scripting.ElementBuilder.RegionIndex.
ScriptBuilder ScriptBuilder
The Weaver.Editor.Procedural.Scripting.ScriptBuilder in which this element is currently being used.
Inherited from ElementBuilder

Methods

Name Value Summary
AddMember<T>(T) T
Adds the specified `member` to the Weaver.Editor.Procedural.Scripting.NamespaceBuilder.Elements list and returns it.
Inherited from NamespaceBuilder
AddNamespace(string) NamespaceBuilder
Get a Weaver.Editor.Procedural.Scripting.ConstructorBuilder from the object pool and initialize it with the specified parameters as a member of this namespace.
Inherited from NamespaceBuilder
AddType(string) TypeBuilder
Get a Weaver.Editor.Procedural.Scripting.TypeBuilder from the object pool and initialize it with the specified parameters as a member of this namespace.
Inherited from NamespaceBuilder
AddType(string, CachedTypeInfo) TypeBuilder
Get a Weaver.Editor.Procedural.Scripting.TypeBuilder from the object pool and initialize it with the specified parameters as a member of this namespace.
Inherited from NamespaceBuilder
AddType(string, Type) TypeBuilder
Get a Weaver.Editor.Procedural.Scripting.TypeBuilder from the object pool and initialize it with the specified parameters as a member of this namespace.
Inherited from NamespaceBuilder
AppendDescription(StringBuilder, int) void
Appends a description of this namespace and its Weaver.Editor.Procedural.Scripting.NamespaceBuilder.Elements.
Inherited from NamespaceBuilder
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).
Inherited from ElementBuilder
AppendHeader(StringBuilder, int) void
Appends a C# XML comment using the Weaver.Editor.Procedural.Scripting.ElementBuilder.CommentBuilder.
Inherited from ElementBuilder
AppendScript(StringBuilder, int) void
Appends the declaration of this namespace in C# code to the specified `text`.
Inherited from NamespaceBuilder
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.
Inherited from ElementBuilder
Get(IElementBuilderGroup, string) NamespaceBuilder
Get a Weaver.Editor.Procedural.Scripting.NamespaceBuilder from the object pool and initialize it with the specified parameters.
Inherited from NamespaceBuilder
static
Get(ScriptBuilder, string) NamespaceBuilder
Get a Weaver.Editor.Procedural.Scripting.NamespaceBuilder from the object pool and initialize it with the specified parameters.
Inherited from NamespaceBuilder
static
GetCompilationSymbolCount() int
Returns the number of Weaver.Editor.Procedural.Scripting.ScriptBuilder.CompilationSymbols .
GetDefaultCommentBuilder() Action<StringBuilder>
Namespaces are not generally allowed to have comments.
Inherited from NamespaceBuilder
GetDescription() string
Gets a description of this element by calling Weaver.Editor.Procedural.Scripting.ElementBuilder.ToString on it and any sub-members.
Inherited from ElementBuilder
GetFallbackMemberName(string, string) string
Converts the `nameSource` into a valid member name according to the desired naming convention when the primary name returned by Weaver.Editor.Procedural.Scripting.ScriptBuilder.GetPrimaryMemberName(System.String) caused a naming conflict.

By default, this method uses Weaver.Editor.Procedural.Scripting.CSharpProcedural.ValidateMemberName(System.String,System.Boolean) with the `replaceWithUnderscores` parameter set to false.
GetMemberName(string, string, bool) string
Converts the `nameSource` into a valid member name using Weaver.Editor.Procedural.Scripting.ScriptBuilder.GetPrimaryMemberName(System.String). If the name is the same as the `declaringTypeName`, Weaver.Editor.Procedural.Scripting.ScriptBuilder.GetFallbackMemberName(System.String,System.String) will be used instead.
GetPrimaryMemberName(string) string
Converts the `nameSource` into a valid member name according to the desired naming convention.

By default, this method uses Weaver.Editor.Procedural.Scripting.CSharpProcedural.ValidateMemberName(System.String,System.Boolean).
GetRegionCount() int
Returns the number of Weaver.Editor.Procedural.Scripting.ScriptBuilder.Regions .
Initialize(IElementBuilderGroup, string) void
Assigns the specified parameters to this element and determines the Weaver.Editor.Procedural.Scripting.ElementBuilder.Name.
Inherited from ElementBuilder
IsExistingMember(MemberInfo, bool) bool
Returns false because namespaces don't have any System.Reflection.MemberInfo.
Inherited from NamespaceBuilder
LogRebuildReason(string) void
Logs the `reason` that this script should be rebuilt.
PrepareForReuse() void
Reset this type and call Weaver.Editor.Procedural.Scripting.ElementBuilder.ReleaseToPool on all its members so that it can be reused without releasing this type itself to the pool.
Inherited from NamespaceBuilder
PrepareToBuild(bool, bool) bool
Determines the Weaver.Editor.Procedural.Scripting.ElementBuilder.Name of this type's members, attempts to resolve any naming conflicts, matches existing System.Reflection.MemberInfos with their appropriate members, and returns true if the script should be rebuilt for any reason (such as a member being added, removed, or renamed).
ReleaseElementsToPool() void
Releases all elements currently in this namespace back to their respective pools.
Inherited from NamespaceBuilder
ReleaseToPool() void
Resets this element and adds it to its object pool to be reused later.
Inherited from NamespaceBuilder
Reset() void
Resets all of the fields and properties of this element to their default values.
Inherited from NamespaceBuilder
SetName(string) void
Sets the Weaver.Editor.Procedural.Scripting.ElementBuilder.Name and Weaver.Editor.Procedural.Scripting.ElementBuilder.NameSource.
Inherited from ElementBuilder
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.
Inherited from ElementBuilder