mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-20 22:37:31 +00:00
Fix verification for C# unions (#7970)
* Fix verification for unions * Run scripts\generate_code.py --------- Co-authored-by: Michael Le <michael.le647@gmail.com>
This commit is contained in:
@@ -37,25 +37,6 @@ public class ValueUnion {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static public class ValueVerify
|
||||
{
|
||||
static public bool Verify(Google.FlatBuffers.Verifier verifier, byte typeId, uint tablePos)
|
||||
{
|
||||
bool result = true;
|
||||
switch((Value)typeId)
|
||||
{
|
||||
case Value.IntValue:
|
||||
result = union_value_collsion.IntValueVerify.Verify(verifier, tablePos);
|
||||
break;
|
||||
default: result = true;
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public class ValueUnion_JsonConverter : Newtonsoft.Json.JsonConverter {
|
||||
public override bool CanConvert(System.Type objectType) {
|
||||
return objectType == typeof(ValueUnion) || objectType == typeof(System.Collections.Generic.List<ValueUnion>);
|
||||
@@ -97,6 +78,25 @@ public class ValueUnion_JsonConverter : Newtonsoft.Json.JsonConverter {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static public class ValueVerify
|
||||
{
|
||||
static public bool Verify(Google.FlatBuffers.Verifier verifier, byte typeId, uint tablePos)
|
||||
{
|
||||
bool result = true;
|
||||
switch((Value)typeId)
|
||||
{
|
||||
case Value.IntValue:
|
||||
result = union_value_collsion.IntValueVerify.Verify(verifier, tablePos);
|
||||
break;
|
||||
default: result = true;
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
|
||||
public enum Other : byte
|
||||
{
|
||||
@@ -125,25 +125,6 @@ public class OtherUnion {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static public class OtherVerify
|
||||
{
|
||||
static public bool Verify(Google.FlatBuffers.Verifier verifier, byte typeId, uint tablePos)
|
||||
{
|
||||
bool result = true;
|
||||
switch((Other)typeId)
|
||||
{
|
||||
case Other.IntValue:
|
||||
result = union_value_collsion.IntValueVerify.Verify(verifier, tablePos);
|
||||
break;
|
||||
default: result = true;
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public class OtherUnion_JsonConverter : Newtonsoft.Json.JsonConverter {
|
||||
public override bool CanConvert(System.Type objectType) {
|
||||
return objectType == typeof(OtherUnion) || objectType == typeof(System.Collections.Generic.List<OtherUnion>);
|
||||
@@ -185,6 +166,25 @@ public class OtherUnion_JsonConverter : Newtonsoft.Json.JsonConverter {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static public class OtherVerify
|
||||
{
|
||||
static public bool Verify(Google.FlatBuffers.Verifier verifier, byte typeId, uint tablePos)
|
||||
{
|
||||
bool result = true;
|
||||
switch((Other)typeId)
|
||||
{
|
||||
case Other.IntValue:
|
||||
result = union_value_collsion.IntValueVerify.Verify(verifier, tablePos);
|
||||
break;
|
||||
default: result = true;
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public struct IntValue : IFlatbufferObject
|
||||
{
|
||||
private Table __p;
|
||||
|
||||
Reference in New Issue
Block a user