Skip to content

Commit

Permalink
GirModel: Add field writable property
Browse files Browse the repository at this point in the history
  • Loading branch information
badcel committed Dec 3, 2023
1 parent bd18029 commit b988522
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Generation/GirLoader/Input/Field.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
1 change: 1 addition & 0 deletions src/Generation/GirLoader/Output/Field.GirModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 6 additions & 3 deletions src/Generation/GirLoader/Output/Field.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

Expand All @@ -18,19 +19,21 @@ public partial class Field
/// <param name="typeInformation"></param>
/// <param name="callback">Optional: If set it is expected that the callback belongs to the given symbol reference.</param>
/// <param name="readable"></param>
/// <param name="writable"></param>
/// <param name="private"></param>
/// <param name="name"></param>
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);
Expand Down
2 changes: 2 additions & 0 deletions src/Generation/GirLoader/Output/FieldFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand All @@ -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
);
Expand Down
1 change: 1 addition & 0 deletions src/Generation/GirModel/Field.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down

0 comments on commit b988522

Please sign in to comment.