From b988522f00e72f5a073054dbff421bb900e38817 Mon Sep 17 00:00:00 2001 From: badcel <1218031+badcel@users.noreply.github.com> Date: Sun, 3 Dec 2023 14:35:38 +0100 Subject: [PATCH] GirModel: Add field writable property --- src/Generation/GirLoader/Input/Field.cs | 4 ++-- src/Generation/GirLoader/Output/Field.GirModel.cs | 1 + src/Generation/GirLoader/Output/Field.cs | 9 ++++++--- src/Generation/GirLoader/Output/FieldFactory.cs | 2 ++ src/Generation/GirModel/Field.cs | 1 + 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/Generation/GirLoader/Input/Field.cs b/src/Generation/GirLoader/Input/Field.cs index c73896a56..ea2f707e3 100644 --- a/src/Generation/GirLoader/Input/Field.cs +++ b/src/Generation/GirLoader/Input/Field.cs @@ -10,8 +10,8 @@ public class Field : AnyType [XmlAttribute("readable")] public bool Readable { get; set; } - [XmlAttribute("writeable")] - public bool Writeable { get; set; } + [XmlAttribute("writable")] + public bool Writable { get; set; } [XmlAttribute("private")] public bool Private { get; set; } diff --git a/src/Generation/GirLoader/Output/Field.GirModel.cs b/src/Generation/GirLoader/Output/Field.GirModel.cs index c80d71041..82de7681a 100644 --- a/src/Generation/GirLoader/Output/Field.GirModel.cs +++ b/src/Generation/GirLoader/Output/Field.GirModel.cs @@ -6,6 +6,7 @@ public partial class Field : GirModel.Field { string GirModel.Field.Name => Name; bool GirModel.Field.IsReadable => Readable; + bool GirModel.Field.IsWritable => Writable; bool GirModel.Field.IsPrivate => Private; bool GirModel.Field.IsPointer => TypeReference.CTypeReference?.IsPointer ?? false; bool GirModel.Field.Introspectable => Introspectable; diff --git a/src/Generation/GirLoader/Output/Field.cs b/src/Generation/GirLoader/Output/Field.cs index 55bb43d7f..ab92bd1b0 100644 --- a/src/Generation/GirLoader/Output/Field.cs +++ b/src/Generation/GirLoader/Output/Field.cs @@ -7,6 +7,7 @@ public partial class Field public Callback? Callback { get; } public bool Readable { get; } + public bool Writable { get; } public bool Private { get; } public bool Introspectable { get; } @@ -18,19 +19,21 @@ public partial class Field /// /// Optional: If set it is expected that the callback belongs to the given symbol reference. /// + /// /// /// - public Field(string name, TypeReference typeReference, bool introspectable, bool readable = true, bool @private = false) + public Field(string name, TypeReference typeReference, bool introspectable, bool readable = true, bool writable = false, bool @private = false) { Name = name; TypeReference = typeReference; Readable = readable; + Writable = writable; Private = @private; Introspectable = introspectable; } - public Field(string name, ResolveableTypeReference resolveableTypeReference, Callback callback, bool introspectable, bool readable = true, bool @private = false) - : this(name, resolveableTypeReference, introspectable, readable, @private) + public Field(string name, ResolveableTypeReference resolveableTypeReference, Callback callback, bool introspectable, bool readable = true, bool writable = false, bool @private = false) + : this(name, resolveableTypeReference, introspectable, readable, writable, @private) { Callback = callback; resolveableTypeReference.ResolveAs(Callback); diff --git a/src/Generation/GirLoader/Output/FieldFactory.cs b/src/Generation/GirLoader/Output/FieldFactory.cs index f8fcb3b7a..ce150167c 100644 --- a/src/Generation/GirLoader/Output/FieldFactory.cs +++ b/src/Generation/GirLoader/Output/FieldFactory.cs @@ -30,6 +30,7 @@ public Field Create(Input.Field info, Repository repository) resolveableTypeReference: _typeReferenceFactory.CreateResolveable(info.Callback.Name, info.Callback.Type), callback: _callbackFactory.Create(info.Callback, repository), readable: info.Readable, + writable: info.Writable, @private: info.Private, introspectable: info.Introspectable ); @@ -39,6 +40,7 @@ public Field Create(Input.Field info, Repository repository) name: info.Name, typeReference: _typeReferenceFactory.Create(info), readable: info.Readable, + writable: info.Writable, @private: info.Private, introspectable: info.Introspectable ); diff --git a/src/Generation/GirModel/Field.cs b/src/Generation/GirModel/Field.cs index 2c7942599..aeac9265d 100644 --- a/src/Generation/GirModel/Field.cs +++ b/src/Generation/GirModel/Field.cs @@ -6,6 +6,7 @@ public interface Field { string Name { get; } bool IsReadable { get; } + bool IsWritable { get; } bool IsPrivate { get; } bool IsPointer { get; } bool Introspectable { get; }