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

Side by Side Diff: third_party/protobuf/src/google/protobuf/compiler/javanano/javanano_file.h

Issue 1291903002: Pull new version of protobuf sources. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months 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 // http://code.google.com/p/protobuf/ 3 // http://code.google.com/p/protobuf/
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 14 matching lines...) Expand all
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 30
31 // Author: kenton@google.com (Kenton Varda) 31 // Author: kenton@google.com (Kenton Varda)
32 // Based on original Protocol Buffers design by 32 // Based on original Protocol Buffers design by
33 // Sanjay Ghemawat, Jeff Dean, and others. 33 // Sanjay Ghemawat, Jeff Dean, and others.
34 34
35 #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_FILE_H__ 35 #ifndef GOOGLE_PROTOBUF_COMPILER_JAVANANO_FILE_H__
36 #define GOOGLE_PROTOBUF_COMPILER_JAVA_FILE_H__ 36 #define GOOGLE_PROTOBUF_COMPILER_JAVANANO_FILE_H__
37 37
38 #include <string> 38 #include <string>
39 #include <vector> 39 #include <vector>
40 #include <google/protobuf/stubs/common.h> 40 #include <google/protobuf/stubs/common.h>
41 #include <google/protobuf/compiler/javanano/javanano_params.h>
41 42
42 namespace google { 43 namespace google {
43 namespace protobuf { 44 namespace protobuf {
44 class FileDescriptor; // descriptor.h 45 class FileDescriptor; // descriptor.h
45 namespace io { 46 namespace io {
46 class Printer; // printer.h 47 class Printer; // printer.h
47 } 48 }
48 namespace compiler { 49 namespace compiler {
49 class GeneratorContext; // code_generator.h 50 class GeneratorContext; // code_generator.h
50 } 51 }
51 } 52 }
52 53
53 namespace protobuf { 54 namespace protobuf {
54 namespace compiler { 55 namespace compiler {
55 namespace java { 56 namespace javanano {
56 57
57 class FileGenerator { 58 class FileGenerator {
58 public: 59 public:
59 explicit FileGenerator(const FileDescriptor* file); 60 explicit FileGenerator(const FileDescriptor* file, const Params& params);
60 ~FileGenerator(); 61 ~FileGenerator();
61 62
62 // Checks for problems that would otherwise lead to cryptic compile errors. 63 // Checks for problems that would otherwise lead to cryptic compile errors.
63 // Returns true if there are no problems, or writes an error description to 64 // Returns true if there are no problems, or writes an error description to
64 // the given string and returns false otherwise. 65 // the given string and returns false otherwise.
65 bool Validate(string* error); 66 bool Validate(string* error);
66 67
67 void Generate(io::Printer* printer); 68 void Generate(io::Printer* printer);
68 69
69 // If we aren't putting everything into one file, this will write all the 70 // If we aren't putting everything into one file, this will write all the
70 // files other than the outer file (i.e. one for each message, enum, and 71 // files other than the outer file (i.e. one for each message, enum, and
71 // service type). 72 // service type).
72 void GenerateSiblings(const string& package_dir, 73 void GenerateSiblings(const string& package_dir,
73 GeneratorContext* generator_context, 74 GeneratorContext* output_directory,
74 vector<string>* file_list); 75 vector<string>* file_list);
75 76
76 const string& java_package() { return java_package_; } 77 const string& java_package() { return java_package_; }
77 const string& classname() { return classname_; } 78 const string& classname() { return classname_; }
78 79
79
80 private: 80 private:
81 // Returns whether the dependency should be included in the output file.
82 // Always returns true for opensource, but used internally at Google to help
83 // improve compatibility with version 1 of protocol buffers.
84 bool ShouldIncludeDependency(const FileDescriptor* descriptor);
85
86 const FileDescriptor* file_; 81 const FileDescriptor* file_;
82 const Params& params_;
87 string java_package_; 83 string java_package_;
88 string classname_; 84 string classname_;
89 85
90
91 void GenerateEmbeddedDescriptor(io::Printer* printer);
92
93 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FileGenerator); 86 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FileGenerator);
94 }; 87 };
95 88
96 } // namespace java 89 } // namespace javanano
97 } // namespace compiler 90 } // namespace compiler
98 } // namespace protobuf 91 } // namespace protobuf
99 92
100 } // namespace google 93 } // namespace google
101 #endif // GOOGLE_PROTOBUF_COMPILER_JAVA_FILE_H__ 94 #endif // GOOGLE_PROTOBUF_COMPILER_JAVANANO_FILE_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698