diff options
author | Max Cai <maxtroy@google.com> | 2013-09-24 17:40:37 +0100 |
---|---|---|
committer | Max Cai <maxtroy@google.com> | 2013-09-25 19:44:27 +0100 |
commit | 26266cd4660ffe1f3d6015b715713ee654c5b936 (patch) | |
tree | 71d26d35515a268e6c81850d1dc33b7d7113886c /src/google/protobuf/compiler/javanano/javanano_file.cc | |
parent | e74fe623e115237968a3de1143d7cdb4df710858 (diff) | |
download | external_protobuf-26266cd4660ffe1f3d6015b715713ee654c5b936.zip external_protobuf-26266cd4660ffe1f3d6015b715713ee654c5b936.tar.gz external_protobuf-26266cd4660ffe1f3d6015b715713ee654c5b936.tar.bz2 |
Implement enum_style=java option.
This javanano_out command line option creates a container interface
at the normal place where the enum constants would reside, per enum
definition. The java_multiple_files flag would now affect the file-
scope enums with the shells. If the flag is true then file-scope
container interfaces are created in their own files.
Change-Id: Id52258fcff8d3dee9db8f3d8022147a811bf3565
Diffstat (limited to 'src/google/protobuf/compiler/javanano/javanano_file.cc')
-rw-r--r-- | src/google/protobuf/compiler/javanano/javanano_file.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/google/protobuf/compiler/javanano/javanano_file.cc b/src/google/protobuf/compiler/javanano/javanano_file.cc index 1a7b2a7..75d0e44 100644 --- a/src/google/protobuf/compiler/javanano/javanano_file.cc +++ b/src/google/protobuf/compiler/javanano/javanano_file.cc @@ -138,6 +138,13 @@ bool FileGenerator::Validate(string* error) { found_conflict = true; } } + if (params_.java_enum_style()) { + for (int i = 0; !found_conflict && i < file_->enum_type_count(); i++) { + if (file_->enum_type(i)->name() == classname_) { + found_conflict = true; + } + } + } if (found_conflict) { error->assign(file_->name()); error->append( @@ -237,6 +244,14 @@ void FileGenerator::GenerateSiblings(const string& package_dir, file_->message_type(i), output_directory, file_list, params_); } + + if (params_.java_enum_style()) { + for (int i = 0; i < file_->enum_type_count(); i++) { + GenerateSibling<EnumGenerator>(package_dir, java_package_, + file_->enum_type(i), + output_directory, file_list, params_); + } + } } } |