@@ -130,7 +130,12 @@ void ServiceGenerator::GenerateInterface(Printer* printer) {
130130 printer->Print (vars_,
131131 " \n "
132132 " private:\n "
133+ #if GOOGLE_PROTOBUF_VERSION < 4022000
133134 " GOOGLE_DISALLOW_EVIL_CONSTRUCTORS($classname$);\n "
135+ #else
136+ " $classname$(const $classname$&) = delete;\n "
137+ " $classname$& operator=(const $classname$&) = delete;\n "
138+ #endif
134139 " };\n "
135140 " \n " );
136141}
@@ -178,7 +183,12 @@ void ServiceGenerator::GenerateStubDefinition(Printer* printer) {
178183 " private:\n "
179184 " ola::rpc::RpcChannel* channel_;\n "
180185 " bool owns_channel_;\n "
186+ #if GOOGLE_PROTOBUF_VERSION < 4022000
181187 " GOOGLE_DISALLOW_EVIL_CONSTRUCTORS($classname$_Stub);\n "
188+ #else
189+ " $classname$_Stub(const $classname$_Stub&) = delete;\n "
190+ " $classname$_Stub& operator=(const $classname$_Stub&) = delete;\n "
191+ #endif
182192 " };\n "
183193 " \n " );
184194}
@@ -291,7 +301,11 @@ void ServiceGenerator::GenerateCallMethod(Printer* printer) {
291301 " const ::google::protobuf::Message* request,\n "
292302 " ::google::protobuf::Message* response,\n "
293303 " ola::rpc::RpcService::CompletionCallback* done) {\n "
304+ #if GOOGLE_PROTOBUF_VERSION < 4022000
294305 " GOOGLE_DCHECK_EQ(method->service(), $classname$_descriptor_);\n "
306+ #else
307+ " ABSL_DCHECK_EQ(method->service(), $classname$_descriptor_);\n "
308+ #endif
295309 " switch (method->index()) {\n " );
296310
297311 for (int i = 0 ; i < descriptor_->method_count (); i++) {
@@ -308,17 +322,28 @@ void ServiceGenerator::GenerateCallMethod(Printer* printer) {
308322 " case $index$:\n "
309323 " $name$(\n "
310324 " controller,\n "
325+ #if GOOGLE_PROTOBUF_VERSION < 4022000
311326 " ::google::protobuf::down_cast<\n "
312327 " const $input_type$*>(request),\n "
313328 " ::google::protobuf::down_cast<\n "
314329 " $output_type$*>(response),\n "
330+ #else
331+ " ::google::protobuf::internal::DownCast<\n "
332+ " const $input_type$*>(request),\n "
333+ " ::google::protobuf::internal::DownCast<\n "
334+ " $output_type$*>(response),\n "
335+ #endif
315336 " done);\n "
316337 " break;\n " );
317338 }
318339
319340 printer->Print (vars_,
320341 " default:\n "
342+ #if GOOGLE_PROTOBUF_VERSION < 4022000
321343 " GOOGLE_LOG(FATAL) << \" Bad method index; this should never "
344+ #else
345+ " ABSL_LOG(FATAL) << \" Bad method index; this should never "
346+ #endif
322347 " happen.\" ;\n "
323348 " break;\n "
324349 " }\n "
@@ -339,7 +364,11 @@ void ServiceGenerator::GenerateGetPrototype(RequestOrResponse which,
339364
340365 printer->Print (vars_,
341366 " const ::google::protobuf::MethodDescriptor* method) const {\n "
367+ #if GOOGLE_PROTOBUF_VERSION < 4022000
342368 " GOOGLE_DCHECK_EQ(method->service(), descriptor());\n "
369+ #else
370+ " ABSL_DCHECK_EQ(method->service(), descriptor());\n "
371+ #endif
343372 " switch (method->index()) {\n " );
344373
345374 for (int i = 0 ; i < descriptor_->method_count (); i++) {
@@ -358,7 +387,11 @@ void ServiceGenerator::GenerateGetPrototype(RequestOrResponse which,
358387
359388 printer->Print (vars_,
360389 " default:\n "
390+ #if GOOGLE_PROTOBUF_VERSION < 4022000
361391 " GOOGLE_LOG(FATAL) << \" Bad method index; this should never happen."
392+ #else
393+ " ABSL_LOG(FATAL) << \" Bad method index; this should never happen."
394+ #endif
362395 " \" ;\n "
363396 " return *static_cast< ::google::protobuf::Message*>(NULL);\n "
364397 " }\n "
0 commit comments