Remove Bool8 entirely, as it is no longer used.

internals
Eric Mellino 6 years ago
parent 5c9bab0c95
commit 19017294c2
  1. 10
      src/CodeGenerator/Program.cs
  2. 21
      src/ImGui.NET/Bool8.cs

@ -14,7 +14,6 @@ namespace CodeGenerator
{ {
private static readonly Dictionary<string, string> s_wellKnownTypes = new Dictionary<string, string>() private static readonly Dictionary<string, string> s_wellKnownTypes = new Dictionary<string, string>()
{ {
// { "bool", "Bool8" },
{ "bool", "byte" }, { "bool", "byte" },
{ "unsigned char", "byte" }, { "unsigned char", "byte" },
{ "char", "byte" }, { "char", "byte" },
@ -305,15 +304,6 @@ namespace CodeGenerator
if (field.ArraySize != 0) if (field.ArraySize != 0)
{ {
string addrTarget = s_legalFixedTypes.Contains(rawType) ? $"NativePtr->{field.Name}" : $"&NativePtr->{field.Name}_0"; string addrTarget = s_legalFixedTypes.Contains(rawType) ? $"NativePtr->{field.Name}" : $"&NativePtr->{field.Name}_0";
if (field.Type == "bool")
{
// There appear to be codegen bugs on Unix when RangeAccessor<Bool8> is used which result
// in values beyond the accessed range becoming corrupted.
// Besides, bool is a better type to use in the first place.
typeStr = "bool";
}
writer.WriteLine($"public RangeAccessor<{typeStr}> {field.Name} => new RangeAccessor<{typeStr}>({addrTarget}, {field.ArraySize});"); writer.WriteLine($"public RangeAccessor<{typeStr}> {field.Name} => new RangeAccessor<{typeStr}>({addrTarget}, {field.ArraySize});");
} }
else if (typeStr.Contains("ImVector")) else if (typeStr.Contains("ImVector"))

@ -1,21 +0,0 @@
namespace ImGuiNET
{
public struct Bool8
{
public readonly byte Value;
public static implicit operator bool(Bool8 b8) => b8.Value != 0;
public static implicit operator Bool8(bool b) => new Bool8(b);
public Bool8(bool value)
{
Value = value ? (byte)1 : (byte)0;
}
public Bool8(byte value)
{
Value = value;
}
public override string ToString() => string.Format("{0} [{1}]", (bool)this, Value);
}
}
Loading…
Cancel
Save