Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: third_party/protobuf/src/google/protobuf/compiler/java/java_file.h

Issue 2495533002: third_party/protobuf: Update to HEAD (83d681ee2c) (Closed)
Patch Set: Make chrome settings proto generated file a component Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Protocol Buffers - Google's data interchange format 1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved. 2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/ 3 // https://developers.google.com/protocol-buffers/
4 // 4 //
5 // Redistribution and use in source and binary forms, with or without 5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are 6 // modification, are permitted provided that the following conditions are
7 // met: 7 // met:
8 // 8 //
9 // * Redistributions of source code must retain the above copyright 9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer. 10 // notice, this list of conditions and the following disclaimer.
(...skipping 24 matching lines...) Expand all
35 #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_FILE_H__ 35 #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_FILE_H__
36 #define GOOGLE_PROTOBUF_COMPILER_JAVA_FILE_H__ 36 #define GOOGLE_PROTOBUF_COMPILER_JAVA_FILE_H__
37 37
38 #include <memory> 38 #include <memory>
39 #ifndef _SHARED_PTR_H 39 #ifndef _SHARED_PTR_H
40 #include <google/protobuf/stubs/shared_ptr.h> 40 #include <google/protobuf/stubs/shared_ptr.h>
41 #endif 41 #endif
42 #include <string> 42 #include <string>
43 #include <vector> 43 #include <vector>
44 #include <google/protobuf/stubs/common.h> 44 #include <google/protobuf/stubs/common.h>
45 #include <google/protobuf/compiler/java/java_options.h>
45 46
46 namespace google { 47 namespace google {
47 namespace protobuf { 48 namespace protobuf {
48 class FileDescriptor; // descriptor.h 49 class FileDescriptor; // descriptor.h
49 namespace io { 50 namespace io {
50 class Printer; // printer.h 51 class Printer; // printer.h
51 } 52 }
52 namespace compiler { 53 namespace compiler {
53 class GeneratorContext; // code_generator.h 54 class GeneratorContext; // code_generator.h
54 namespace java { 55 namespace java {
55 class Context; // context.h 56 class Context; // context.h
56 class MessageGenerator; // message.h 57 class MessageGenerator; // message.h
57 class GeneratorFactory; // generator_factory.h 58 class GeneratorFactory; // generator_factory.h
58 class ExtensionGenerator; // extension.h 59 class ExtensionGenerator; // extension.h
59 class ClassNameResolver; // name_resolver.h 60 class ClassNameResolver; // name_resolver.h
60 } 61 }
61 } 62 }
62 } 63 }
63 64
64 namespace protobuf { 65 namespace protobuf {
65 namespace compiler { 66 namespace compiler {
66 namespace java { 67 namespace java {
67 68
68 class FileGenerator { 69 class FileGenerator {
69 public: 70 public:
70 FileGenerator(const FileDescriptor* file, bool immutable_api = true, 71 FileGenerator(const FileDescriptor* file, const Options& options,
71 bool enforce_lite = false); 72 bool immutable_api = true);
72 ~FileGenerator(); 73 ~FileGenerator();
73 74
74 // Checks for problems that would otherwise lead to cryptic compile errors. 75 // Checks for problems that would otherwise lead to cryptic compile errors.
75 // Returns true if there are no problems, or writes an error description to 76 // Returns true if there are no problems, or writes an error description to
76 // the given string and returns false otherwise. 77 // the given string and returns false otherwise.
77 bool Validate(string* error); 78 bool Validate(string* error);
78 79
79 void Generate(io::Printer* printer); 80 void Generate(io::Printer* printer);
80 81
81 // If we aren't putting everything into one file, this will write all the 82 // If we aren't putting everything into one file, this will write all the
82 // files other than the outer file (i.e. one for each message, enum, and 83 // files other than the outer file (i.e. one for each message, enum, and
83 // service type). 84 // service type).
84 void GenerateSiblings(const string& package_dir, 85 void GenerateSiblings(const string& package_dir,
85 GeneratorContext* generator_context, 86 GeneratorContext* generator_context,
86 vector<string>* file_list); 87 std::vector<string>* file_list,
88 std::vector<string>* annotation_list);
87 89
88 const string& java_package() { return java_package_; } 90 const string& java_package() { return java_package_; }
89 const string& classname() { return classname_; } 91 const string& classname() { return classname_; }
90 92
91
92 private: 93 private:
93 void GenerateDescriptorInitializationCodeForImmutable(io::Printer* printer); 94 void GenerateDescriptorInitializationCodeForImmutable(io::Printer* printer);
94 void GenerateDescriptorInitializationCodeForMutable(io::Printer* printer); 95 void GenerateDescriptorInitializationCodeForMutable(io::Printer* printer);
95 96
96 bool ShouldIncludeDependency(const FileDescriptor* descriptor, 97 bool ShouldIncludeDependency(const FileDescriptor* descriptor,
97 bool immutable_api_); 98 bool immutable_api_);
98 99
99 const FileDescriptor* file_; 100 const FileDescriptor* file_;
100 string java_package_; 101 string java_package_;
101 string classname_; 102 string classname_;
102 103
103 google::protobuf::scoped_array<google::protobuf::scoped_ptr<MessageGenerator> > message_generators_; 104 google::protobuf::scoped_array<google::protobuf::scoped_ptr<MessageGenerator> > message_generators_;
104 google::protobuf::scoped_array<google::protobuf::scoped_ptr<ExtensionGenerator > > extension_generators_; 105 google::protobuf::scoped_array<google::protobuf::scoped_ptr<ExtensionGenerator > > extension_generators_;
105 google::protobuf::scoped_ptr<GeneratorFactory> generator_factory_; 106 google::protobuf::scoped_ptr<GeneratorFactory> generator_factory_;
106 google::protobuf::scoped_ptr<Context> context_; 107 google::protobuf::scoped_ptr<Context> context_;
107 ClassNameResolver* name_resolver_; 108 ClassNameResolver* name_resolver_;
109 const Options options_;
108 bool immutable_api_; 110 bool immutable_api_;
109 111
110
111 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FileGenerator); 112 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FileGenerator);
112 }; 113 };
113 114
114 } // namespace java 115 } // namespace java
115 } // namespace compiler 116 } // namespace compiler
116 } // namespace protobuf 117 } // namespace protobuf
117 118
118 } // namespace google 119 } // namespace google
119 #endif // GOOGLE_PROTOBUF_COMPILER_JAVA_FILE_H__ 120 #endif // GOOGLE_PROTOBUF_COMPILER_JAVA_FILE_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698