File indexing completed on 2025-01-31 10:11:58
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_GENERATOR_H__
0015 #define GOOGLE_PROTOBUF_COMPILER_JAVA_GENERATOR_H__
0016
0017 #include <cstdint>
0018 #include <string>
0019 #include <vector>
0020
0021 #include "google/protobuf/compiler/java/java_features.pb.h"
0022 #include "google/protobuf/compiler/code_generator.h"
0023 #include "google/protobuf/descriptor.pb.h"
0024 #include "google/protobuf/port.h"
0025
0026
0027 #include "google/protobuf/port_def.inc"
0028
0029 namespace google {
0030 namespace protobuf {
0031 namespace compiler {
0032 namespace java {
0033
0034
0035
0036
0037
0038 class PROTOC_EXPORT JavaGenerator : public CodeGenerator {
0039 public:
0040 JavaGenerator();
0041 JavaGenerator(const JavaGenerator&) = delete;
0042 JavaGenerator& operator=(const JavaGenerator&) = delete;
0043 ~JavaGenerator() override;
0044
0045
0046 bool Generate(const FileDescriptor* file, const std::string& parameter,
0047 GeneratorContext* context, std::string* error) const override;
0048
0049 uint64_t GetSupportedFeatures() const override;
0050
0051 Edition GetMinimumEdition() const override { return Edition::EDITION_PROTO2; }
0052 Edition GetMaximumEdition() const override { return Edition::EDITION_2023; }
0053
0054 std::vector<const FieldDescriptor*> GetFeatureExtensions() const override {
0055 return {GetExtensionReflection(pb::java)};
0056 }
0057
0058 void set_opensource_runtime(bool opensource) {
0059 opensource_runtime_ = opensource;
0060 }
0061
0062 using CodeGenerator::GetEdition;
0063 using CodeGenerator::GetResolvedSourceFeatures;
0064
0065 private:
0066 bool opensource_runtime_ = google::protobuf::internal::IsOss();
0067 };
0068
0069 }
0070 }
0071 }
0072 }
0073
0074 #include "google/protobuf/port_undef.inc"
0075
0076 #endif