File indexing completed on 2025-01-31 10:12:20
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef GOOGLE_PROTOBUF_FEATURE_RESOLVER_H__
0009 #define GOOGLE_PROTOBUF_FEATURE_RESOLVER_H__
0010
0011 #include <memory>
0012 #include <string>
0013 #include <utility>
0014 #include <vector>
0015
0016 #include "absl/container/flat_hash_set.h"
0017 #include "absl/status/status.h"
0018 #include "absl/status/statusor.h"
0019 #include "absl/strings/string_view.h"
0020 #include "absl/types/span.h"
0021 #include "google/protobuf/descriptor.h"
0022 #include "google/protobuf/descriptor.pb.h"
0023 #include "google/protobuf/dynamic_message.h"
0024
0025
0026 #include "google/protobuf/port_def.inc"
0027
0028 namespace google {
0029 namespace protobuf {
0030
0031
0032
0033 class PROTOBUF_EXPORT FeatureResolver {
0034 public:
0035 FeatureResolver(FeatureResolver&&) = default;
0036 FeatureResolver& operator=(FeatureResolver&&) = delete;
0037
0038
0039
0040
0041
0042 static absl::StatusOr<FeatureSetDefaults> CompileDefaults(
0043 const Descriptor* feature_set,
0044 absl::Span<const FieldDescriptor* const> extensions,
0045 Edition minimum_edition, Edition maximum_edition);
0046
0047
0048
0049 static absl::StatusOr<FeatureResolver> Create(
0050 Edition edition, const FeatureSetDefaults& defaults);
0051
0052
0053
0054
0055
0056 absl::StatusOr<FeatureSet> MergeFeatures(
0057 const FeatureSet& merged_parent, const FeatureSet& unmerged_child) const;
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068 struct ValidationResults {
0069 std::vector<std::string> errors;
0070 std::vector<std::string> warnings;
0071 };
0072 static ValidationResults ValidateFeatureLifetimes(
0073 Edition edition, const FeatureSet& features,
0074 const Descriptor* pool_descriptor);
0075
0076 private:
0077 explicit FeatureResolver(FeatureSet defaults)
0078 : defaults_(std::move(defaults)) {}
0079
0080 FeatureSet defaults_;
0081 };
0082
0083 }
0084 }
0085
0086 #endif
0087
0088 #include "google/protobuf/port_undef.inc"