2525#include < string>
2626#include < unordered_map>
2727
28- namespace pb = ::google::protobuf;
2928namespace pbutil = ::google::protobuf::util;
3029namespace pbconv = ::google::protobuf::util::converter;
3130namespace pberr = ::google::protobuf::util::error;
@@ -41,21 +40,22 @@ class SimpleTypeResolver : public pbutil::TypeResolver {
4140 public:
4241 SimpleTypeResolver () : url_prefix_(DEFAULT_URL_PREFIX) {}
4342
44- void AddType (const pb ::Type& t) {
43+ void AddType (const google::protobuf ::Type& t) {
4544 type_map_.emplace (url_prefix_ + t.name (), &t);
4645 // A temporary workaround for service configs that use
4746 // "proto2.MessageOptions.*" options.
48- ReplaceProto2WithGoogleProtobufInOptionNames (const_cast <pb::Type*>(&t));
47+ ReplaceProto2WithGoogleProtobufInOptionNames (
48+ const_cast <google::protobuf::Type*>(&t));
4949 }
5050
51- void AddEnum (const pb ::Enum& e) {
51+ void AddEnum (const google::protobuf ::Enum& e) {
5252 enum_map_.emplace (url_prefix_ + e.name (), &e);
5353 }
5454
5555 // TypeResolver implementation
5656 // Resolves a type url for a message type.
57- virtual pbutil::Status ResolveMessageType (const std::string& type_url,
58- pb ::Type* type) override {
57+ virtual pbutil::Status ResolveMessageType (
58+ const std::string& type_url, google::protobuf ::Type* type) override {
5959 auto i = type_map_.find (type_url);
6060 if (end (type_map_) != i) {
6161 if (nullptr != type) {
@@ -69,8 +69,8 @@ class SimpleTypeResolver : public pbutil::TypeResolver {
6969 }
7070
7171 // Resolves a type url for an enum type.
72- virtual pbutil::Status ResolveEnumType (const std::string& type_url,
73- pb ::Enum* enum_type) override {
72+ virtual pbutil::Status ResolveEnumType (
73+ const std::string& type_url, google::protobuf ::Enum* enum_type) override {
7474 auto i = enum_map_.find (type_url);
7575 if (end (enum_map_) != i) {
7676 if (nullptr != enum_type) {
@@ -84,7 +84,8 @@ class SimpleTypeResolver : public pbutil::TypeResolver {
8484 }
8585
8686 private:
87- void ReplaceProto2WithGoogleProtobufInOptionNames (pb::Type* type) {
87+ void ReplaceProto2WithGoogleProtobufInOptionNames (
88+ google::protobuf::Type* type) {
8889 // As a temporary workaround for service configs that use
8990 // "proto2.MessageOptions.*" options instead of
9091 // "google.protobuf.MessageOptions.*", we replace the option names to make
@@ -101,8 +102,8 @@ class SimpleTypeResolver : public pbutil::TypeResolver {
101102 }
102103
103104 std::string url_prefix_;
104- std::unordered_map<std::string, const pb ::Type*> type_map_;
105- std::unordered_map<std::string, const pb ::Enum*> enum_map_;
105+ std::unordered_map<std::string, const google::protobuf ::Type*> type_map_;
106+ std::unordered_map<std::string, const google::protobuf ::Enum*> enum_map_;
106107
107108 SimpleTypeResolver (const SimpleTypeResolver&) = delete ;
108109 SimpleTypeResolver& operator =(const SimpleTypeResolver&) = delete ;
@@ -126,32 +127,33 @@ void TypeHelper::Initialize() {
126127 type_info_.reset (pbconv::TypeInfo::NewTypeInfo (type_resolver_));
127128}
128129
129- void TypeHelper::AddType (const pb ::Type& t) {
130+ void TypeHelper::AddType (const google::protobuf ::Type& t) {
130131 reinterpret_cast <SimpleTypeResolver*>(type_resolver_)->AddType (t);
131132}
132133
133- void TypeHelper::AddEnum (const pb ::Enum& e) {
134+ void TypeHelper::AddEnum (const google::protobuf ::Enum& e) {
134135 reinterpret_cast <SimpleTypeResolver*>(type_resolver_)->AddEnum (e);
135136}
136137
137138pbutil::Status TypeHelper::ResolveFieldPath (
138- const pb ::Type& type, const std::string& field_path_str,
139- std::vector<const pb ::Field*>* field_path_out) const {
139+ const google::protobuf ::Type& type, const std::string& field_path_str,
140+ std::vector<const google::protobuf ::Field*>* field_path_out) const {
140141 // Split the field names & call ResolveFieldPath()
141142 const std::vector<std::string> field_names =
142143 absl::StrSplit (field_path_str, ' .' , absl::SkipEmpty ());
143144 return ResolveFieldPath (type, field_names, field_path_out);
144145}
145146
146147pbutil::Status TypeHelper::ResolveFieldPath (
147- const pb::Type& type, const std::vector<std::string>& field_names,
148- std::vector<const pb::Field*>* field_path_out) const {
148+ const google::protobuf::Type& type,
149+ const std::vector<std::string>& field_names,
150+ std::vector<const google::protobuf::Field*>* field_path_out) const {
149151 // The type of the current message being processed (initially the type of the
150152 // top level message)
151153 auto current_type = &type;
152154
153155 // The resulting field path
154- std::vector<const pb ::Field*> field_path;
156+ std::vector<const google::protobuf ::Field*> field_path;
155157
156158 for (size_t i = 0 ; i < field_names.size (); ++i) {
157159 // Find the field by name in the current type
@@ -166,7 +168,7 @@ pbutil::Status TypeHelper::ResolveFieldPath(
166168
167169 if (i < field_names.size () - 1 ) {
168170 // If this is not the last field in the path, it must be a message
169- if (pb ::Field::TYPE_MESSAGE != field->kind ()) {
171+ if (google::protobuf ::Field::TYPE_MESSAGE != field->kind ()) {
170172 return pbutil::Status (
171173 pberr::INVALID_ARGUMENT,
172174 " Encountered a non-leaf field \" " + field->name () +
0 commit comments