Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-03-01 10:26:07

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: xiaofeng@google.com (Feng Xiao)
0009 //
0010 // Generators that generate shared code between immutable API and mutable API.
0011 
0012 #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_SHARED_CODE_GENERATOR_H__
0013 #define GOOGLE_PROTOBUF_COMPILER_JAVA_SHARED_CODE_GENERATOR_H__
0014 
0015 #include <memory>
0016 #include <string>
0017 #include <vector>
0018 
0019 #include "google/protobuf/compiler/java/options.h"
0020 #include "google/protobuf/port.h"
0021 
0022 namespace google {
0023 namespace protobuf {
0024 class FileDescriptor;  // descriptor.h
0025 namespace compiler {
0026 class GeneratorContext;  // code_generator.h
0027 namespace java {
0028 class ClassNameResolver;  // name_resolver.h
0029 }
0030 }  // namespace compiler
0031 namespace io {
0032 class Printer;  // printer.h
0033 }
0034 }  // namespace protobuf
0035 }  // namespace google
0036 
0037 namespace google {
0038 namespace protobuf {
0039 namespace compiler {
0040 namespace java {
0041 
0042 // A generator that generates code that are shared between immutable API
0043 // and mutable API. Currently only descriptors are shared.
0044 class SharedCodeGenerator {
0045  public:
0046   SharedCodeGenerator(const FileDescriptor* file, const Options& options);
0047   SharedCodeGenerator(const SharedCodeGenerator&) = delete;
0048   SharedCodeGenerator& operator=(const SharedCodeGenerator&) = delete;
0049   ~SharedCodeGenerator();
0050 
0051   void Generate(GeneratorContext* generator_context,
0052                 std::vector<std::string>* file_list,
0053                 std::vector<std::string>* annotation_file_list);
0054 
0055   void GenerateDescriptors(io::Printer* printer);
0056 
0057  private:
0058   std::unique_ptr<ClassNameResolver> name_resolver_;
0059   const FileDescriptor* file_;
0060   const Options options_;
0061 };
0062 
0063 }  // namespace java
0064 }  // namespace compiler
0065 }  // namespace protobuf
0066 }  // namespace google
0067 
0068 #endif  // GOOGLE_PROTOBUF_COMPILER_JAVA_SHARED_CODE_GENERATOR_H__