aboutsummaryrefslogtreecommitdiff
path: root/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/google/protobuf/compiler/objectivec/objectivec_oneof.cc')
-rw-r--r--src/google/protobuf/compiler/objectivec/objectivec_oneof.cc22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc b/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc
index 3cb87482..5531ae24 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc
+++ b/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc
@@ -53,7 +53,7 @@ OneofGenerator::OneofGenerator(const OneofDescriptor* descriptor)
string comments;
SourceLocation location;
if (descriptor_->GetSourceLocation(&location)) {
- comments = BuildCommentsString(location);
+ comments = BuildCommentsString(location, true);
} else {
comments = "";
}
@@ -104,6 +104,9 @@ void OneofGenerator::GeneratePublicCasePropertyDeclaration(
void OneofGenerator::GenerateClearFunctionDeclaration(io::Printer* printer) {
printer->Print(
variables_,
+ "/**\n"
+ " * Clears whatever value was set for the oneof '$name$'.\n"
+ " **/\n"
"void $owning_message_class$_Clear$capitalized_name$OneOfCase($owning_message_class$ *message);\n");
}
@@ -118,18 +121,17 @@ void OneofGenerator::GenerateClearFunctionImplementation(io::Printer* printer) {
variables_,
"void $owning_message_class$_Clear$capitalized_name$OneOfCase($owning_message_class$ *message) {\n"
" GPBDescriptor *descriptor = [message descriptor];\n"
- " GPBOneofDescriptor *oneof = descriptor->oneofs_[$raw_index$];\n"
- " GPBMaybeClearOneof(message, oneof, 0);\n"
+ " GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:$raw_index$];\n"
+ " GPBMaybeClearOneof(message, oneof, $index$, 0);\n"
"}\n");
}
-void OneofGenerator::GenerateDescription(io::Printer* printer) {
- printer->Print(
- variables_,
- "{\n"
- " .name = \"$name$\",\n"
- " .index = $index$,\n"
- "},\n");
+string OneofGenerator::DescriptorName(void) const {
+ return variables_.find("name")->second;
+}
+
+string OneofGenerator::HasIndexAsString(void) const {
+ return variables_.find("index")->second;
}
} // namespace objectivec