aboutsummaryrefslogtreecommitdiff
path: root/src/google/protobuf/compiler/csharp/csharp_helpers.cc
diff options
context:
space:
mode:
authorJon Skeet <jonskeet@google.com>2016-04-12 09:32:08 +0100
committerJon Skeet <jonskeet@google.com>2016-04-20 03:46:03 +0100
commitd90d615f716c6d2f0ede2b2ce23705d4c502ea45 (patch)
tree4246e99256f2fe5ef1eeeb2fbc1345db99391f95 /src/google/protobuf/compiler/csharp/csharp_helpers.cc
parent790f4c8e3743c28c30e6f052cb3f5535490c87e4 (diff)
downloadprotobuf-d90d615f716c6d2f0ede2b2ce23705d4c502ea45.tar.gz
protobuf-d90d615f716c6d2f0ede2b2ce23705d4c502ea45.tar.bz2
protobuf-d90d615f716c6d2f0ede2b2ce23705d4c502ea45.zip
Attempt to fix AppVeyor build by exporting GetEnumValueName
Diffstat (limited to 'src/google/protobuf/compiler/csharp/csharp_helpers.cc')
-rw-r--r--src/google/protobuf/compiler/csharp/csharp_helpers.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/google/protobuf/compiler/csharp/csharp_helpers.cc b/src/google/protobuf/compiler/csharp/csharp_helpers.cc
index efd01556..6c154c5a 100644
--- a/src/google/protobuf/compiler/csharp/csharp_helpers.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_helpers.cc
@@ -260,6 +260,11 @@ std::string TryRemovePrefix(const std::string& prefix, const std::string& value)
return value.substr(value_index);
}
+// Format the enum value name in a pleasant way for C#:
+// - Strip the enum name as a prefix if possible
+// - Convert to PascalCase.
+// For example, an enum called Color with a value of COLOR_BLUE should
+// result in an enum value in C# called just Blue
std::string GetEnumValueName(const std::string& enum_name, const std::string& enum_value_name) {
std::string stripped = TryRemovePrefix(enum_name, enum_value_name);
std::string result = ShoutyToPascalCase(stripped);