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 #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_EXTENSION_LITE_H__
0009 #define GOOGLE_PROTOBUF_COMPILER_JAVA_EXTENSION_LITE_H__
0010 
0011 #include <string>
0012 
0013 #include "google/protobuf/compiler/java/generator_factory.h"
0014 #include "google/protobuf/descriptor.h"
0015 #include "google/protobuf/port.h"
0016 
0017 namespace google {
0018 namespace protobuf {
0019 namespace compiler {
0020 namespace java {
0021 
0022 // Generates code for a lite extension, which may be within the scope of some
0023 // message or may be at file scope.  This is much simpler than FieldGenerator
0024 // since extensions are just simple identifiers with interesting types.
0025 class ImmutableExtensionLiteGenerator : public ExtensionGenerator {
0026  public:
0027   explicit ImmutableExtensionLiteGenerator(const FieldDescriptor* descriptor,
0028                                            Context* context);
0029   ImmutableExtensionLiteGenerator(const ImmutableExtensionLiteGenerator&) =
0030       delete;
0031   ImmutableExtensionLiteGenerator& operator=(
0032       const ImmutableExtensionLiteGenerator&) = delete;
0033   ~ImmutableExtensionLiteGenerator() override;
0034 
0035   void Generate(io::Printer* printer) override;
0036 
0037   // Returns an estimate of the number of bytes the printed code will compile to
0038   int GenerateNonNestedInitializationCode(io::Printer* printer) override;
0039 
0040   // Returns an estimate of the number of bytes the printed code will compile to
0041   int GenerateRegistrationCode(io::Printer* printer) override;
0042 
0043  private:
0044   const FieldDescriptor* descriptor_;
0045   ClassNameResolver* name_resolver_;
0046   std::string scope_;
0047   Context* context_;
0048 };
0049 
0050 }  // namespace java
0051 }  // namespace compiler
0052 }  // namespace protobuf
0053 }  // namespace google
0054 
0055 #endif  // GOOGLE_PROTOBUF_COMPILER_JAVA_EXTENSION_LITE_H__