public static bool TryCreate(Schema.Schema schema, FlatBufferObject @struct, [NotNullWhen(true)] out ValueStructSchemaModel?model) { model = null; if ([email protected]) { return(false); } if (@struct.Attributes?.ContainsKey(MetadataKeys.ValueStruct) != true) { return(false); } model = new ValueStructSchemaModel(schema, @struct); return(true); }
public ValueStructFieldModel( int offset, string name, string visibility, string type, string accessor, IEnumerable <string>?documentation, ValueStructSchemaModel parent, IFlatSharpAttributes attributes) { this.Offset = offset; this.Name = name; this.Visibility = visibility; this.TypeName = type; this.Accessor = accessor; this.Documentation = documentation; new FlatSharpAttributeValidator(FlatBufferSchemaElementType.ValueStructField, $"{parent.Name}.{name}").Validate(attributes); }
public RootModel ToRootModel() { RootModel model = new RootModel(this.AdvancedFeatures); foreach (var @enum in this.Enums) { if (EnumSchemaModel.TryCreate(this, @enum, out var enumModel)) { model.AddElement(enumModel); } else if (UnionSchemaModel.TryCreate(this, @enum, out var unionModel)) { model.AddElement(unionModel); } } foreach (var obj in this.Objects) { if (TableSchemaModel.TryCreate(this, obj, out var tableModel)) { model.AddElement(tableModel); } else if (ReferenceStructSchemaModel.TryCreate(this, obj, out var refStructModel)) { model.AddElement(refStructModel); } else if (ValueStructSchemaModel.TryCreate(this, obj, out var valueStructModel)) { model.AddElement(valueStructModel); } } if (this.Services is not null) { foreach (var service in this.Services) { model.AddElement(new RpcServiceSchemaModel(this, service)); } } return(model); }
public ValueStructVectorModel( string type, string name, List <string> properties, ValueStructSchemaModel parent, IEnumerable <string>?documentation, IFlatSharpAttributes attributes) { this.Name = name; this.TypeName = type; this.Name = name; this.Properties = properties; this.Attributes = attributes; this.Documentation = documentation; new FlatSharpAttributeValidator(FlatBufferSchemaElementType.ValueStructField, $"{parent.Name}.{name}") { UnsafeStructVectorValidator = _ => AttributeValidationResult.Valid, }.Validate(attributes); }