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
24f8626c
Commit
24f8626c
authored
Jul 14, 2015
by
Jon Skeet
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #583 from jskeet/issue312
Pascal-case namespace automatically in C# codegen
parents
9440a2ab
8482b6c4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
csharp_helpers.cc
src/google/protobuf/compiler/csharp/csharp_helpers.cc
+6
-2
csharp_helpers.h
src/google/protobuf/compiler/csharp/csharp_helpers.h
+5
-1
No files found.
src/google/protobuf/compiler/csharp/csharp_helpers.cc
View file @
24f8626c
...
...
@@ -113,7 +113,7 @@ std::string GetFileNamespace(const FileDescriptor* descriptor) {
if
(
descriptor
->
options
().
has_csharp_namespace
())
{
return
descriptor
->
options
().
csharp_namespace
();
}
return
descriptor
->
package
(
);
return
UnderscoresToCamelCase
(
descriptor
->
package
(),
true
,
true
);
}
std
::
string
GetUmbrellaClassNameInternal
(
const
std
::
string
&
proto_file
)
{
...
...
@@ -154,7 +154,8 @@ std::string GetFileUmbrellaNamespace(const FileDescriptor* descriptor) {
// TODO(jtattermusch): can we reuse a utility function?
std
::
string
UnderscoresToCamelCase
(
const
std
::
string
&
input
,
bool
cap_next_letter
)
{
bool
cap_next_letter
,
bool
preserve_period
)
{
string
result
;
// Note: I distrust ctype.h due to locales.
for
(
int
i
=
0
;
i
<
input
.
size
();
i
++
)
{
...
...
@@ -180,6 +181,9 @@ std::string UnderscoresToCamelCase(const std::string& input,
cap_next_letter
=
true
;
}
else
{
cap_next_letter
=
true
;
if
(
input
[
i
]
==
'.'
&&
preserve_period
)
{
result
+=
'.'
;
}
}
}
// Add a trailing "_" if the name should be altered.
...
...
src/google/protobuf/compiler/csharp/csharp_helpers.h
View file @
24f8626c
...
...
@@ -88,7 +88,11 @@ std::string GetPropertyName(const FieldDescriptor* descriptor);
int
GetFixedSize
(
FieldDescriptor
::
Type
type
);
std
::
string
UnderscoresToCamelCase
(
const
std
::
string
&
input
,
bool
cap_next_letter
);
std
::
string
UnderscoresToCamelCase
(
const
std
::
string
&
input
,
bool
cap_next_letter
,
bool
preserve_period
);
inline
std
::
string
UnderscoresToCamelCase
(
const
std
::
string
&
input
,
bool
cap_next_letter
)
{
return
UnderscoresToCamelCase
(
input
,
cap_next_letter
,
false
);
}
std
::
string
UnderscoresToPascalCase
(
const
std
::
string
&
input
);
...
...
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