File indexing completed on 2025-01-31 10:12:00
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef GOOGLE_PROTOBUF_COMPILER_PHP_GENERATOR_H__
0009 #define GOOGLE_PROTOBUF_COMPILER_PHP_GENERATOR_H__
0010
0011 #include <cstdint>
0012 #include <string>
0013
0014 #include "google/protobuf/compiler/code_generator.h"
0015 #include "google/protobuf/compiler/php/names.h"
0016 #include "google/protobuf/descriptor.h"
0017 #include "google/protobuf/port_def.inc"
0018
0019 namespace google {
0020 namespace protobuf {
0021 namespace compiler {
0022 namespace php {
0023
0024 struct Options;
0025
0026 class PROTOC_EXPORT Generator : public CodeGenerator {
0027 public:
0028 virtual bool Generate(
0029 const FileDescriptor* file,
0030 const std::string& parameter,
0031 GeneratorContext* generator_context,
0032 std::string* error) const override;
0033
0034 bool GenerateAll(const std::vector<const FileDescriptor*>& files,
0035 const std::string& parameter,
0036 GeneratorContext* generator_context,
0037 std::string* error) const override;
0038
0039 uint64_t GetSupportedFeatures() const override {
0040 return Feature::FEATURE_PROTO3_OPTIONAL;
0041 }
0042
0043 Edition GetMinimumEdition() const override { return Edition::EDITION_PROTO2; }
0044 Edition GetMaximumEdition() const override { return Edition::EDITION_2023; }
0045 std::vector<const FieldDescriptor*> GetFeatureExtensions() const override {
0046 return {};
0047 }
0048
0049 private:
0050 bool Generate(
0051 const FileDescriptor* file,
0052 const Options& options,
0053 GeneratorContext* generator_context,
0054 std::string* error) const;
0055 };
0056
0057 inline bool IsWrapperType(const FieldDescriptor* descriptor) {
0058 return descriptor->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE &&
0059 descriptor->message_type()->file()->name() == "google/protobuf/wrappers.proto";
0060 }
0061
0062 }
0063 }
0064 }
0065 }
0066
0067 #include "google/protobuf/port_undef.inc"
0068
0069 #endif