aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/cpp_generator.cc58
-rw-r--r--src/compiler/cpp_generator.h6
-rw-r--r--src/compiler/cpp_generator_helpers.h16
-rw-r--r--src/compiler/cpp_plugin.cc16
-rw-r--r--src/compiler/ruby_generator.cc10
-rw-r--r--src/compiler/ruby_generator.h2
-rw-r--r--src/compiler/ruby_generator_helpers-inl.h6
-rw-r--r--src/compiler/ruby_generator_map-inl.h2
-rw-r--r--src/compiler/ruby_generator_string-inl.h22
-rw-r--r--src/compiler/ruby_plugin.cc10
10 files changed, 74 insertions, 74 deletions
diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc
index 29bd3560f3..8724f97e8b 100644
--- a/src/compiler/cpp_generator.cc
+++ b/src/compiler/cpp_generator.cc
@@ -45,23 +45,23 @@
namespace grpc_cpp_generator {
namespace {
-bool NoStreaming(const google::protobuf::MethodDescriptor* method) {
+bool NoStreaming(const google::protobuf::MethodDescriptor *method) {
return !method->client_streaming() && !method->server_streaming();
}
-bool ClientOnlyStreaming(const google::protobuf::MethodDescriptor* method) {
+bool ClientOnlyStreaming(const google::protobuf::MethodDescriptor *method) {
return method->client_streaming() && !method->server_streaming();
}
-bool ServerOnlyStreaming(const google::protobuf::MethodDescriptor* method) {
+bool ServerOnlyStreaming(const google::protobuf::MethodDescriptor *method) {
return !method->client_streaming() && method->server_streaming();
}
-bool BidiStreaming(const google::protobuf::MethodDescriptor* method) {
+bool BidiStreaming(const google::protobuf::MethodDescriptor *method) {
return method->client_streaming() && method->server_streaming();
}
-bool HasClientOnlyStreaming(const google::protobuf::FileDescriptor* file) {
+bool HasClientOnlyStreaming(const google::protobuf::FileDescriptor *file) {
for (int i = 0; i < file->service_count(); i++) {
for (int j = 0; j < file->service(i)->method_count(); j++) {
if (ClientOnlyStreaming(file->service(i)->method(j))) {
@@ -72,7 +72,7 @@ bool HasClientOnlyStreaming(const google::protobuf::FileDescriptor* file) {
return false;
}
-bool HasServerOnlyStreaming(const google::protobuf::FileDescriptor* file) {
+bool HasServerOnlyStreaming(const google::protobuf::FileDescriptor *file) {
for (int i = 0; i < file->service_count(); i++) {
for (int j = 0; j < file->service(i)->method_count(); j++) {
if (ServerOnlyStreaming(file->service(i)->method(j))) {
@@ -83,7 +83,7 @@ bool HasServerOnlyStreaming(const google::protobuf::FileDescriptor* file) {
return false;
}
-bool HasBidiStreaming(const google::protobuf::FileDescriptor* file) {
+bool HasBidiStreaming(const google::protobuf::FileDescriptor *file) {
for (int i = 0; i < file->service_count(); i++) {
for (int j = 0; j < file->service(i)->method_count(); j++) {
if (BidiStreaming(file->service(i)->method(j))) {
@@ -95,7 +95,7 @@ bool HasBidiStreaming(const google::protobuf::FileDescriptor* file) {
}
} // namespace
-std::string GetHeaderIncludes(const google::protobuf::FileDescriptor* file) {
+std::string GetHeaderIncludes(const google::protobuf::FileDescriptor *file) {
std::string temp =
"#include \"grpc++/impl/internal_stub.h\"\n"
"#include \"grpc++/status.h\"\n"
@@ -131,9 +131,9 @@ std::string GetSourceIncludes() {
"#include \"grpc++/stream.h\"\n";
}
-void PrintHeaderClientMethod(google::protobuf::io::Printer* printer,
- const google::protobuf::MethodDescriptor* method,
- std::map<std::string, std::string>* vars) {
+void PrintHeaderClientMethod(google::protobuf::io::Printer *printer,
+ const google::protobuf::MethodDescriptor *method,
+ std::map<std::string, std::string> *vars) {
(*vars)["Method"] = method->name();
(*vars)["Request"] =
grpc_cpp_generator::ClassName(method->input_type(), true);
@@ -160,9 +160,9 @@ void PrintHeaderClientMethod(google::protobuf::io::Printer* printer,
}
}
-void PrintHeaderServerMethod(google::protobuf::io::Printer* printer,
- const google::protobuf::MethodDescriptor* method,
- std::map<std::string, std::string>* vars) {
+void PrintHeaderServerMethod(google::protobuf::io::Printer *printer,
+ const google::protobuf::MethodDescriptor *method,
+ std::map<std::string, std::string> *vars) {
(*vars)["Method"] = method->name();
(*vars)["Request"] =
grpc_cpp_generator::ClassName(method->input_type(), true);
@@ -194,9 +194,9 @@ void PrintHeaderServerMethod(google::protobuf::io::Printer* printer,
}
}
-void PrintHeaderService(google::protobuf::io::Printer* printer,
- const google::protobuf::ServiceDescriptor* service,
- std::map<std::string, std::string>* vars) {
+void PrintHeaderService(google::protobuf::io::Printer *printer,
+ const google::protobuf::ServiceDescriptor *service,
+ std::map<std::string, std::string> *vars) {
(*vars)["Service"] = service->name();
printer->Print(*vars,
@@ -241,7 +241,7 @@ void PrintHeaderService(google::protobuf::io::Printer* printer,
printer->Print("};\n");
}
-std::string GetHeaderServices(const google::protobuf::FileDescriptor* file) {
+std::string GetHeaderServices(const google::protobuf::FileDescriptor *file) {
std::string output;
google::protobuf::io::StringOutputStream output_stream(&output);
google::protobuf::io::Printer printer(&output_stream, '$');
@@ -254,9 +254,9 @@ std::string GetHeaderServices(const google::protobuf::FileDescriptor* file) {
return output;
}
-void PrintSourceClientMethod(google::protobuf::io::Printer* printer,
- const google::protobuf::MethodDescriptor* method,
- std::map<std::string, std::string>* vars) {
+void PrintSourceClientMethod(google::protobuf::io::Printer *printer,
+ const google::protobuf::MethodDescriptor *method,
+ std::map<std::string, std::string> *vars) {
(*vars)["Method"] = method->name();
(*vars)["Request"] =
grpc_cpp_generator::ClassName(method->input_type(), true);
@@ -312,9 +312,9 @@ void PrintSourceClientMethod(google::protobuf::io::Printer* printer,
}
}
-void PrintSourceServerMethod(google::protobuf::io::Printer* printer,
- const google::protobuf::MethodDescriptor* method,
- std::map<std::string, std::string>* vars) {
+void PrintSourceServerMethod(google::protobuf::io::Printer *printer,
+ const google::protobuf::MethodDescriptor *method,
+ std::map<std::string, std::string> *vars) {
(*vars)["Method"] = method->name();
(*vars)["Request"] =
grpc_cpp_generator::ClassName(method->input_type(), true);
@@ -362,9 +362,9 @@ void PrintSourceServerMethod(google::protobuf::io::Printer* printer,
}
}
-void PrintSourceService(google::protobuf::io::Printer* printer,
- const google::protobuf::ServiceDescriptor* service,
- std::map<std::string, std::string>* vars) {
+void PrintSourceService(google::protobuf::io::Printer *printer,
+ const google::protobuf::ServiceDescriptor *service,
+ std::map<std::string, std::string> *vars) {
(*vars)["Service"] = service->name();
printer->Print(
*vars,
@@ -394,7 +394,7 @@ void PrintSourceService(google::protobuf::io::Printer* printer,
"}\n");
printer->Print("service_ = new ::grpc::RpcService();\n");
for (int i = 0; i < service->method_count(); ++i) {
- const google::protobuf::MethodDescriptor* method = service->method(i);
+ const google::protobuf::MethodDescriptor *method = service->method(i);
(*vars)["Method"] = method->name();
(*vars)["Request"] =
grpc_cpp_generator::ClassName(method->input_type(), true);
@@ -458,7 +458,7 @@ void PrintSourceService(google::protobuf::io::Printer* printer,
printer->Print("}\n\n");
}
-std::string GetSourceServices(const google::protobuf::FileDescriptor* file) {
+std::string GetSourceServices(const google::protobuf::FileDescriptor *file) {
std::string output;
google::protobuf::io::StringOutputStream output_stream(&output);
google::protobuf::io::Printer printer(&output_stream, '$');
diff --git a/src/compiler/cpp_generator.h b/src/compiler/cpp_generator.h
index 1a74211b71..fe84d08b4c 100644
--- a/src/compiler/cpp_generator.h
+++ b/src/compiler/cpp_generator.h
@@ -45,16 +45,16 @@ class FileDescriptor;
namespace grpc_cpp_generator {
// Return the includes needed for generated header file.
-std::string GetHeaderIncludes(const google::protobuf::FileDescriptor* file);
+std::string GetHeaderIncludes(const google::protobuf::FileDescriptor *file);
// Return the includes needed for generated source file.
std::string GetSourceIncludes();
// Return the services for generated header file.
-std::string GetHeaderServices(const google::protobuf::FileDescriptor* file);
+std::string GetHeaderServices(const google::protobuf::FileDescriptor *file);
// Return the services for generated source file.
-std::string GetSourceServices(const google::protobuf::FileDescriptor* file);
+std::string GetSourceServices(const google::protobuf::FileDescriptor *file);
} // namespace grpc_cpp_generator
diff --git a/src/compiler/cpp_generator_helpers.h b/src/compiler/cpp_generator_helpers.h
index 1ad3cb2db3..54c343866f 100644
--- a/src/compiler/cpp_generator_helpers.h
+++ b/src/compiler/cpp_generator_helpers.h
@@ -41,7 +41,7 @@
namespace grpc_cpp_generator {
-inline bool StripSuffix(std::string* filename, const std::string& suffix) {
+inline bool StripSuffix(std::string *filename, const std::string &suffix) {
if (filename->length() >= suffix.length()) {
size_t suffix_pos = filename->length() - suffix.length();
if (filename->compare(suffix_pos, std::string::npos, suffix) == 0) {
@@ -60,8 +60,8 @@ inline std::string StripProto(std::string filename) {
return filename;
}
-inline std::string StringReplace(std::string str, const std::string& from,
- const std::string& to) {
+inline std::string StringReplace(std::string str, const std::string &from,
+ const std::string &to) {
size_t pos = 0;
for (;;) {
@@ -76,22 +76,22 @@ inline std::string StringReplace(std::string str, const std::string& from,
return str;
}
-inline std::string DotsToColons(const std::string& name) {
+inline std::string DotsToColons(const std::string &name) {
return StringReplace(name, ".", "::");
}
-inline std::string DotsToUnderscores(const std::string& name) {
+inline std::string DotsToUnderscores(const std::string &name) {
return StringReplace(name, ".", "_");
}
-inline std::string ClassName(const google::protobuf::Descriptor* descriptor,
+inline std::string ClassName(const google::protobuf::Descriptor *descriptor,
bool qualified) {
// Find "outer", the descriptor of the top-level message in which
// "descriptor" is embedded.
- const google::protobuf::Descriptor* outer = descriptor;
+ const google::protobuf::Descriptor *outer = descriptor;
while (outer->containing_type() != NULL) outer = outer->containing_type();
- const std::string& outer_name = outer->full_name();
+ const std::string &outer_name = outer->full_name();
std::string inner_name = descriptor->full_name().substr(outer_name.size());
if (qualified) {
diff --git a/src/compiler/cpp_plugin.cc b/src/compiler/cpp_plugin.cc
index e43278529d..a7fdb1f093 100644
--- a/src/compiler/cpp_plugin.cc
+++ b/src/compiler/cpp_plugin.cc
@@ -51,10 +51,10 @@ class CppGrpcGenerator : public google::protobuf::compiler::CodeGenerator {
CppGrpcGenerator() {}
virtual ~CppGrpcGenerator() {}
- virtual bool Generate(const google::protobuf::FileDescriptor* file,
- const std::string& parameter,
- google::protobuf::compiler::GeneratorContext* context,
- std::string* error) const {
+ virtual bool Generate(const google::protobuf::FileDescriptor *file,
+ const std::string &parameter,
+ google::protobuf::compiler::GeneratorContext *context,
+ std::string *error) const {
if (file->options().cc_generic_services()) {
*error =
"cpp grpc proto compiler plugin does not work with generic "
@@ -81,9 +81,9 @@ class CppGrpcGenerator : public google::protobuf::compiler::CodeGenerator {
private:
// Insert the given code into the given file at the given insertion point.
- void Insert(google::protobuf::compiler::GeneratorContext* context,
- const std::string& filename, const std::string& insertion_point,
- const std::string& code) const {
+ void Insert(google::protobuf::compiler::GeneratorContext *context,
+ const std::string &filename, const std::string &insertion_point,
+ const std::string &code) const {
std::unique_ptr<google::protobuf::io::ZeroCopyOutputStream> output(
context->OpenForInsert(filename, insertion_point));
google::protobuf::io::CodedOutputStream coded_out(output.get());
@@ -91,7 +91,7 @@ class CppGrpcGenerator : public google::protobuf::compiler::CodeGenerator {
}
};
-int main(int argc, char* argv[]) {
+int main(int argc, char *argv[]) {
CppGrpcGenerator generator;
return google::protobuf::compiler::PluginMain(argc, argv, &generator);
}
diff --git a/src/compiler/ruby_generator.cc b/src/compiler/ruby_generator.cc
index 393f8f3b59..16632325dc 100644
--- a/src/compiler/ruby_generator.cc
+++ b/src/compiler/ruby_generator.cc
@@ -57,8 +57,8 @@ namespace grpc_ruby_generator {
namespace {
// Prints out the method using the ruby gRPC DSL.
-void PrintMethod(const MethodDescriptor* method, const std::string& package,
- Printer* out) {
+void PrintMethod(const MethodDescriptor *method, const std::string &package,
+ Printer *out) {
std::string input_type = RubyTypeOf(method->input_type()->name(), package);
if (method->client_streaming()) {
input_type = "stream(" + input_type + ")";
@@ -75,8 +75,8 @@ void PrintMethod(const MethodDescriptor* method, const std::string& package,
}
// Prints out the service using the ruby gRPC DSL.
-void PrintService(const ServiceDescriptor* service, const std::string& package,
- Printer* out) {
+void PrintService(const ServiceDescriptor *service, const std::string &package,
+ Printer *out) {
if (service->method_count() == 0) {
return;
}
@@ -125,7 +125,7 @@ void PrintService(const ServiceDescriptor* service, const std::string& package,
} // namespace
-std::string GetServices(const FileDescriptor* file) {
+std::string GetServices(const FileDescriptor *file) {
std::string output;
StringOutputStream output_stream(&output);
Printer out(&output_stream, '$');
diff --git a/src/compiler/ruby_generator.h b/src/compiler/ruby_generator.h
index 0306536d08..89d7a0b92a 100644
--- a/src/compiler/ruby_generator.h
+++ b/src/compiler/ruby_generator.h
@@ -44,7 +44,7 @@ class FileDescriptor;
namespace grpc_ruby_generator {
-std::string GetServices(const google::protobuf::FileDescriptor* file);
+std::string GetServices(const google::protobuf::FileDescriptor *file);
} // namespace grpc_ruby_generator
diff --git a/src/compiler/ruby_generator_helpers-inl.h b/src/compiler/ruby_generator_helpers-inl.h
index 7b973ed9eb..0034f5ef56 100644
--- a/src/compiler/ruby_generator_helpers-inl.h
+++ b/src/compiler/ruby_generator_helpers-inl.h
@@ -41,8 +41,8 @@
namespace grpc_ruby_generator {
-inline bool ServicesFilename(const google::protobuf::FileDescriptor* file,
- std::string* file_name_or_error) {
+inline bool ServicesFilename(const google::protobuf::FileDescriptor *file,
+ std::string *file_name_or_error) {
// Get output file name.
static const unsigned proto_suffix_length = 6; // length of ".proto"
if (file->name().size() > proto_suffix_length &&
@@ -58,7 +58,7 @@ inline bool ServicesFilename(const google::protobuf::FileDescriptor* file,
}
inline std::string MessagesRequireName(
- const google::protobuf::FileDescriptor* file) {
+ const google::protobuf::FileDescriptor *file) {
return Replace(file->name(), ".proto", "");
}
diff --git a/src/compiler/ruby_generator_map-inl.h b/src/compiler/ruby_generator_map-inl.h
index a49650a2f7..fea9c2e2fa 100644
--- a/src/compiler/ruby_generator_map-inl.h
+++ b/src/compiler/ruby_generator_map-inl.h
@@ -49,7 +49,7 @@ namespace grpc_ruby_generator {
// Converts an initializer list of the form { key0, value0, key1, value1, ... }
// into a map of key* to value*. Is merely a readability helper for later code.
inline std::map<std::string, std::string> ListToDict(
- const initializer_list<std::string>& values) {
+ const initializer_list<std::string> &values) {
if (values.size() % 2 != 0) {
// MOE: insert std::cerr << "Not every 'key' has a value in `values`."
// << std::endl;
diff --git a/src/compiler/ruby_generator_string-inl.h b/src/compiler/ruby_generator_string-inl.h
index a253f78d49..d24a61b9f5 100644
--- a/src/compiler/ruby_generator_string-inl.h
+++ b/src/compiler/ruby_generator_string-inl.h
@@ -45,8 +45,8 @@ using std::transform;
namespace grpc_ruby_generator {
// Split splits a string using char into elems.
-inline std::vector<std::string>& Split(const std::string& s, char delim,
- std::vector<std::string>* elems) {
+inline std::vector<std::string> &Split(const std::string &s, char delim,
+ std::vector<std::string> *elems) {
std::stringstream ss(s);
std::string item;
while (getline(ss, item, delim)) {
@@ -56,15 +56,15 @@ inline std::vector<std::string>& Split(const std::string& s, char delim,
}
// Split splits a string using char, returning the result in a vector.
-inline std::vector<std::string> Split(const std::string& s, char delim) {
+inline std::vector<std::string> Split(const std::string &s, char delim) {
std::vector<std::string> elems;
Split(s, delim, &elems);
return elems;
}
// Replace replaces from with to in s.
-inline std::string Replace(std::string s, const std::string& from,
- const std::string& to) {
+inline std::string Replace(std::string s, const std::string &from,
+ const std::string &to) {
size_t start_pos = s.find(from);
if (start_pos == std::string::npos) {
return s;
@@ -74,8 +74,8 @@ inline std::string Replace(std::string s, const std::string& from,
}
// ReplaceAll replaces all instances of search with replace in s.
-inline std::string ReplaceAll(std::string s, const std::string& search,
- const std::string& replace) {
+inline std::string ReplaceAll(std::string s, const std::string &search,
+ const std::string &replace) {
size_t pos = 0;
while ((pos = s.find(search, pos)) != std::string::npos) {
s.replace(pos, search.length(), replace);
@@ -85,8 +85,8 @@ inline std::string ReplaceAll(std::string s, const std::string& search,
}
// ReplacePrefix replaces from with to in s if search is a prefix of s.
-inline bool ReplacePrefix(std::string* s, const std::string& from,
- const std::string& to) {
+inline bool ReplacePrefix(std::string *s, const std::string &from,
+ const std::string &to) {
size_t start_pos = s->find(from);
if (start_pos == std::string::npos || start_pos != 0) {
return false;
@@ -105,8 +105,8 @@ inline std::string CapitalizeFirst(std::string s) {
}
// RubyTypeOf updates a proto type to the required ruby equivalent.
-inline std::string RubyTypeOf(const std::string& a_type,
- const std::string& package) {
+inline std::string RubyTypeOf(const std::string &a_type,
+ const std::string &package) {
std::string res(a_type);
ReplacePrefix(&res, package, ""); // remove the leading package if present
ReplacePrefix(&res, ".", ""); // remove the leading . (no package)
diff --git a/src/compiler/ruby_plugin.cc b/src/compiler/ruby_plugin.cc
index 86c0e11e1c..9397452f55 100644
--- a/src/compiler/ruby_plugin.cc
+++ b/src/compiler/ruby_plugin.cc
@@ -52,10 +52,10 @@ class RubyGrpcGenerator : public google::protobuf::compiler::CodeGenerator {
RubyGrpcGenerator() {}
~RubyGrpcGenerator() override {}
- bool Generate(const google::protobuf::FileDescriptor* file,
- const std::string& parameter,
- google::protobuf::compiler::GeneratorContext* context,
- std::string* error) const override {
+ bool Generate(const google::protobuf::FileDescriptor *file,
+ const std::string &parameter,
+ google::protobuf::compiler::GeneratorContext *context,
+ std::string *error) const override {
std::string code = grpc_ruby_generator::GetServices(file);
if (code.size() == 0) {
return true; // don't generate a file if there are no services
@@ -74,7 +74,7 @@ class RubyGrpcGenerator : public google::protobuf::compiler::CodeGenerator {
}
};
-int main(int argc, char* argv[]) {
+int main(int argc, char *argv[]) {
RubyGrpcGenerator generator;
return google::protobuf::compiler::PluginMain(argc, argv, &generator);
}