Skip to content

Commit

Permalink
Add: Objc Generics
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeyxo committed Jul 21, 2016
1 parent ef72a72 commit 5e36099
Show file tree
Hide file tree
Showing 23 changed files with 758 additions and 487 deletions.
14 changes: 7 additions & 7 deletions src/compiler/objc_message_field.cc
Original file line number Diff line number Diff line change
Expand Up @@ -298,13 +298,13 @@ namespace google { namespace protobuf { namespace compiler { namespace objective

void RepeatedMessageFieldGenerator::GeneratePropertyHeader(io::Printer* printer) const {

printer->Print(variables_, "@property (readonly, strong) NSArray * $name$;\n");
printer->Print(variables_, "@property (readonly, strong) NSArray<$storage_type$> * $name$;\n");
}


void RepeatedMessageFieldGenerator::GenerateExtensionSource(io::Printer* printer) const {

printer->Print(variables_,"@property (strong)$storage_attribute$ NSMutableArray * $list_name$;\n");
printer->Print(variables_,"@property (strong)$storage_attribute$ NSMutableArray<$storage_type$> * $list_name$;\n");
}


Expand All @@ -327,7 +327,7 @@ namespace google { namespace protobuf { namespace compiler { namespace objective
{

printer->Print(variables_,
"- (NSArray *)$name$ {\n"
"- (NSArray<$storage_type$> *)$name$ {\n"
" return $list_name$;\n"
"}\n"
"- ($storage_type$)$name$AtIndex:(NSUInteger)index {\n"
Expand All @@ -342,10 +342,10 @@ namespace google { namespace protobuf { namespace compiler { namespace objective
//check if object array vs primitive array
if(isObjectArray(descriptor_)){
printer->Print(variables_,
"- (NSMutableArray *)$name$;\n"
"- (NSMutableArray<$storage_type$> *)$name$;\n"
"- ($storage_type$)$name$AtIndex:(NSUInteger)index;\n"
"- ($classname$Builder *)add$capitalized_name$:($storage_type$)value;\n"
"- ($classname$Builder *)set$capitalized_name$Array:(NSArray *)array;\n"
"- ($classname$Builder *)set$capitalized_name$Array:(NSArray<$storage_type$> *)array;\n"
"- ($classname$Builder *)clear$capitalized_name$;\n");
}else{
printer->Print(variables_,
Expand All @@ -361,7 +361,7 @@ namespace google { namespace protobuf { namespace compiler { namespace objective

void RepeatedMessageFieldGenerator::GenerateBuilderMembersSource(io::Printer* printer) const {
printer->Print(variables_,
"- (NSMutableArray *)$name$ {\n"
"- (NSMutableArray<$storage_type$> *)$name$ {\n"
" return result$classname_capitalized$.$list_name$;\n"
"}\n"
"- ($storage_type$)$name$AtIndex:(NSUInteger)index {\n"
Expand All @@ -374,7 +374,7 @@ namespace google { namespace protobuf { namespace compiler { namespace objective
" [result$classname_capitalized$.$list_name$ addObject:value];\n"
" return self;\n"
"}\n"
"- ($classname$Builder *)set$capitalized_name$Array:(NSArray *)array {\n"
"- ($classname$Builder *)set$capitalized_name$Array:(NSArray<$storage_type$> *)array {\n"
" result$classname_capitalized$.$list_name$ = [[NSMutableArray alloc]initWithArray:array];\n"
" return self;\n"
"}\n"
Expand Down
132 changes: 66 additions & 66 deletions src/runtime/Classes/Descriptor.pb.h

Large diffs are not rendered by default.

Loading

0 comments on commit 5e36099

Please sign in to comment.