Skip to content
Draft
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -355,3 +355,4 @@ MigrationBackup/
# WinMerge bak files
*.bak
/switcher.json
/.claude/settings.local.json
5 changes: 5 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ Test framework: **NUnit**. Test classes use `[TestFixture]` and `[Test]` attribu

## Architecture

### Code Generation

- favour duplicated code in codegeneration to have staticaly defined methods that provide performance over reflection based code.
- code generation is done by processing the UML model and creating handlebars templates

### Code Generation Pipeline

Most code in this repo is **auto-generated** — files marked `THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!` must not be edited directly.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,48 @@ public static TransitionFeatureKind Parse(ReadOnlySpan<char> value)
throw new ArgumentException($"'{new string(value)}' is not a valid TransitionFeatureKind", nameof(value));
}

/// <summary>
/// Tries to parse the <see cref="ReadOnlySpan{Char}"/> to a <see cref="TransitionFeatureKind"/>
/// </summary>
/// <param name="value">
/// The <see cref="ReadOnlySpan{Char}"/> that is to be parsed
/// </param>
/// <param name="result">
/// When this method returns, contains the <see cref="TransitionFeatureKind"/> value equivalent
/// to the span, if the conversion succeeded, or <c>default</c> if the conversion failed.
/// </param>
/// <returns>
/// <c>true</c> if <paramref name="value"/> was converted successfully; otherwise, <c>false</c>.
/// </returns>
/// <remarks>
/// This method is suited for string parsing
/// There are zero allocations, no boxing, Fast short-circuit evaluation
/// JIT friendly
/// </remarks>
public static bool TryParse(ReadOnlySpan<char> value, out TransitionFeatureKind result)
{
if (value.Length == 7 && value.Equals("trigger".AsSpan(), StringComparison.OrdinalIgnoreCase))
{
result = TransitionFeatureKind.Trigger;
return true;
}

if (value.Length == 5 && value.Equals("guard".AsSpan(), StringComparison.OrdinalIgnoreCase))
{
result = TransitionFeatureKind.Guard;
return true;
}

if (value.Length == 6 && value.Equals("effect".AsSpan(), StringComparison.OrdinalIgnoreCase))
{
result = TransitionFeatureKind.Effect;
return true;
}

result = default;
return false;
}

/// <summary>
/// Parses the <see cref="ReadOnlySpan{Byte}"/> to a <see cref="TransitionFeatureKind"/>
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,48 @@ public static VisibilityKind Parse(ReadOnlySpan<char> value)
throw new ArgumentException($"'{new string(value)}' is not a valid VisibilityKind", nameof(value));
}

/// <summary>
/// Tries to parse the <see cref="ReadOnlySpan{Char}"/> to a <see cref="VisibilityKind"/>
/// </summary>
/// <param name="value">
/// The <see cref="ReadOnlySpan{Char}"/> that is to be parsed
/// </param>
/// <param name="result">
/// When this method returns, contains the <see cref="VisibilityKind"/> value equivalent
/// to the span, if the conversion succeeded, or <c>default</c> if the conversion failed.
/// </param>
/// <returns>
/// <c>true</c> if <paramref name="value"/> was converted successfully; otherwise, <c>false</c>.
/// </returns>
/// <remarks>
/// This method is suited for string parsing
/// There are zero allocations, no boxing, Fast short-circuit evaluation
/// JIT friendly
/// </remarks>
public static bool TryParse(ReadOnlySpan<char> value, out VisibilityKind result)
{
if (value.Length == 7 && value.Equals("private".AsSpan(), StringComparison.OrdinalIgnoreCase))
{
result = VisibilityKind.Private;
return true;
}

if (value.Length == 9 && value.Equals("protected".AsSpan(), StringComparison.OrdinalIgnoreCase))
{
result = VisibilityKind.Protected;
return true;
}

if (value.Length == 6 && value.Equals("public".AsSpan(), StringComparison.OrdinalIgnoreCase))
{
result = VisibilityKind.Public;
return true;
}

result = default;
return false;
}

/// <summary>
/// Parses the <see cref="ReadOnlySpan{Byte}"/> to a <see cref="VisibilityKind"/>
/// </summary>
Expand Down
Loading
Loading