-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement init methods for Darwin structs (#11986)
- Loading branch information
1 parent
0faaac2
commit e76a525
Showing
10 changed files
with
5,029 additions
and
8 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
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
19 changes: 19 additions & 0 deletions
19
src/darwin/Framework/CHIP/templates/partials/init_struct_member.zapt
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,19 @@ | ||
{{#*inline "memberName"}}_{{asStructPropertyName label}}{{/inline}} | ||
{{#if isOptional}} | ||
{{>memberName}} = nil; | ||
{{else if isNullable}} | ||
{{>memberName}} = nil; | ||
{{else if isArray}} | ||
{{>memberName}} = [NSArray array]; | ||
{{else if (isOctetString type)}} | ||
{{>memberName}} = [NSData data]; | ||
{{else if (isCharString type)}} | ||
{{>memberName}} = @""; | ||
{{else}} | ||
{{! Our memberName inline partial won't work inside the async if_is_struct }} | ||
{{#if_is_struct type}} | ||
_{{asStructPropertyName label}} = [{{asObjectiveCClass type cluster}} new]; | ||
{{else}} | ||
_{{asStructPropertyName label}} = @(0); | ||
{{/if_is_struct}} | ||
{{/if}} |
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
Oops, something went wrong.