#nullable enable using System.CodeDom.Compiler; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; namespace Terminal.Gui.EnumExtensions; /// Extension methods for the type. [GeneratedCode ("Terminal.Gui.Analyzers.Internal", "1.0")] [CompilerGenerated] [DebuggerNonUserCode] [ExcludeFromCodeCoverage (Justification = "Generated code is already tested.")] [PublicAPI] public static class KeyBindingScopeExtensions { /// /// Directly converts this value to an value with the /// same binary representation. /// /// NO VALIDATION IS PERFORMED! [MethodImpl (MethodImplOptions.AggressiveInlining)] public static int AsInt32 (this KeyBindingScope e) => Unsafe.As (ref e); /// /// Directly converts this value to a value with the /// same binary representation. /// /// NO VALIDATION IS PERFORMED! [MethodImpl (MethodImplOptions.AggressiveInlining)] public static uint AsUInt32 (this KeyBindingScope e) => Unsafe.As (ref e); /// /// Determines if the specified flags are set in the current value of this /// . /// /// NO VALIDATION IS PERFORMED! /// /// True, if all flags present in are also present in the current value of the /// .
Otherwise false. ///
[MethodImpl (MethodImplOptions.AggressiveInlining)] public static bool FastHasFlags (this KeyBindingScope e, KeyBindingScope checkFlags) { ref uint enumCurrentValueRef = ref Unsafe.As (ref e); ref uint checkFlagsValueRef = ref Unsafe.As (ref checkFlags); return (enumCurrentValueRef & checkFlagsValueRef) == checkFlagsValueRef; } /// /// Determines if the specified mask bits are set in the current value of this /// . /// /// /// The value to check against the /// value. /// /// A mask to apply to the current value. /// /// True, if all bits set to 1 in the mask are also set to 1 in the current value of the /// .
Otherwise false. ///
/// NO VALIDATION IS PERFORMED! [MethodImpl (MethodImplOptions.AggressiveInlining)] public static bool FastHasFlags (this KeyBindingScope e, int mask) { ref int enumCurrentValueRef = ref Unsafe.As (ref e); return (enumCurrentValueRef & mask) == mask; } /// /// Determines if the specified value is explicitly defined as a named value of the /// type. /// /// /// Only explicitly named values return true, as with IsDefined. Combined valid flag values of flags enums which are /// not explicitly named will return false. /// public static bool FastIsDefined (this KeyBindingScope _, int value) { return value switch { 0 => true, 1 => true, 2 => true, 4 => true, _ => false }; } }