Commit 562372e5 authored by Jan Tattermusch's avatar Jan Tattermusch

Merge pull request #989 from jskeet/rename-umbrella

Rename "umbrella" to "reflection" consistently.
parents fa8e2911 a6361a12
...@@ -195,11 +195,11 @@ cc_library( ...@@ -195,11 +195,11 @@ cc_library(
"src/google/protobuf/compiler/csharp/csharp_message.cc", "src/google/protobuf/compiler/csharp/csharp_message.cc",
"src/google/protobuf/compiler/csharp/csharp_message_field.cc", "src/google/protobuf/compiler/csharp/csharp_message_field.cc",
"src/google/protobuf/compiler/csharp/csharp_primitive_field.cc", "src/google/protobuf/compiler/csharp/csharp_primitive_field.cc",
"src/google/protobuf/compiler/csharp/csharp_reflection_class.cc",
"src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc", "src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc",
"src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc", "src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc",
"src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc", "src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc",
"src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc", "src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc",
"src/google/protobuf/compiler/csharp/csharp_umbrella_class.cc",
"src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc", "src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc",
"src/google/protobuf/compiler/java/java_context.cc", "src/google/protobuf/compiler/java/java_context.cc",
"src/google/protobuf/compiler/java/java_doc_comment.cc", "src/google/protobuf/compiler/java/java_doc_comment.cc",
......
...@@ -24,11 +24,11 @@ set(libprotoc_files ...@@ -24,11 +24,11 @@ set(libprotoc_files
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_message.cc ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_message.cc
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_message_field.cc ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_message_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_umbrella_class.cc
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_context.cc ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_context.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_doc_comment.cc ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_doc_comment.cc
......
...@@ -453,6 +453,8 @@ libprotoc_la_SOURCES = \ ...@@ -453,6 +453,8 @@ libprotoc_la_SOURCES = \
google/protobuf/compiler/csharp/csharp_message_field.h \ google/protobuf/compiler/csharp/csharp_message_field.h \
google/protobuf/compiler/csharp/csharp_primitive_field.cc \ google/protobuf/compiler/csharp/csharp_primitive_field.cc \
google/protobuf/compiler/csharp/csharp_primitive_field.h \ google/protobuf/compiler/csharp/csharp_primitive_field.h \
google/protobuf/compiler/csharp/csharp_reflection_class.cc \
google/protobuf/compiler/csharp/csharp_reflection_class.h \
google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc \ google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc \
google/protobuf/compiler/csharp/csharp_repeated_enum_field.h \ google/protobuf/compiler/csharp/csharp_repeated_enum_field.h \
google/protobuf/compiler/csharp/csharp_repeated_message_field.cc \ google/protobuf/compiler/csharp/csharp_repeated_message_field.cc \
...@@ -461,8 +463,6 @@ libprotoc_la_SOURCES = \ ...@@ -461,8 +463,6 @@ libprotoc_la_SOURCES = \
google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h \ google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h \
google/protobuf/compiler/csharp/csharp_source_generator_base.cc \ google/protobuf/compiler/csharp/csharp_source_generator_base.cc \
google/protobuf/compiler/csharp/csharp_source_generator_base.h \ google/protobuf/compiler/csharp/csharp_source_generator_base.h \
google/protobuf/compiler/csharp/csharp_umbrella_class.cc \
google/protobuf/compiler/csharp/csharp_umbrella_class.h \
google/protobuf/compiler/csharp/csharp_wrapper_field.cc \ google/protobuf/compiler/csharp/csharp_wrapper_field.cc \
google/protobuf/compiler/csharp/csharp_wrapper_field.h google/protobuf/compiler/csharp/csharp_wrapper_field.h
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
#include <google/protobuf/compiler/csharp/csharp_generator.h> #include <google/protobuf/compiler/csharp/csharp_generator.h>
#include <google/protobuf/compiler/csharp/csharp_helpers.h> #include <google/protobuf/compiler/csharp/csharp_helpers.h>
#include <google/protobuf/compiler/csharp/csharp_names.h> #include <google/protobuf/compiler/csharp/csharp_names.h>
#include <google/protobuf/compiler/csharp/csharp_umbrella_class.h> #include <google/protobuf/compiler/csharp/csharp_reflection_class.h>
using google::protobuf::internal::scoped_ptr; using google::protobuf::internal::scoped_ptr;
...@@ -52,8 +52,8 @@ namespace csharp { ...@@ -52,8 +52,8 @@ namespace csharp {
void GenerateFile(const google::protobuf::FileDescriptor* file, void GenerateFile(const google::protobuf::FileDescriptor* file,
io::Printer* printer) { io::Printer* printer) {
UmbrellaClassGenerator umbrellaGenerator(file); ReflectionClassGenerator reflectionClassGenerator(file);
umbrellaGenerator.Generate(printer); reflectionClassGenerator.Generate(printer);
} }
bool Generator::Generate( bool Generator::Generate(
......
...@@ -126,8 +126,7 @@ std::string GetFileNameBase(const FileDescriptor* descriptor) { ...@@ -126,8 +126,7 @@ std::string GetFileNameBase(const FileDescriptor* descriptor) {
return UnderscoresToPascalCase(StripDotProto(base)); return UnderscoresToPascalCase(StripDotProto(base));
} }
std::string GetUmbrellaClassUnqualifiedName(const FileDescriptor* descriptor) { std::string GetReflectionClassUnqualifiedName(const FileDescriptor* descriptor) {
// umbrella_classname can no longer be set using message option.
// TODO: Detect collisions with existing messages, and append an underscore if necessary. // TODO: Detect collisions with existing messages, and append an underscore if necessary.
return GetFileNameBase(descriptor) + "Reflection"; return GetFileNameBase(descriptor) + "Reflection";
} }
...@@ -194,12 +193,12 @@ std::string ToCSharpName(const std::string& name, const FileDescriptor* file) { ...@@ -194,12 +193,12 @@ std::string ToCSharpName(const std::string& name, const FileDescriptor* file) {
return "global::" + result; return "global::" + result;
} }
std::string GetUmbrellaClassName(const FileDescriptor* descriptor) { std::string GetReflectionClassName(const FileDescriptor* descriptor) {
std::string result = GetFileNamespace(descriptor); std::string result = GetFileNamespace(descriptor);
if (!result.empty()) { if (!result.empty()) {
result += '.'; result += '.';
} }
result += GetUmbrellaClassUnqualifiedName(descriptor); result += GetReflectionClassUnqualifiedName(descriptor);
return "global::" + result; return "global::" + result;
} }
......
...@@ -69,12 +69,8 @@ CSharpType GetCSharpType(FieldDescriptor::Type type); ...@@ -69,12 +69,8 @@ CSharpType GetCSharpType(FieldDescriptor::Type type);
std::string StripDotProto(const std::string& proto_file); std::string StripDotProto(const std::string& proto_file);
// Gets unqualified name of the umbrella class // Gets unqualified name of the reflection class
std::string GetUmbrellaClassUnqualifiedName(const FileDescriptor* descriptor); std::string GetReflectionClassUnqualifiedName(const FileDescriptor* descriptor);
// Gets name of the nested for umbrella class (just the nested part,
// not including the GetFileNamespace part).
std::string GetUmbrellaClassNestedNamespace(const FileDescriptor* descriptor);
std::string GetClassName(const EnumDescriptor* descriptor); std::string GetClassName(const EnumDescriptor* descriptor);
......
...@@ -119,7 +119,7 @@ void MessageGenerator::Generate(io::Printer* printer) { ...@@ -119,7 +119,7 @@ void MessageGenerator::Generate(io::Printer* printer) {
// Access the message descriptor via the relevant file descriptor or containing message descriptor. // Access the message descriptor via the relevant file descriptor or containing message descriptor.
if (!descriptor_->containing_type()) { if (!descriptor_->containing_type()) {
vars["descriptor_accessor"] = GetUmbrellaClassName(descriptor_->file()) vars["descriptor_accessor"] = GetReflectionClassName(descriptor_->file())
+ ".Descriptor.MessageTypes[" + SimpleItoa(descriptor_->index()) + "]"; + ".Descriptor.MessageTypes[" + SimpleItoa(descriptor_->index()) + "]";
} else { } else {
vars["descriptor_accessor"] = GetClassName(descriptor_->containing_type()) vars["descriptor_accessor"] = GetClassName(descriptor_->containing_type())
......
...@@ -72,7 +72,7 @@ string GetClassName(const Descriptor* descriptor); ...@@ -72,7 +72,7 @@ string GetClassName(const Descriptor* descriptor);
// The fully-qualified name of the C# class that provides // The fully-qualified name of the C# class that provides
// access to the file descriptor. Proto compiler generates // access to the file descriptor. Proto compiler generates
// such class for each .proto file processed. // such class for each .proto file processed.
string GetUmbrellaClassName(const FileDescriptor* descriptor); string GetReflectionClassName(const FileDescriptor* descriptor);
// Generates output file name for given file descriptor. If generate_directories // Generates output file name for given file descriptor. If generate_directories
// is true, the output file will be put under directory corresponding to file's // is true, the output file will be put under directory corresponding to file's
......
...@@ -43,24 +43,24 @@ ...@@ -43,24 +43,24 @@
#include <google/protobuf/compiler/csharp/csharp_helpers.h> #include <google/protobuf/compiler/csharp/csharp_helpers.h>
#include <google/protobuf/compiler/csharp/csharp_message.h> #include <google/protobuf/compiler/csharp/csharp_message.h>
#include <google/protobuf/compiler/csharp/csharp_names.h> #include <google/protobuf/compiler/csharp/csharp_names.h>
#include <google/protobuf/compiler/csharp/csharp_umbrella_class.h> #include <google/protobuf/compiler/csharp/csharp_reflection_class.h>
namespace google { namespace google {
namespace protobuf { namespace protobuf {
namespace compiler { namespace compiler {
namespace csharp { namespace csharp {
UmbrellaClassGenerator::UmbrellaClassGenerator(const FileDescriptor* file) ReflectionClassGenerator::ReflectionClassGenerator(const FileDescriptor* file)
: SourceGeneratorBase(file), : SourceGeneratorBase(file),
file_(file) { file_(file) {
namespace_ = GetFileNamespace(file); namespace_ = GetFileNamespace(file);
umbrellaClassname_ = GetUmbrellaClassUnqualifiedName(file); reflectionClassname_ = GetReflectionClassUnqualifiedName(file);
} }
UmbrellaClassGenerator::~UmbrellaClassGenerator() { ReflectionClassGenerator::~ReflectionClassGenerator() {
} }
void UmbrellaClassGenerator::Generate(io::Printer* printer) { void ReflectionClassGenerator::Generate(io::Printer* printer) {
WriteIntroduction(printer); WriteIntroduction(printer);
WriteDescriptor(printer); WriteDescriptor(printer);
...@@ -100,7 +100,7 @@ void UmbrellaClassGenerator::Generate(io::Printer* printer) { ...@@ -100,7 +100,7 @@ void UmbrellaClassGenerator::Generate(io::Printer* printer) {
printer->Print("#endregion Designer generated code\n"); printer->Print("#endregion Designer generated code\n");
} }
void UmbrellaClassGenerator::WriteIntroduction(io::Printer* printer) { void ReflectionClassGenerator::WriteIntroduction(io::Printer* printer) {
printer->Print( printer->Print(
"// Generated by the protocol buffer compiler. DO NOT EDIT!\n" "// Generated by the protocol buffer compiler. DO NOT EDIT!\n"
"// source: $file_name$\n" "// source: $file_name$\n"
...@@ -125,14 +125,14 @@ void UmbrellaClassGenerator::WriteIntroduction(io::Printer* printer) { ...@@ -125,14 +125,14 @@ void UmbrellaClassGenerator::WriteIntroduction(io::Printer* printer) {
"file_name", file_->name()); "file_name", file_->name());
WriteGeneratedCodeAttributes(printer); WriteGeneratedCodeAttributes(printer);
printer->Print( printer->Print(
"$access_level$ static partial class $umbrella_class_name$ {\n" "$access_level$ static partial class $reflection_class_name$ {\n"
"\n", "\n",
"access_level", class_access_level(), "access_level", class_access_level(),
"umbrella_class_name", umbrellaClassname_); "reflection_class_name", reflectionClassname_);
printer->Indent(); printer->Indent();
} }
void UmbrellaClassGenerator::WriteDescriptor(io::Printer* printer) { void ReflectionClassGenerator::WriteDescriptor(io::Printer* printer) {
printer->Print( printer->Print(
"#region Descriptor\n" "#region Descriptor\n"
"/// <summary>File descriptor for $file_name$</summary>\n" "/// <summary>File descriptor for $file_name$</summary>\n"
...@@ -141,9 +141,9 @@ void UmbrellaClassGenerator::WriteDescriptor(io::Printer* printer) { ...@@ -141,9 +141,9 @@ void UmbrellaClassGenerator::WriteDescriptor(io::Printer* printer) {
"}\n" "}\n"
"private static pbr::FileDescriptor descriptor;\n" "private static pbr::FileDescriptor descriptor;\n"
"\n" "\n"
"static $umbrella_class_name$() {\n", "static $reflection_class_name$() {\n",
"file_name", file_->name(), "file_name", file_->name(),
"umbrella_class_name", umbrellaClassname_); "reflection_class_name", reflectionClassname_);
printer->Indent(); printer->Indent();
printer->Print( printer->Print(
"byte[] descriptorData = global::System.Convert.FromBase64String(\n"); "byte[] descriptorData = global::System.Convert.FromBase64String(\n");
...@@ -176,9 +176,9 @@ void UmbrellaClassGenerator::WriteDescriptor(io::Printer* printer) { ...@@ -176,9 +176,9 @@ void UmbrellaClassGenerator::WriteDescriptor(io::Printer* printer) {
printer->Print("pbr::FileDescriptor.DescriptorProtoFileDescriptor, "); printer->Print("pbr::FileDescriptor.DescriptorProtoFileDescriptor, ");
} else { } else {
printer->Print( printer->Print(
"$full_umbrella_class_name$.Descriptor, ", "$full_reflection_class_name$.Descriptor, ",
"full_umbrella_class_name", "full_reflection_class_name",
GetUmbrellaClassName(file_->dependency(i))); GetReflectionClassName(file_->dependency(i)));
} }
} }
printer->Print("},\n" printer->Print("},\n"
...@@ -226,7 +226,7 @@ void UmbrellaClassGenerator::WriteDescriptor(io::Printer* printer) { ...@@ -226,7 +226,7 @@ void UmbrellaClassGenerator::WriteDescriptor(io::Printer* printer) {
// The "last" parameter indicates whether this message descriptor is the last one being printed in this immediate // The "last" parameter indicates whether this message descriptor is the last one being printed in this immediate
// context. It governs whether or not a trailing comma and newline is written after the constructor, effectively // context. It governs whether or not a trailing comma and newline is written after the constructor, effectively
// just controlling the formatting in the generated code. // just controlling the formatting in the generated code.
void UmbrellaClassGenerator::WriteGeneratedCodeInfo(const Descriptor* descriptor, io::Printer* printer, bool last) { void ReflectionClassGenerator::WriteGeneratedCodeInfo(const Descriptor* descriptor, io::Printer* printer, bool last) {
if (IsMapEntryMessage(descriptor)) { if (IsMapEntryMessage(descriptor)) {
printer->Print("null, "); printer->Print("null, ");
return; return;
......
...@@ -28,8 +28,8 @@ ...@@ -28,8 +28,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_UMBRELLA_CLASS_H__ #ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_REFLECTION_CLASS_H__
#define GOOGLE_PROTOBUF_COMPILER_CSHARP_UMBRELLA_CLASS_H__ #define GOOGLE_PROTOBUF_COMPILER_CSHARP_REFLECTION_CLASS_H__
#include <string> #include <string>
...@@ -41,10 +41,10 @@ namespace protobuf { ...@@ -41,10 +41,10 @@ namespace protobuf {
namespace compiler { namespace compiler {
namespace csharp { namespace csharp {
class UmbrellaClassGenerator : public SourceGeneratorBase { class ReflectionClassGenerator : public SourceGeneratorBase {
public: public:
UmbrellaClassGenerator(const FileDescriptor* file); ReflectionClassGenerator(const FileDescriptor* file);
~UmbrellaClassGenerator(); ~ReflectionClassGenerator();
void Generate(io::Printer* printer); void Generate(io::Printer* printer);
...@@ -52,13 +52,13 @@ class UmbrellaClassGenerator : public SourceGeneratorBase { ...@@ -52,13 +52,13 @@ class UmbrellaClassGenerator : public SourceGeneratorBase {
const FileDescriptor* file_; const FileDescriptor* file_;
std::string namespace_; std::string namespace_;
std::string umbrellaClassname_; std::string reflectionClassname_;
void WriteIntroduction(io::Printer* printer); void WriteIntroduction(io::Printer* printer);
void WriteDescriptor(io::Printer* printer); void WriteDescriptor(io::Printer* printer);
void WriteGeneratedCodeInfo(const Descriptor* descriptor, io::Printer* printer, bool last); void WriteGeneratedCodeInfo(const Descriptor* descriptor, io::Printer* printer, bool last);
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(UmbrellaClassGenerator); GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ReflectionClassGenerator);
}; };
} // namespace csharp } // namespace csharp
...@@ -66,4 +66,4 @@ class UmbrellaClassGenerator : public SourceGeneratorBase { ...@@ -66,4 +66,4 @@ class UmbrellaClassGenerator : public SourceGeneratorBase {
} // namespace protobuf } // namespace protobuf
} // namespace google } // namespace google
#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_UMBRELLA_CLASS_H__ #endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_REFLECTION_CLASS_H__
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment