diff options
author | Adam Cozzette <acozzette@google.com> | 2018-03-13 16:37:29 -0700 |
---|---|---|
committer | Adam Cozzette <acozzette@google.com> | 2018-03-13 16:37:29 -0700 |
commit | 0400cca3236de1ca303af38bf81eab332d042b7c (patch) | |
tree | a8a9b19853f64567c96750a1c7d253926471daa5 /src/google/protobuf/any.cc | |
parent | 96b535cc2f4f7b7e22a1b8622149f7c26a5a3f63 (diff) | |
download | protobuf-0400cca3236de1ca303af38bf81eab332d042b7c.tar.gz protobuf-0400cca3236de1ca303af38bf81eab332d042b7c.tar.bz2 protobuf-0400cca3236de1ca303af38bf81eab332d042b7c.zip |
Integrated internal changes from Google
Diffstat (limited to 'src/google/protobuf/any.cc')
-rw-r--r-- | src/google/protobuf/any.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/google/protobuf/any.cc b/src/google/protobuf/any.cc index 83edba57..b94529e6 100644 --- a/src/google/protobuf/any.cc +++ b/src/google/protobuf/any.cc @@ -32,6 +32,7 @@ #include <google/protobuf/generated_message_util.h> + namespace google { namespace protobuf { namespace internal { @@ -84,15 +85,23 @@ bool AnyMetadata::InternalIs(const Descriptor* descriptor) const { return full_name == descriptor->full_name(); } -bool ParseAnyTypeUrl(const string& type_url, string* full_type_name) { +bool ParseAnyTypeUrl(const string& type_url, string* url_prefix, + string* full_type_name) { size_t pos = type_url.find_last_of("/"); if (pos == string::npos || pos + 1 == type_url.size()) { return false; } + if (url_prefix) { + *url_prefix = type_url.substr(0, pos + 1); + } *full_type_name = type_url.substr(pos + 1); return true; } +bool ParseAnyTypeUrl(const string& type_url, string* full_type_name) { + return ParseAnyTypeUrl(type_url, NULL, full_type_name); +} + bool GetAnyFieldDescriptors(const Message& message, const FieldDescriptor** type_url_field, |