1 // Protocol Buffers - Google's data interchange format 2 // Copyright 2008 Google Inc. All rights reserved. 3 // 4 // Use of this source code is governed by a BSD-style 5 // license that can be found in the LICENSE file or at 6 // https://developers.google.com/open-source/licenses/bsd 7 8 // Defines a TypeResolver for the Any message. 9 10 #ifndef GOOGLE_PROTOBUF_UTIL_TYPE_RESOLVER_H__ 11 #define GOOGLE_PROTOBUF_UTIL_TYPE_RESOLVER_H__ 12 13 #include <string> 14 15 // This inclusion is unused, but we cannot remove it without first fixing IWYU 16 // issues in upstream dependencies. 17 #include "google/protobuf/any.pb.h" // IWYU pragma: keep 18 #include "google/protobuf/type.pb.h" 19 #include "absl/status/status.h" 20 #include "google/protobuf/port.h" 21 22 23 // Must be included last. 24 #include "google/protobuf/port_def.inc" 25 26 namespace google { 27 namespace protobuf { 28 class DescriptorPool; 29 namespace util { 30 31 // Abstract interface for a type resolver. 32 // 33 // Implementations of this interface must be thread-safe. 34 class PROTOBUF_EXPORT TypeResolver { 35 public: TypeResolver()36 TypeResolver() {} 37 TypeResolver(const TypeResolver&) = delete; 38 TypeResolver& operator=(const TypeResolver&) = delete; ~TypeResolver()39 virtual ~TypeResolver() {} 40 41 // Resolves a type url for a message type. 42 virtual absl::Status ResolveMessageType( 43 const std::string& type_url, google::protobuf::Type* message_type) = 0; 44 45 // Resolves a type url for an enum type. 46 virtual absl::Status ResolveEnumType(const std::string& type_url, 47 google::protobuf::Enum* enum_type) = 0; 48 }; 49 50 } // namespace util 51 } // namespace protobuf 52 } // namespace google 53 54 #include "google/protobuf/port_undef.inc" 55 56 #endif // GOOGLE_PROTOBUF_UTIL_TYPE_RESOLVER_H__ 57