aboutsummaryrefslogtreecommitdiff
path: root/src/google/protobuf/compiler/java/java_helpers.cc
diff options
context:
space:
mode:
authorJisi Liu <jisi.liu@gmail.com>2017-07-18 15:38:30 -0700
committerJisi Liu <jisi.liu@gmail.com>2017-07-18 15:38:30 -0700
commit09354db1434859a31a3c81abebcc4018d42f2715 (patch)
treeb87c7cdc2255e6c8062ab92b4082665cd698d753 /src/google/protobuf/compiler/java/java_helpers.cc
parent9053033a5076f82cf18b823c31f352e95e5bfd8d (diff)
downloadprotobuf-09354db1434859a31a3c81abebcc4018d42f2715.tar.gz
protobuf-09354db1434859a31a3c81abebcc4018d42f2715.tar.bz2
protobuf-09354db1434859a31a3c81abebcc4018d42f2715.zip
Merge from Google internal for 3.4 release
Diffstat (limited to 'src/google/protobuf/compiler/java/java_helpers.cc')
-rw-r--r--src/google/protobuf/compiler/java/java_helpers.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/google/protobuf/compiler/java/java_helpers.cc b/src/google/protobuf/compiler/java/java_helpers.cc
index 8469740f..d8ac2db3 100644
--- a/src/google/protobuf/compiler/java/java_helpers.cc
+++ b/src/google/protobuf/compiler/java/java_helpers.cc
@@ -43,6 +43,8 @@
#include <google/protobuf/wire_format.h>
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/stubs/substitute.h>
+
+
#include <google/protobuf/stubs/hash.h> // for hash<T *>
namespace google {
@@ -167,6 +169,14 @@ string UniqueFileScopeIdentifier(const Descriptor* descriptor) {
return "static_" + StringReplace(descriptor->full_name(), ".", "_", true);
}
+string CamelCaseFieldName(const FieldDescriptor* field) {
+ string fieldName = UnderscoresToCamelCase(field);
+ if ('0' <= fieldName[0] && fieldName[0] <= '9') {
+ return '_' + fieldName;
+ }
+ return fieldName;
+}
+
string StripProto(const string& filename) {
if (HasSuffixString(filename, ".protodevel")) {
return StripSuffixString(filename, ".protodevel");