Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 10:12:00

0001 // Protocol Buffers - Google's data interchange format
0002 // Copyright 2008 Google Inc.  All rights reserved.
0003 //
0004 // Use of this source code is governed by a BSD-style
0005 // license that can be found in the LICENSE file or at
0006 // https://developers.google.com/open-source/licenses/bsd
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 }  // namespace php
0063 }  // namespace compiler
0064 }  // namespace protobuf
0065 }  // namespace google
0066 
0067 #include "google/protobuf/port_undef.inc"
0068 
0069 #endif  // GOOGLE_PROTOBUF_COMPILER_PHP_GENERATOR_H__