• 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: kenton@google.com (Kenton Varda)
9 //  Based on original Protocol Buffers design by
10 //  Sanjay Ghemawat, Jeff Dean, and others.
11 
12 #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_DOC_COMMENT_H__
13 #define GOOGLE_PROTOBUF_COMPILER_JAVA_DOC_COMMENT_H__
14 
15 #include "absl/strings/string_view.h"
16 #include "google/protobuf/compiler/java/options.h"
17 #include "google/protobuf/descriptor.h"
18 
19 // Must be included last.
20 #include "google/protobuf/port_def.inc"
21 
22 namespace google {
23 namespace protobuf {
24 namespace io {
25 class Printer;  // printer.h
26 }
27 }  // namespace protobuf
28 }  // namespace google
29 
30 namespace google {
31 namespace protobuf {
32 namespace compiler {
33 namespace java {
34 
35 enum FieldAccessorType {
36   HAZZER,
37   GETTER,
38   SETTER,
39   CLEARER,
40   // Repeated
41   LIST_COUNT,
42   LIST_GETTER,
43   LIST_INDEXED_GETTER,
44   LIST_INDEXED_SETTER,
45   LIST_ADDER,
46   LIST_MULTI_ADDER
47 };
48 
49 void WriteMessageDocComment(io::Printer* printer, const Descriptor* message,
50                             Options options, bool kdoc = false);
51 void WriteFieldDocComment(io::Printer* printer, const FieldDescriptor* field,
52                           Options options, bool kdoc = false);
53 void WriteFieldAccessorDocComment(io::Printer* printer,
54                                   const FieldDescriptor* field,
55                                   FieldAccessorType type, Options options,
56                                   bool builder = false, bool kdoc = false);
57 void WriteFieldEnumValueAccessorDocComment(
58     io::Printer* printer, const FieldDescriptor* field, FieldAccessorType type,
59     Options options, bool builder = false, bool kdoc = false);
60 void WriteFieldStringBytesAccessorDocComment(
61     io::Printer* printer, const FieldDescriptor* field, FieldAccessorType type,
62     Options options, bool builder = false, bool kdoc = false);
63 void WriteEnumDocComment(io::Printer* printer, const EnumDescriptor* enum_,
64                          Options options, bool kdoc = false);
65 void WriteEnumValueDocComment(io::Printer* printer,
66                               const EnumValueDescriptor* value,
67                               Options options);
68 void WriteServiceDocComment(io::Printer* printer,
69                             const ServiceDescriptor* service, Options options);
70 void WriteMethodDocComment(io::Printer* printer, const MethodDescriptor* method,
71                            Options options);
72 
73 // Exposed for testing only.
74 // Also called by proto1-Java code generator.
75 PROTOC_EXPORT std::string EscapeJavadoc(absl::string_view input);
76 
77 }  // namespace java
78 }  // namespace compiler
79 }  // namespace protobuf
80 }  // namespace google
81 
82 #include "google/protobuf/port_undef.inc"
83 
84 #endif  // GOOGLE_PROTOBUF_COMPILER_JAVA_DOC_COMMENT_H__
85