Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
562372e5
Commit
562372e5
authored
Nov 20, 2015
by
Jan Tattermusch
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #989 from jskeet/rename-umbrella
Rename "umbrella" to "reflection" consistently.
parents
fa8e2911
a6361a12
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
37 additions
and
42 deletions
+37
-42
BUILD
BUILD
+1
-1
libprotoc.cmake
cmake/libprotoc.cmake
+1
-1
Makefile.am
src/Makefile.am
+2
-2
csharp_generator.cc
src/google/protobuf/compiler/csharp/csharp_generator.cc
+3
-3
csharp_helpers.cc
src/google/protobuf/compiler/csharp/csharp_helpers.cc
+3
-4
csharp_helpers.h
src/google/protobuf/compiler/csharp/csharp_helpers.h
+2
-6
csharp_message.cc
src/google/protobuf/compiler/csharp/csharp_message.cc
+1
-1
csharp_names.h
src/google/protobuf/compiler/csharp/csharp_names.h
+1
-1
csharp_reflection_class.cc
...oogle/protobuf/compiler/csharp/csharp_reflection_class.cc
+15
-15
csharp_reflection_class.h
...google/protobuf/compiler/csharp/csharp_reflection_class.h
+8
-8
No files found.
BUILD
View file @
562372e5
...
...
@@ -195,11 +195,11 @@ cc_library(
"src/google/protobuf/compiler/csharp/csharp_message.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_reflection_class.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_primitive_field.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/java/java_context.cc",
"src/google/protobuf/compiler/java/java_doc_comment.cc",
...
...
cmake/libprotoc.cmake
View file @
562372e5
...
...
@@ -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_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_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_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/java/java_context.cc
${
protobuf_source_dir
}
/src/google/protobuf/compiler/java/java_doc_comment.cc
...
...
src/Makefile.am
View file @
562372e5
...
...
@@ -453,6 +453,8 @@ libprotoc_la_SOURCES = \
google/protobuf/compiler/csharp/csharp_message_field.h
\
google/protobuf/compiler/csharp/csharp_primitive_field.cc
\
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.h
\
google/protobuf/compiler/csharp/csharp_repeated_message_field.cc
\
...
...
@@ -461,8 +463,6 @@ libprotoc_la_SOURCES = \
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.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.h
...
...
src/google/protobuf/compiler/csharp/csharp_generator.cc
View file @
562372e5
...
...
@@ -41,7 +41,7 @@
#include <google/protobuf/compiler/csharp/csharp_generator.h>
#include <google/protobuf/compiler/csharp/csharp_helpers.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
;
...
...
@@ -52,8 +52,8 @@ namespace csharp {
void
GenerateFile
(
const
google
::
protobuf
::
FileDescriptor
*
file
,
io
::
Printer
*
printer
)
{
UmbrellaClassGenerator
umbrella
Generator
(
file
);
umbrella
Generator
.
Generate
(
printer
);
ReflectionClassGenerator
reflectionClass
Generator
(
file
);
reflectionClass
Generator
.
Generate
(
printer
);
}
bool
Generator
::
Generate
(
...
...
src/google/protobuf/compiler/csharp/csharp_helpers.cc
View file @
562372e5
...
...
@@ -126,8 +126,7 @@ std::string GetFileNameBase(const FileDescriptor* descriptor) {
return
UnderscoresToPascalCase
(
StripDotProto
(
base
));
}
std
::
string
GetUmbrellaClassUnqualifiedName
(
const
FileDescriptor
*
descriptor
)
{
// umbrella_classname can no longer be set using message option.
std
::
string
GetReflectionClassUnqualifiedName
(
const
FileDescriptor
*
descriptor
)
{
// TODO: Detect collisions with existing messages, and append an underscore if necessary.
return
GetFileNameBase
(
descriptor
)
+
"Reflection"
;
}
...
...
@@ -194,12 +193,12 @@ std::string ToCSharpName(const std::string& name, const FileDescriptor* file) {
return
"global::"
+
result
;
}
std
::
string
Get
Umbrella
ClassName
(
const
FileDescriptor
*
descriptor
)
{
std
::
string
Get
Reflection
ClassName
(
const
FileDescriptor
*
descriptor
)
{
std
::
string
result
=
GetFileNamespace
(
descriptor
);
if
(
!
result
.
empty
())
{
result
+=
'.'
;
}
result
+=
Get
Umbrella
ClassUnqualifiedName
(
descriptor
);
result
+=
Get
Reflection
ClassUnqualifiedName
(
descriptor
);
return
"global::"
+
result
;
}
...
...
src/google/protobuf/compiler/csharp/csharp_helpers.h
View file @
562372e5
...
...
@@ -69,12 +69,8 @@ CSharpType GetCSharpType(FieldDescriptor::Type type);
std
::
string
StripDotProto
(
const
std
::
string
&
proto_file
);
// Gets unqualified name of the umbrella class
std
::
string
GetUmbrellaClassUnqualifiedName
(
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
);
// Gets unqualified name of the reflection class
std
::
string
GetReflectionClassUnqualifiedName
(
const
FileDescriptor
*
descriptor
);
std
::
string
GetClassName
(
const
EnumDescriptor
*
descriptor
);
...
...
src/google/protobuf/compiler/csharp/csharp_message.cc
View file @
562372e5
...
...
@@ -119,7 +119,7 @@ void MessageGenerator::Generate(io::Printer* printer) {
// Access the message descriptor via the relevant file descriptor or containing message descriptor.
if
(
!
descriptor_
->
containing_type
())
{
vars
[
"descriptor_accessor"
]
=
Get
Umbrella
ClassName
(
descriptor_
->
file
())
vars
[
"descriptor_accessor"
]
=
Get
Reflection
ClassName
(
descriptor_
->
file
())
+
".Descriptor.MessageTypes["
+
SimpleItoa
(
descriptor_
->
index
())
+
"]"
;
}
else
{
vars
[
"descriptor_accessor"
]
=
GetClassName
(
descriptor_
->
containing_type
())
...
...
src/google/protobuf/compiler/csharp/csharp_names.h
View file @
562372e5
...
...
@@ -72,7 +72,7 @@ string GetClassName(const Descriptor* descriptor);
// The fully-qualified name of the C# class that provides
// access to the file descriptor. Proto compiler generates
// such class for each .proto file processed.
string
Get
Umbrella
ClassName
(
const
FileDescriptor
*
descriptor
);
string
Get
Reflection
ClassName
(
const
FileDescriptor
*
descriptor
);
// 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
...
...
src/google/protobuf/compiler/csharp/csharp_
umbrella
_class.cc
→
src/google/protobuf/compiler/csharp/csharp_
reflection
_class.cc
View file @
562372e5
...
...
@@ -43,24 +43,24 @@
#include <google/protobuf/compiler/csharp/csharp_helpers.h>
#include <google/protobuf/compiler/csharp/csharp_message.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
protobuf
{
namespace
compiler
{
namespace
csharp
{
UmbrellaClassGenerator
::
Umbrella
ClassGenerator
(
const
FileDescriptor
*
file
)
ReflectionClassGenerator
::
Reflection
ClassGenerator
(
const
FileDescriptor
*
file
)
:
SourceGeneratorBase
(
file
),
file_
(
file
)
{
namespace_
=
GetFileNamespace
(
file
);
umbrellaClassname_
=
GetUmbrella
ClassUnqualifiedName
(
file
);
reflectionClassname_
=
GetReflection
ClassUnqualifiedName
(
file
);
}
UmbrellaClassGenerator
::~
Umbrella
ClassGenerator
()
{
ReflectionClassGenerator
::~
Reflection
ClassGenerator
()
{
}
void
Umbrella
ClassGenerator
::
Generate
(
io
::
Printer
*
printer
)
{
void
Reflection
ClassGenerator
::
Generate
(
io
::
Printer
*
printer
)
{
WriteIntroduction
(
printer
);
WriteDescriptor
(
printer
);
...
...
@@ -100,7 +100,7 @@ void UmbrellaClassGenerator::Generate(io::Printer* printer) {
printer
->
Print
(
"#endregion Designer generated code
\n
"
);
}
void
Umbrella
ClassGenerator
::
WriteIntroduction
(
io
::
Printer
*
printer
)
{
void
Reflection
ClassGenerator
::
WriteIntroduction
(
io
::
Printer
*
printer
)
{
printer
->
Print
(
"// Generated by the protocol buffer compiler. DO NOT EDIT!
\n
"
"// source: $file_name$
\n
"
...
...
@@ -125,14 +125,14 @@ void UmbrellaClassGenerator::WriteIntroduction(io::Printer* printer) {
"file_name"
,
file_
->
name
());
WriteGeneratedCodeAttributes
(
printer
);
printer
->
Print
(
"$access_level$ static partial class $
umbrella
_class_name$ {
\n
"
"$access_level$ static partial class $
reflection
_class_name$ {
\n
"
"
\n
"
,
"access_level"
,
class_access_level
(),
"
umbrella_class_name"
,
umbrella
Classname_
);
"
reflection_class_name"
,
reflection
Classname_
);
printer
->
Indent
();
}
void
Umbrella
ClassGenerator
::
WriteDescriptor
(
io
::
Printer
*
printer
)
{
void
Reflection
ClassGenerator
::
WriteDescriptor
(
io
::
Printer
*
printer
)
{
printer
->
Print
(
"#region Descriptor
\n
"
"/// <summary>File descriptor for $file_name$</summary>
\n
"
...
...
@@ -141,9 +141,9 @@ void UmbrellaClassGenerator::WriteDescriptor(io::Printer* printer) {
"}
\n
"
"private static pbr::FileDescriptor descriptor;
\n
"
"
\n
"
"static $
umbrella
_class_name$() {
\n
"
,
"static $
reflection
_class_name$() {
\n
"
,
"file_name"
,
file_
->
name
(),
"
umbrella_class_name"
,
umbrella
Classname_
);
"
reflection_class_name"
,
reflection
Classname_
);
printer
->
Indent
();
printer
->
Print
(
"byte[] descriptorData = global::System.Convert.FromBase64String(
\n
"
);
...
...
@@ -176,9 +176,9 @@ void UmbrellaClassGenerator::WriteDescriptor(io::Printer* printer) {
printer
->
Print
(
"pbr::FileDescriptor.DescriptorProtoFileDescriptor, "
);
}
else
{
printer
->
Print
(
"$full_
umbrella
_class_name$.Descriptor, "
,
"full_
umbrella
_class_name"
,
Get
Umbrella
ClassName
(
file_
->
dependency
(
i
)));
"$full_
reflection
_class_name$.Descriptor, "
,
"full_
reflection
_class_name"
,
Get
Reflection
ClassName
(
file_
->
dependency
(
i
)));
}
}
printer
->
Print
(
"},
\n
"
...
...
@@ -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
// 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.
void
Umbrella
ClassGenerator
::
WriteGeneratedCodeInfo
(
const
Descriptor
*
descriptor
,
io
::
Printer
*
printer
,
bool
last
)
{
void
Reflection
ClassGenerator
::
WriteGeneratedCodeInfo
(
const
Descriptor
*
descriptor
,
io
::
Printer
*
printer
,
bool
last
)
{
if
(
IsMapEntryMessage
(
descriptor
))
{
printer
->
Print
(
"null, "
);
return
;
...
...
src/google/protobuf/compiler/csharp/csharp_
umbrella
_class.h
→
src/google/protobuf/compiler/csharp/csharp_
reflection
_class.h
View file @
562372e5
...
...
@@ -28,8 +28,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_
UMBRELLA
_CLASS_H__
#define GOOGLE_PROTOBUF_COMPILER_CSHARP_
UMBRELLA
_CLASS_H__
#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_
REFLECTION
_CLASS_H__
#define GOOGLE_PROTOBUF_COMPILER_CSHARP_
REFLECTION
_CLASS_H__
#include <string>
...
...
@@ -41,10 +41,10 @@ namespace protobuf {
namespace
compiler
{
namespace
csharp
{
class
Umbrella
ClassGenerator
:
public
SourceGeneratorBase
{
class
Reflection
ClassGenerator
:
public
SourceGeneratorBase
{
public
:
Umbrella
ClassGenerator
(
const
FileDescriptor
*
file
);
~
Umbrella
ClassGenerator
();
Reflection
ClassGenerator
(
const
FileDescriptor
*
file
);
~
Reflection
ClassGenerator
();
void
Generate
(
io
::
Printer
*
printer
);
...
...
@@ -52,13 +52,13 @@ class UmbrellaClassGenerator : public SourceGeneratorBase {
const
FileDescriptor
*
file_
;
std
::
string
namespace_
;
std
::
string
umbrella
Classname_
;
std
::
string
reflection
Classname_
;
void
WriteIntroduction
(
io
::
Printer
*
printer
);
void
WriteDescriptor
(
io
::
Printer
*
printer
);
void
WriteGeneratedCodeInfo
(
const
Descriptor
*
descriptor
,
io
::
Printer
*
printer
,
bool
last
);
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS
(
Umbrella
ClassGenerator
);
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS
(
Reflection
ClassGenerator
);
};
}
// namespace csharp
...
...
@@ -66,4 +66,4 @@ class UmbrellaClassGenerator : public SourceGeneratorBase {
}
// namespace protobuf
}
// namespace google
#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_
UMBRELLA
_CLASS_H__
#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_
REFLECTION
_CLASS_H__
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment