Skip to content

Commit

Permalink
HasValue and IsKnown.
Browse files Browse the repository at this point in the history
  • Loading branch information
Corniel committed Aug 24, 2023
1 parent 3769ff8 commit 8a28fac
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Qowaiv.CodeGeneration.SingleValueObjects/Snippets/Structure.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,35 @@ public partial struct @TSvo
private @TSvo(@type_n value) => m_Value = value;

/// <summary>The inner value of the @FullName.</summary>
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private readonly @type_n m_Value;
#endif // exec
#if !NotIsEmpty // exec

/// <summary>False if the @FullName is empty, otherwise true.</summary>
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public bool HasValue => m_Value != default;
#endif // exec
#if !NotIsEmptyOrUnknown // exec

/// <summary>False if the @FullName is empty or unknown, otherwise true.</summary>
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public bool IsKnown => m_Value != default && m_Value != Unknown.m_Value;
#endif // exec
#if !NotIsEmpty // exec

/// <summary>Returns true if the @FullName is empty, otherwise false.</summary>
[Pure]
public bool IsEmpty() => m_Value == default;
#endif // exec
#if !NotIsUnknown // exec

/// <summary>Returns true if the @FullName is unknown, otherwise false.</summary>
[Pure]
public bool IsUnknown() => m_Value == Unknown.m_Value;
#endif // exec
#if !NotIsEmptyOrUnknown // exec

/// <summary>Returns true if the @FullName is empty or unknown, otherwise false.</summary>
[Pure]
public bool IsEmptyOrUnknown() => IsEmpty() || IsUnknown();
Expand Down

0 comments on commit 8a28fac

Please sign in to comment.