From a0dd2bc561ee6aa6b7aebedcff76c8a11e14bc9f Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Fri, 26 Mar 2021 15:38:00 -0700 Subject: Make the IntermediateSection and IntermediateSymbol less mutable --- src/WixToolset.Data/IntermediateSymbol.cs | 53 ++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 4 deletions(-) (limited to 'src/WixToolset.Data/IntermediateSymbol.cs') diff --git a/src/WixToolset.Data/IntermediateSymbol.cs b/src/WixToolset.Data/IntermediateSymbol.cs index 408be37c..4be17094 100644 --- a/src/WixToolset.Data/IntermediateSymbol.cs +++ b/src/WixToolset.Data/IntermediateSymbol.cs @@ -6,15 +6,28 @@ namespace WixToolset.Data using System.Diagnostics; using SimpleJson; + /// + /// Intermediate symbol. + /// [DebuggerDisplay("{DebuggerDisplay,nq}")] public class IntermediateSymbol { private object tags; + /// + /// Creates an intermediate symbol. + /// + /// Symbol definition. public IntermediateSymbol(IntermediateSymbolDefinition definition) : this(definition, null, null) { } + /// + /// Creates an intermediate symbol with source line number and identifier. + /// + /// Symbol definition. + /// Source line number. + /// Symbol identifier. public IntermediateSymbol(IntermediateSymbolDefinition definition, SourceLineNumber sourceLineNumber, Identifier id = null) { this.Definition = definition; @@ -23,18 +36,40 @@ namespace WixToolset.Data this.Id = id; } + /// + /// Gets the symbol's definition. + /// public IntermediateSymbolDefinition Definition { get; } + /// + /// Gets the symbol's fields. + /// public IntermediateField[] Fields { get; } - public SourceLineNumber SourceLineNumbers { get; set; } - - public Identifier Id { get; set; } - + /// + /// Gets the optional source line number of the symbol. + /// + public SourceLineNumber SourceLineNumbers { get; internal set; } + + /// + /// Gets the optional identifier for the symbol. + /// + public Identifier Id { get; internal set; } + + /// + /// Direct access by index to the symbol's fields. + /// + /// Index of the field to access. + /// Symbol's field. public IntermediateField this[int index] => this.Fields[index]; private string DebuggerDisplay => $"{this.Definition?.Name} {this.Id?.Id}"; + /// + /// Add a custom tag to the symbol. + /// + /// String tag to add to the symbol. + /// True if the tag was added; otherwise false if th tag was already present. public bool AddTag(string add) { if (this.tags == null) @@ -73,6 +108,11 @@ namespace WixToolset.Data return true; } + /// + /// Tests whether a symbol has a tag. + /// + /// String tag to find. + /// True if the symbol has the tag; otherwise false. public bool HasTag(string has) { if (this.tags == null) @@ -97,6 +137,11 @@ namespace WixToolset.Data return false; } + /// + /// Removes a tag from the symbol. + /// + /// String tag to remove. + /// True if the tag was removed; otherwise false if the tag was not present. public bool RemoveTag(string remove) { if (this.tags is string tag) -- cgit v1.2.3-55-g6feb