-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'hugopl:main' into fix-#48
- Loading branch information
Showing
93 changed files
with
3,680 additions
and
1,458 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
Excluded: | ||
- src/auto | ||
|
||
Lint/NotNil: | ||
Enabled: false | ||
Metrics/CyclomaticComplexity: | ||
Enabled: false | ||
|
||
Performance/AnyInsteadOfEmpty: | ||
Enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
module <%= namespace_name %> | ||
<% render_doc(object) -%> | ||
class <%= type_name %> | ||
@data : <%= to_lib_type(object) %> | ||
|
||
def initialize(@data, transfer : GICrystal::Transfer) | ||
end | ||
|
||
def initialize(pointer : Pointer(Void), transfer : GICrystal::Transfer) | ||
raise ArgumentError.new("Tried to generate struct with a NULL pointer") if pointer.null? | ||
|
||
# Raw structs are always moved to Crystal memory. | ||
@data = pointer.as(Pointer(<%= to_lib_type(object) %>)).value | ||
LibGLib.g_free(pointer) if transfer.full? | ||
end | ||
|
||
<%= struct_new_method %> | ||
|
||
def ==(other : self) : Bool | ||
LibC.memcmp(self, other.to_unsafe, sizeof(<%= to_lib_type(object) %>)).zero? | ||
end | ||
|
||
<% render_getters_and_setters(io) %> | ||
<% render "ecr/g_type_method.ecr" %> | ||
<% render_methods %> | ||
|
||
def to_unsafe | ||
pointerof(@data).as(Void*) | ||
end | ||
end | ||
end |
Oops, something went wrong.