Back to home page

EIC code displayed by LXR

 
 

    


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

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 // Author: dweis@google.com (Daniel Weis)
0009 //  Based on original Protocol Buffers design by
0010 //  Sanjay Ghemawat, Jeff Dean, and others.
0011 
0012 #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_LITE_H__
0013 #define GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_LITE_H__
0014 
0015 #include <memory>
0016 #include <vector>
0017 
0018 #include "google/protobuf/compiler/java/context.h"
0019 #include "google/protobuf/compiler/java/generator_common.h"
0020 #include "google/protobuf/compiler/java/generator_factory.h"
0021 #include "google/protobuf/compiler/java/lite/field_generator.h"
0022 #include "google/protobuf/compiler/java/name_resolver.h"
0023 #include "google/protobuf/descriptor.h"
0024 #include "google/protobuf/io/printer.h"
0025 
0026 namespace google {
0027 namespace protobuf {
0028 namespace compiler {
0029 namespace java {
0030 
0031 class ImmutableMessageLiteGenerator : public MessageGenerator {
0032  public:
0033   ImmutableMessageLiteGenerator(const Descriptor* descriptor, Context* context);
0034   ImmutableMessageLiteGenerator(const ImmutableMessageLiteGenerator&) = delete;
0035   ImmutableMessageLiteGenerator& operator=(
0036       const ImmutableMessageLiteGenerator&) = delete;
0037   ~ImmutableMessageLiteGenerator() override;
0038 
0039   void Generate(io::Printer* printer) override;
0040   void GenerateInterface(io::Printer* printer) override;
0041   void GenerateExtensionRegistrationCode(io::Printer* printer) override;
0042   void GenerateStaticVariables(io::Printer* printer,
0043                                int* bytecode_estimate) override;
0044   int GenerateStaticVariableInitializers(io::Printer* printer) override;
0045   void GenerateKotlinDsl(io::Printer* printer) const override;
0046   void GenerateKotlinMembers(io::Printer* printer) const override;
0047   void GenerateTopLevelKotlinMembers(io::Printer* printer) const override;
0048 
0049  private:
0050   void GenerateParseFromMethods(io::Printer* printer);
0051 
0052   void GenerateBuilder(io::Printer* printer);
0053   void GenerateDynamicMethodNewBuilder(io::Printer* printer);
0054   void GenerateInitializers(io::Printer* printer);
0055   void GenerateParser(io::Printer* printer);
0056   void GenerateConstructor(io::Printer* printer);
0057   void GenerateDynamicMethodNewBuildMessageInfo(io::Printer* printer);
0058   void GenerateKotlinExtensions(io::Printer* printer) const;
0059   void GenerateKotlinOrNull(io::Printer* printer) const;
0060 
0061   Context* context_;
0062   ClassNameResolver* name_resolver_;
0063   FieldGeneratorMap<ImmutableFieldLiteGenerator> field_generators_;
0064 };
0065 
0066 }  // namespace java
0067 }  // namespace compiler
0068 }  // namespace protobuf
0069 }  // namespace google
0070 
0071 #endif  // GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_LITE_H__