Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 10:11:59

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 // Generates Kotlin code for a given .proto file.
0009 
0010 #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_KOTLIN_GENERATOR_H__
0011 #define GOOGLE_PROTOBUF_COMPILER_JAVA_KOTLIN_GENERATOR_H__
0012 
0013 #include <string>
0014 
0015 #include "google/protobuf/compiler/java/java_features.pb.h"
0016 #include "google/protobuf/compiler/code_generator.h"
0017 #include "google/protobuf/descriptor.pb.h"
0018 
0019 // Must be included last.
0020 #include "google/protobuf/port_def.inc"
0021 
0022 namespace google {
0023 namespace protobuf {
0024 namespace compiler {
0025 namespace java {
0026 
0027 // CodeGenerator implementation which generates Kotlin code.  If you create your
0028 // own protocol compiler binary and you want it to support Kotlin output, you
0029 // can do so by registering an instance of this CodeGenerator with the
0030 // CommandLineInterface in your main() function.
0031 class PROTOC_EXPORT KotlinGenerator : public CodeGenerator {
0032  public:
0033   KotlinGenerator();
0034   KotlinGenerator(const KotlinGenerator&) = delete;
0035   KotlinGenerator& operator=(const KotlinGenerator&) = delete;
0036   ~KotlinGenerator() override;
0037 
0038   // implements CodeGenerator ----------------------------------------
0039   bool Generate(const FileDescriptor* file, const std::string& parameter,
0040                 GeneratorContext* context, std::string* error) const override;
0041 
0042   uint64_t GetSupportedFeatures() const override;
0043 
0044   Edition GetMinimumEdition() const override { return Edition::EDITION_PROTO2; }
0045   Edition GetMaximumEdition() const override { return Edition::EDITION_2023; }
0046 
0047   std::vector<const FieldDescriptor*> GetFeatureExtensions() const override {
0048     return {GetExtensionReflection(pb::java)};
0049   }
0050 
0051   using CodeGenerator::GetResolvedSourceFeatures;
0052 };
0053 
0054 }  // namespace java
0055 }  // namespace compiler
0056 }  // namespace protobuf
0057 }  // namespace google
0058 
0059 #include "google/protobuf/port_undef.inc"
0060 
0061 #endif  // GOOGLE_PROTOBUF_COMPILER_JAVA_KOTLIN_GENERATOR_H__