• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc.  All rights reserved.
3 //
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file or at
6 // https://developers.google.com/open-source/licenses/bsd
7 
8 // Author: dweis@google.com (Daniel Weis)
9 //  Based on original Protocol Buffers design by
10 //  Sanjay Ghemawat, Jeff Dean, and others.
11 
12 #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_BUILDER_LITE_H__
13 #define GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_BUILDER_LITE_H__
14 
15 #include <string>
16 
17 #include "absl/container/btree_map.h"
18 #include "google/protobuf/compiler/java/generator_common.h"
19 #include "google/protobuf/compiler/java/lite/field_generator.h"
20 
21 namespace google {
22 namespace protobuf {
23 namespace compiler {
24 namespace java {
25 class Context;            // context.h
26 class ClassNameResolver;  // name_resolver.h
27 }  // namespace java
28 }  // namespace compiler
29 namespace io {
30 class Printer;  // printer.h
31 }
32 }  // namespace protobuf
33 }  // namespace google
34 
35 namespace google {
36 namespace protobuf {
37 namespace compiler {
38 namespace java {
39 
40 class MessageBuilderLiteGenerator {
41  public:
42   explicit MessageBuilderLiteGenerator(const Descriptor* descriptor,
43                                        Context* context);
44   MessageBuilderLiteGenerator(const MessageBuilderLiteGenerator&) = delete;
45   MessageBuilderLiteGenerator& operator=(const MessageBuilderLiteGenerator&) =
46       delete;
47   virtual ~MessageBuilderLiteGenerator();
48 
49   virtual void Generate(io::Printer* printer);
50 
51  private:
52   void GenerateCommonBuilderMethods(io::Printer* printer);
53 
54   const Descriptor* descriptor_;
55   Context* context_;
56   ClassNameResolver* name_resolver_;
57   FieldGeneratorMap<ImmutableFieldLiteGenerator> field_generators_;
58   absl::btree_map<int, const OneofDescriptor*> oneofs_;
59 };
60 
61 }  // namespace java
62 }  // namespace compiler
63 }  // namespace protobuf
64 }  // namespace google
65 
66 #endif  // GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_BUILDER_LITE_H__
67