Add `proto2::compiler::java::CapitalizedOneofName`.

PiperOrigin-RevId: 625326468
pull/16512/head
Éamonn McManus 7 months ago committed by Copybara-Service
parent bb3e50e15e
commit 622f291606
  1. 4
      src/google/protobuf/compiler/java/names.cc
  2. 13
      src/google/protobuf/compiler/java/names.h

@ -144,6 +144,10 @@ std::string CapitalizedFieldName(const FieldDescriptor* field) {
return UnderscoresToCamelCase(FieldName(field), true);
}
std::string CapitalizedOneofName(const OneofDescriptor* oneof) {
return UnderscoresToCamelCase(oneof->name(), true);
}
std::string UnderscoresToCamelCase(const FieldDescriptor* field) {
return UnderscoresToCamelCase(FieldName(field), false);
}

@ -17,8 +17,9 @@
#include <string>
#include "google/protobuf/descriptor.h"
#include "absl/strings/string_view.h"
#include "google/protobuf/compiler/java/options.h"
#include "google/protobuf/descriptor.h"
// Must be last.
#include "google/protobuf/port_def.inc"
@ -74,8 +75,14 @@ std::string FileJavaPackage(const FileDescriptor* descriptor,
// Requires:
// descriptor != NULL
// Returns:
// Capitalized camel case name field name.
std::string CapitalizedFieldName(const FieldDescriptor* descriptor);
// Capitalized camel case field name.
std::string CapitalizedFieldName(const FieldDescriptor* field);
// Requires:
// descriptor != NULL
// Returns:
// Capitalized camel case oneof name.
std::string CapitalizedOneofName(const OneofDescriptor* oneof);
// Returns:
// Converts a name to camel-case. If cap_first_letter is true, capitalize the

Loading…
Cancel
Save