mirror of
https://github.com/google/flatbuffers.git
synced 2026-07-03 09:42:26 +00:00
removed BSD-3-Clause license and Zlib licenses (#7073)
This commit is contained in:
@@ -1,20 +1,3 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!-- Copyright (c) 2013 Google, Inc.
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any damages
|
|
||||||
arising from the use of this software.
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it
|
|
||||||
freely, subject to the following restrictions:
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
|
||||||
claim that you wrote the original software. If you use this software
|
|
||||||
in a product, an acknowledgment in the product documentation would be
|
|
||||||
appreciated but is not required.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
-->
|
|
||||||
<!-- BEGIN_INCLUDE(manifest) -->
|
<!-- BEGIN_INCLUDE(manifest) -->
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.example.FlatBufferTest">
|
package="com.example.FlatBufferTest">
|
||||||
|
|||||||
32
dart/LICENSE
32
dart/LICENSE
@@ -1,35 +1,3 @@
|
|||||||
The code in lib/flat_buffers.dart is based on code that was releases under the
|
|
||||||
following license:
|
|
||||||
|
|
||||||
Copyright 2012, the Dart project authors. All rights reserved.
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are
|
|
||||||
met:
|
|
||||||
* Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
* Redistributions in binary form must reproduce the above
|
|
||||||
copyright notice, this list of conditions and the following
|
|
||||||
disclaimer in the documentation and/or other materials provided
|
|
||||||
with the distribution.
|
|
||||||
* Neither the name of Google Inc. nor the names of its
|
|
||||||
contributors may be used to endorse or promote products derived
|
|
||||||
from this software without specific prior written permission.
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
To the extent permissible, the changes to that code and the other assets in
|
|
||||||
this package are licensed under the Apache2 license:
|
|
||||||
|
|
||||||
|
|
||||||
Apache License
|
Apache License
|
||||||
Version 2.0, January 2004
|
Version 2.0, January 2004
|
||||||
http://www.apache.org/licenses/
|
http://www.apache.org/licenses/
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ package(
|
|||||||
filegroup(
|
filegroup(
|
||||||
name = "common_headers",
|
name = "common_headers",
|
||||||
srcs = [
|
srcs = [
|
||||||
"config.h",
|
|
||||||
"schema_interface.h",
|
"schema_interface.h",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
/*
|
|
||||||
*
|
|
||||||
* Copyright 2015, Google Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are
|
|
||||||
* met:
|
|
||||||
*
|
|
||||||
* * Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* * Redistributions in binary form must reproduce the above
|
|
||||||
* copyright notice, this list of conditions and the following disclaimer
|
|
||||||
* in the documentation and/or other materials provided with the
|
|
||||||
* distribution.
|
|
||||||
* * Neither the name of Google Inc. nor the names of its
|
|
||||||
* contributors may be used to endorse or promote products derived from
|
|
||||||
* this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (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 SRC_COMPILER_CONFIG_H
|
|
||||||
#define SRC_COMPILER_CONFIG_H
|
|
||||||
|
|
||||||
// This file is here only because schema_interface.h, which is copied from gRPC,
|
|
||||||
// includes it. There is nothing for Flatbuffers to configure.
|
|
||||||
|
|
||||||
#endif // SRC_COMPILER_CONFIG_H
|
|
||||||
@@ -1,51 +1,17 @@
|
|||||||
/*
|
#include "src/compiler/cpp_generator.h"
|
||||||
*
|
|
||||||
* Copyright 2015, Google Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are
|
|
||||||
* met:
|
|
||||||
*
|
|
||||||
* * Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* * Redistributions in binary form must reproduce the above
|
|
||||||
* copyright notice, this list of conditions and the following disclaimer
|
|
||||||
* in the documentation and/or other materials provided with the
|
|
||||||
* distribution.
|
|
||||||
* * Neither the name of Google Inc. nor the names of its
|
|
||||||
* contributors may be used to endorse or promote products derived from
|
|
||||||
* this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "src/compiler/cpp_generator.h"
|
|
||||||
#include "flatbuffers/util.h"
|
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
#include "flatbuffers/util.h"
|
||||||
|
|
||||||
namespace grpc_cpp_generator {
|
namespace grpc_cpp_generator {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
grpc::string message_header_ext() { return "_generated.h"; }
|
grpc::string message_header_ext() { return "_generated.h"; }
|
||||||
grpc::string service_header_ext() { return ".grpc.fb.h"; }
|
grpc::string service_header_ext() { return ".grpc.fb.h"; }
|
||||||
|
|
||||||
template <class T>
|
template<class T> grpc::string as_string(T x) {
|
||||||
grpc::string as_string(T x) {
|
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
out << x;
|
out << x;
|
||||||
return out.str();
|
return out.str();
|
||||||
@@ -76,10 +42,7 @@ grpc::string FilenameIdentifier(const grpc::string &filename) {
|
|||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
template <class T, size_t N>
|
template<class T, size_t N> T *array_end(T (&array)[N]) { return array + N; }
|
||||||
T *array_end(T (&array)[N]) {
|
|
||||||
return array + N;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PrintIncludes(grpc_generator::Printer *printer,
|
void PrintIncludes(grpc_generator::Printer *printer,
|
||||||
const std::vector<grpc::string> &headers,
|
const std::vector<grpc::string> &headers,
|
||||||
@@ -92,9 +55,7 @@ void PrintIncludes(grpc_generator::Printer *printer,
|
|||||||
auto &s = params.grpc_search_path;
|
auto &s = params.grpc_search_path;
|
||||||
if (!s.empty()) {
|
if (!s.empty()) {
|
||||||
vars["l"] += s;
|
vars["l"] += s;
|
||||||
if (s[s.size() - 1] != '/') {
|
if (s[s.size() - 1] != '/') { vars["l"] += '/'; }
|
||||||
vars["l"] += '/';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto i = headers.begin(); i != headers.end(); i++) {
|
for (auto i = headers.begin(); i != headers.end(); i++) {
|
||||||
@@ -144,15 +105,16 @@ grpc::string GetHeaderIncludes(grpc_generator::File *file,
|
|||||||
std::map<grpc::string, grpc::string> vars;
|
std::map<grpc::string, grpc::string> vars;
|
||||||
|
|
||||||
static const char *headers_strs[] = {
|
static const char *headers_strs[] = {
|
||||||
"grpcpp/impl/codegen/async_stream.h",
|
"grpcpp/impl/codegen/async_stream.h",
|
||||||
"grpcpp/impl/codegen/async_unary_call.h",
|
"grpcpp/impl/codegen/async_unary_call.h",
|
||||||
"grpcpp/impl/codegen/method_handler.h",
|
"grpcpp/impl/codegen/method_handler.h",
|
||||||
"grpcpp/impl/codegen/proto_utils.h",
|
"grpcpp/impl/codegen/proto_utils.h",
|
||||||
"grpcpp/impl/codegen/rpc_method.h",
|
"grpcpp/impl/codegen/rpc_method.h",
|
||||||
"grpcpp/impl/codegen/service_type.h",
|
"grpcpp/impl/codegen/service_type.h",
|
||||||
"grpcpp/impl/codegen/status.h",
|
"grpcpp/impl/codegen/status.h",
|
||||||
"grpcpp/impl/codegen/stub_options.h",
|
"grpcpp/impl/codegen/stub_options.h",
|
||||||
"grpcpp/impl/codegen/sync_stream.h"};
|
"grpcpp/impl/codegen/sync_stream.h"
|
||||||
|
};
|
||||||
std::vector<grpc::string> headers(headers_strs, array_end(headers_strs));
|
std::vector<grpc::string> headers(headers_strs, array_end(headers_strs));
|
||||||
PrintIncludes(printer.get(), headers, params);
|
PrintIncludes(printer.get(), headers, params);
|
||||||
printer->Print(vars, "\n");
|
printer->Print(vars, "\n");
|
||||||
@@ -187,8 +149,8 @@ void PrintHeaderClientMethodInterfaces(
|
|||||||
grpc::string prefix;
|
grpc::string prefix;
|
||||||
grpc::string method_params; // extra arguments to method
|
grpc::string method_params; // extra arguments to method
|
||||||
grpc::string raw_args; // extra arguments to raw version of method
|
grpc::string raw_args; // extra arguments to raw version of method
|
||||||
} async_prefixes[] = {{"Async", ", void* tag", ", tag"},
|
} async_prefixes[] = { { "Async", ", void* tag", ", tag" },
|
||||||
{"PrepareAsync", "", ""}};
|
{ "PrepareAsync", "", "" } };
|
||||||
|
|
||||||
if (is_public) {
|
if (is_public) {
|
||||||
if (method->NoStreaming()) {
|
if (method->NoStreaming()) {
|
||||||
@@ -196,8 +158,9 @@ void PrintHeaderClientMethodInterfaces(
|
|||||||
*vars,
|
*vars,
|
||||||
"virtual ::grpc::Status $Method$(::grpc::ClientContext* context, "
|
"virtual ::grpc::Status $Method$(::grpc::ClientContext* context, "
|
||||||
"const $Request$& request, $Response$* response) = 0;\n");
|
"const $Request$& request, $Response$* response) = 0;\n");
|
||||||
for (size_t i = 0; i < sizeof(async_prefixes)/sizeof(async_prefixes[0]); i ++) {
|
for (size_t i = 0; i < sizeof(async_prefixes) / sizeof(async_prefixes[0]);
|
||||||
auto& async_prefix = async_prefixes[i];
|
i++) {
|
||||||
|
auto &async_prefix = async_prefixes[i];
|
||||||
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
||||||
printer->Print(
|
printer->Print(
|
||||||
*vars,
|
*vars,
|
||||||
@@ -228,8 +191,9 @@ void PrintHeaderClientMethodInterfaces(
|
|||||||
"($Method$Raw(context, response));\n");
|
"($Method$Raw(context, response));\n");
|
||||||
printer->Outdent();
|
printer->Outdent();
|
||||||
printer->Print("}\n");
|
printer->Print("}\n");
|
||||||
for (size_t i = 0; i < sizeof(async_prefixes)/sizeof(async_prefixes[0]); i ++) {
|
for (size_t i = 0; i < sizeof(async_prefixes) / sizeof(async_prefixes[0]);
|
||||||
auto& async_prefix = async_prefixes[i];
|
i++) {
|
||||||
|
auto &async_prefix = async_prefixes[i];
|
||||||
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
||||||
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
|
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
|
||||||
(*vars)["AsyncRawArgs"] = async_prefix.raw_args;
|
(*vars)["AsyncRawArgs"] = async_prefix.raw_args;
|
||||||
@@ -262,8 +226,9 @@ void PrintHeaderClientMethodInterfaces(
|
|||||||
"($Method$Raw(context, request));\n");
|
"($Method$Raw(context, request));\n");
|
||||||
printer->Outdent();
|
printer->Outdent();
|
||||||
printer->Print("}\n");
|
printer->Print("}\n");
|
||||||
for (size_t i = 0; i < sizeof(async_prefixes)/sizeof(async_prefixes[0]); i ++) {
|
for (size_t i = 0; i < sizeof(async_prefixes) / sizeof(async_prefixes[0]);
|
||||||
auto& async_prefix = async_prefixes[i];
|
i++) {
|
||||||
|
auto &async_prefix = async_prefixes[i];
|
||||||
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
||||||
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
|
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
|
||||||
(*vars)["AsyncRawArgs"] = async_prefix.raw_args;
|
(*vars)["AsyncRawArgs"] = async_prefix.raw_args;
|
||||||
@@ -295,8 +260,9 @@ void PrintHeaderClientMethodInterfaces(
|
|||||||
"$Method$Raw(context));\n");
|
"$Method$Raw(context));\n");
|
||||||
printer->Outdent();
|
printer->Outdent();
|
||||||
printer->Print("}\n");
|
printer->Print("}\n");
|
||||||
for (size_t i = 0; i < sizeof(async_prefixes)/sizeof(async_prefixes[0]); i ++) {
|
for (size_t i = 0; i < sizeof(async_prefixes) / sizeof(async_prefixes[0]);
|
||||||
auto& async_prefix = async_prefixes[i];
|
i++) {
|
||||||
|
auto &async_prefix = async_prefixes[i];
|
||||||
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
||||||
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
|
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
|
||||||
(*vars)["AsyncRawArgs"] = async_prefix.raw_args;
|
(*vars)["AsyncRawArgs"] = async_prefix.raw_args;
|
||||||
@@ -318,8 +284,9 @@ void PrintHeaderClientMethodInterfaces(
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (method->NoStreaming()) {
|
if (method->NoStreaming()) {
|
||||||
for (size_t i = 0; i < sizeof(async_prefixes)/sizeof(async_prefixes[0]); i ++) {
|
for (size_t i = 0; i < sizeof(async_prefixes) / sizeof(async_prefixes[0]);
|
||||||
auto& async_prefix = async_prefixes[i];
|
i++) {
|
||||||
|
auto &async_prefix = async_prefixes[i];
|
||||||
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
||||||
printer->Print(
|
printer->Print(
|
||||||
*vars,
|
*vars,
|
||||||
@@ -334,8 +301,9 @@ void PrintHeaderClientMethodInterfaces(
|
|||||||
"virtual ::grpc::ClientWriterInterface< $Request$>*"
|
"virtual ::grpc::ClientWriterInterface< $Request$>*"
|
||||||
" $Method$Raw("
|
" $Method$Raw("
|
||||||
"::grpc::ClientContext* context, $Response$* response) = 0;\n");
|
"::grpc::ClientContext* context, $Response$* response) = 0;\n");
|
||||||
for (size_t i = 0; i < sizeof(async_prefixes)/sizeof(async_prefixes[0]); i ++) {
|
for (size_t i = 0; i < sizeof(async_prefixes) / sizeof(async_prefixes[0]);
|
||||||
auto& async_prefix = async_prefixes[i];
|
i++) {
|
||||||
|
auto &async_prefix = async_prefixes[i];
|
||||||
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
||||||
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
|
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
|
||||||
printer->Print(
|
printer->Print(
|
||||||
@@ -351,8 +319,9 @@ void PrintHeaderClientMethodInterfaces(
|
|||||||
"virtual ::grpc::ClientReaderInterface< $Response$>* "
|
"virtual ::grpc::ClientReaderInterface< $Response$>* "
|
||||||
"$Method$Raw("
|
"$Method$Raw("
|
||||||
"::grpc::ClientContext* context, const $Request$& request) = 0;\n");
|
"::grpc::ClientContext* context, const $Request$& request) = 0;\n");
|
||||||
for (size_t i = 0; i < sizeof(async_prefixes)/sizeof(async_prefixes[0]); i ++) {
|
for (size_t i = 0; i < sizeof(async_prefixes) / sizeof(async_prefixes[0]);
|
||||||
auto& async_prefix = async_prefixes[i];
|
i++) {
|
||||||
|
auto &async_prefix = async_prefixes[i];
|
||||||
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
||||||
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
|
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
|
||||||
printer->Print(
|
printer->Print(
|
||||||
@@ -367,8 +336,9 @@ void PrintHeaderClientMethodInterfaces(
|
|||||||
"virtual ::grpc::ClientReaderWriterInterface< $Request$, "
|
"virtual ::grpc::ClientReaderWriterInterface< $Request$, "
|
||||||
"$Response$>* "
|
"$Response$>* "
|
||||||
"$Method$Raw(::grpc::ClientContext* context) = 0;\n");
|
"$Method$Raw(::grpc::ClientContext* context) = 0;\n");
|
||||||
for (size_t i = 0; i < sizeof(async_prefixes)/sizeof(async_prefixes[0]); i ++) {
|
for (size_t i = 0; i < sizeof(async_prefixes) / sizeof(async_prefixes[0]);
|
||||||
auto& async_prefix = async_prefixes[i];
|
i++) {
|
||||||
|
auto &async_prefix = async_prefixes[i];
|
||||||
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
||||||
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
|
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
|
||||||
printer->Print(
|
printer->Print(
|
||||||
@@ -393,8 +363,8 @@ void PrintHeaderClientMethod(grpc_generator::Printer *printer,
|
|||||||
grpc::string prefix;
|
grpc::string prefix;
|
||||||
grpc::string method_params; // extra arguments to method
|
grpc::string method_params; // extra arguments to method
|
||||||
grpc::string raw_args; // extra arguments to raw version of method
|
grpc::string raw_args; // extra arguments to raw version of method
|
||||||
} async_prefixes[] = {{"Async", ", void* tag", ", tag"},
|
} async_prefixes[] = { { "Async", ", void* tag", ", tag" },
|
||||||
{"PrepareAsync", "", ""}};
|
{ "PrepareAsync", "", "" } };
|
||||||
|
|
||||||
if (is_public) {
|
if (is_public) {
|
||||||
if (method->NoStreaming()) {
|
if (method->NoStreaming()) {
|
||||||
@@ -402,8 +372,9 @@ void PrintHeaderClientMethod(grpc_generator::Printer *printer,
|
|||||||
*vars,
|
*vars,
|
||||||
"::grpc::Status $Method$(::grpc::ClientContext* context, "
|
"::grpc::Status $Method$(::grpc::ClientContext* context, "
|
||||||
"const $Request$& request, $Response$* response) override;\n");
|
"const $Request$& request, $Response$* response) override;\n");
|
||||||
for (size_t i = 0; i < sizeof(async_prefixes)/sizeof(async_prefixes[0]); i ++) {
|
for (size_t i = 0; i < sizeof(async_prefixes) / sizeof(async_prefixes[0]);
|
||||||
auto& async_prefix = async_prefixes[i];
|
i++) {
|
||||||
|
auto &async_prefix = async_prefixes[i];
|
||||||
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
||||||
printer->Print(
|
printer->Print(
|
||||||
*vars,
|
*vars,
|
||||||
@@ -431,8 +402,9 @@ void PrintHeaderClientMethod(grpc_generator::Printer *printer,
|
|||||||
"($Method$Raw(context, response));\n");
|
"($Method$Raw(context, response));\n");
|
||||||
printer->Outdent();
|
printer->Outdent();
|
||||||
printer->Print("}\n");
|
printer->Print("}\n");
|
||||||
for (size_t i = 0; i < sizeof(async_prefixes)/sizeof(async_prefixes[0]); i ++) {
|
for (size_t i = 0; i < sizeof(async_prefixes) / sizeof(async_prefixes[0]);
|
||||||
auto& async_prefix = async_prefixes[i];
|
i++) {
|
||||||
|
auto &async_prefix = async_prefixes[i];
|
||||||
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
||||||
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
|
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
|
||||||
(*vars)["AsyncRawArgs"] = async_prefix.raw_args;
|
(*vars)["AsyncRawArgs"] = async_prefix.raw_args;
|
||||||
@@ -463,8 +435,9 @@ void PrintHeaderClientMethod(grpc_generator::Printer *printer,
|
|||||||
"($Method$Raw(context, request));\n");
|
"($Method$Raw(context, request));\n");
|
||||||
printer->Outdent();
|
printer->Outdent();
|
||||||
printer->Print("}\n");
|
printer->Print("}\n");
|
||||||
for (size_t i = 0; i < sizeof(async_prefixes)/sizeof(async_prefixes[0]); i ++) {
|
for (size_t i = 0; i < sizeof(async_prefixes) / sizeof(async_prefixes[0]);
|
||||||
auto& async_prefix = async_prefixes[i];
|
i++) {
|
||||||
|
auto &async_prefix = async_prefixes[i];
|
||||||
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
||||||
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
|
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
|
||||||
(*vars)["AsyncRawArgs"] = async_prefix.raw_args;
|
(*vars)["AsyncRawArgs"] = async_prefix.raw_args;
|
||||||
@@ -494,8 +467,9 @@ void PrintHeaderClientMethod(grpc_generator::Printer *printer,
|
|||||||
"$Method$Raw(context));\n");
|
"$Method$Raw(context));\n");
|
||||||
printer->Outdent();
|
printer->Outdent();
|
||||||
printer->Print("}\n");
|
printer->Print("}\n");
|
||||||
for (size_t i = 0; i < sizeof(async_prefixes)/sizeof(async_prefixes[0]); i ++) {
|
for (size_t i = 0; i < sizeof(async_prefixes) / sizeof(async_prefixes[0]);
|
||||||
auto& async_prefix = async_prefixes[i];
|
i++) {
|
||||||
|
auto &async_prefix = async_prefixes[i];
|
||||||
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
||||||
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
|
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
|
||||||
(*vars)["AsyncRawArgs"] = async_prefix.raw_args;
|
(*vars)["AsyncRawArgs"] = async_prefix.raw_args;
|
||||||
@@ -516,8 +490,9 @@ void PrintHeaderClientMethod(grpc_generator::Printer *printer,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (method->NoStreaming()) {
|
if (method->NoStreaming()) {
|
||||||
for (size_t i = 0; i < sizeof(async_prefixes)/sizeof(async_prefixes[0]); i ++) {
|
for (size_t i = 0; i < sizeof(async_prefixes) / sizeof(async_prefixes[0]);
|
||||||
auto& async_prefix = async_prefixes[i];
|
i++) {
|
||||||
|
auto &async_prefix = async_prefixes[i];
|
||||||
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
||||||
printer->Print(
|
printer->Print(
|
||||||
*vars,
|
*vars,
|
||||||
@@ -531,8 +506,9 @@ void PrintHeaderClientMethod(grpc_generator::Printer *printer,
|
|||||||
"::grpc::ClientWriter< $Request$>* $Method$Raw("
|
"::grpc::ClientWriter< $Request$>* $Method$Raw("
|
||||||
"::grpc::ClientContext* context, $Response$* response) "
|
"::grpc::ClientContext* context, $Response$* response) "
|
||||||
"override;\n");
|
"override;\n");
|
||||||
for (size_t i = 0; i < sizeof(async_prefixes)/sizeof(async_prefixes[0]); i ++) {
|
for (size_t i = 0; i < sizeof(async_prefixes) / sizeof(async_prefixes[0]);
|
||||||
auto& async_prefix = async_prefixes[i];
|
i++) {
|
||||||
|
auto &async_prefix = async_prefixes[i];
|
||||||
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
||||||
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
|
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
|
||||||
(*vars)["AsyncRawArgs"] = async_prefix.raw_args;
|
(*vars)["AsyncRawArgs"] = async_prefix.raw_args;
|
||||||
@@ -547,8 +523,9 @@ void PrintHeaderClientMethod(grpc_generator::Printer *printer,
|
|||||||
"::grpc::ClientReader< $Response$>* $Method$Raw("
|
"::grpc::ClientReader< $Response$>* $Method$Raw("
|
||||||
"::grpc::ClientContext* context, const $Request$& request)"
|
"::grpc::ClientContext* context, const $Request$& request)"
|
||||||
" override;\n");
|
" override;\n");
|
||||||
for (size_t i = 0; i < sizeof(async_prefixes)/sizeof(async_prefixes[0]); i ++) {
|
for (size_t i = 0; i < sizeof(async_prefixes) / sizeof(async_prefixes[0]);
|
||||||
auto& async_prefix = async_prefixes[i];
|
i++) {
|
||||||
|
auto &async_prefix = async_prefixes[i];
|
||||||
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
||||||
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
|
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
|
||||||
(*vars)["AsyncRawArgs"] = async_prefix.raw_args;
|
(*vars)["AsyncRawArgs"] = async_prefix.raw_args;
|
||||||
@@ -562,8 +539,9 @@ void PrintHeaderClientMethod(grpc_generator::Printer *printer,
|
|||||||
printer->Print(*vars,
|
printer->Print(*vars,
|
||||||
"::grpc::ClientReaderWriter< $Request$, $Response$>* "
|
"::grpc::ClientReaderWriter< $Request$, $Response$>* "
|
||||||
"$Method$Raw(::grpc::ClientContext* context) override;\n");
|
"$Method$Raw(::grpc::ClientContext* context) override;\n");
|
||||||
for (size_t i = 0; i < sizeof(async_prefixes)/sizeof(async_prefixes[0]); i ++) {
|
for (size_t i = 0; i < sizeof(async_prefixes) / sizeof(async_prefixes[0]);
|
||||||
auto& async_prefix = async_prefixes[i];
|
i++) {
|
||||||
|
auto &async_prefix = async_prefixes[i];
|
||||||
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
||||||
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
|
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
|
||||||
(*vars)["AsyncRawArgs"] = async_prefix.raw_args;
|
(*vars)["AsyncRawArgs"] = async_prefix.raw_args;
|
||||||
@@ -630,7 +608,8 @@ void PrintHeaderServerMethodAsync(grpc_generator::Printer *printer,
|
|||||||
"class WithAsyncMethod_$Method$ : public BaseClass {\n");
|
"class WithAsyncMethod_$Method$ : public BaseClass {\n");
|
||||||
printer->Print(
|
printer->Print(
|
||||||
" private:\n"
|
" private:\n"
|
||||||
" void BaseClassMustBeDerivedFromService(const Service */*service*/) {}\n");
|
" void BaseClassMustBeDerivedFromService(const Service */*service*/) "
|
||||||
|
"{}\n");
|
||||||
printer->Print(" public:\n");
|
printer->Print(" public:\n");
|
||||||
printer->Indent();
|
printer->Indent();
|
||||||
printer->Print(*vars,
|
printer->Print(*vars,
|
||||||
@@ -849,7 +828,8 @@ void PrintHeaderServerMethodGeneric(
|
|||||||
"class WithGenericMethod_$Method$ : public BaseClass {\n");
|
"class WithGenericMethod_$Method$ : public BaseClass {\n");
|
||||||
printer->Print(
|
printer->Print(
|
||||||
" private:\n"
|
" private:\n"
|
||||||
" void BaseClassMustBeDerivedFromService(const Service */*service*/) {}\n");
|
" void BaseClassMustBeDerivedFromService(const Service */*service*/) "
|
||||||
|
"{}\n");
|
||||||
printer->Print(" public:\n");
|
printer->Print(" public:\n");
|
||||||
printer->Indent();
|
printer->Indent();
|
||||||
printer->Print(*vars,
|
printer->Print(*vars,
|
||||||
@@ -1001,9 +981,7 @@ void PrintHeaderService(grpc_generator::Printer *printer,
|
|||||||
printer->Print(*vars, "WithAsyncMethod_$method_name$<");
|
printer->Print(*vars, "WithAsyncMethod_$method_name$<");
|
||||||
}
|
}
|
||||||
printer->Print("Service");
|
printer->Print("Service");
|
||||||
for (int i = 0; i < service->method_count(); ++i) {
|
for (int i = 0; i < service->method_count(); ++i) { printer->Print(" >"); }
|
||||||
printer->Print(" >");
|
|
||||||
}
|
|
||||||
printer->Print(" AsyncService;\n");
|
printer->Print(" AsyncService;\n");
|
||||||
|
|
||||||
// Server side - Generic
|
// Server side - Generic
|
||||||
@@ -1028,9 +1006,7 @@ void PrintHeaderService(grpc_generator::Printer *printer,
|
|||||||
}
|
}
|
||||||
printer->Print("Service");
|
printer->Print("Service");
|
||||||
for (int i = 0; i < service->method_count(); ++i) {
|
for (int i = 0; i < service->method_count(); ++i) {
|
||||||
if (service->method(i)->NoStreaming()) {
|
if (service->method(i)->NoStreaming()) { printer->Print(" >"); }
|
||||||
printer->Print(" >");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
printer->Print(" StreamedUnaryService;\n");
|
printer->Print(" StreamedUnaryService;\n");
|
||||||
|
|
||||||
@@ -1052,9 +1028,7 @@ void PrintHeaderService(grpc_generator::Printer *printer,
|
|||||||
printer->Print("Service");
|
printer->Print("Service");
|
||||||
for (int i = 0; i < service->method_count(); ++i) {
|
for (int i = 0; i < service->method_count(); ++i) {
|
||||||
auto method = service->method(i);
|
auto method = service->method(i);
|
||||||
if (ServerOnlyStreaming(method.get())) {
|
if (ServerOnlyStreaming(method.get())) { printer->Print(" >"); }
|
||||||
printer->Print(" >");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
printer->Print(" SplitStreamedService;\n");
|
printer->Print(" SplitStreamedService;\n");
|
||||||
|
|
||||||
@@ -1095,9 +1069,7 @@ grpc::string GetHeaderServices(grpc_generator::File *file,
|
|||||||
// Package string is empty or ends with a dot. It is used to fully qualify
|
// Package string is empty or ends with a dot. It is used to fully qualify
|
||||||
// method names.
|
// method names.
|
||||||
vars["Package"] = file->package();
|
vars["Package"] = file->package();
|
||||||
if (!file->package().empty()) {
|
if (!file->package().empty()) { vars["Package"].append("."); }
|
||||||
vars["Package"].append(".");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!params.services_namespace.empty()) {
|
if (!params.services_namespace.empty()) {
|
||||||
vars["services_namespace"] = params.services_namespace;
|
vars["services_namespace"] = params.services_namespace;
|
||||||
@@ -1179,14 +1151,15 @@ grpc::string GetSourceIncludes(grpc_generator::File *file,
|
|||||||
std::map<grpc::string, grpc::string> vars;
|
std::map<grpc::string, grpc::string> vars;
|
||||||
|
|
||||||
static const char *headers_strs[] = {
|
static const char *headers_strs[] = {
|
||||||
"grpcpp/impl/codegen/async_stream.h",
|
"grpcpp/impl/codegen/async_stream.h",
|
||||||
"grpcpp/impl/codegen/async_unary_call.h",
|
"grpcpp/impl/codegen/async_unary_call.h",
|
||||||
"grpcpp/impl/codegen/channel_interface.h",
|
"grpcpp/impl/codegen/channel_interface.h",
|
||||||
"grpcpp/impl/codegen/client_unary_call.h",
|
"grpcpp/impl/codegen/client_unary_call.h",
|
||||||
"grpcpp/impl/codegen/method_handler.h",
|
"grpcpp/impl/codegen/method_handler.h",
|
||||||
"grpcpp/impl/codegen/rpc_service_method.h",
|
"grpcpp/impl/codegen/rpc_service_method.h",
|
||||||
"grpcpp/impl/codegen/service_type.h",
|
"grpcpp/impl/codegen/service_type.h",
|
||||||
"grpcpp/impl/codegen/sync_stream.h"};
|
"grpcpp/impl/codegen/sync_stream.h"
|
||||||
|
};
|
||||||
std::vector<grpc::string> headers(headers_strs, array_end(headers_strs));
|
std::vector<grpc::string> headers(headers_strs, array_end(headers_strs));
|
||||||
PrintIncludes(printer.get(), headers, params);
|
PrintIncludes(printer.get(), headers, params);
|
||||||
|
|
||||||
@@ -1215,8 +1188,8 @@ void PrintSourceClientMethod(grpc_generator::Printer *printer,
|
|||||||
grpc::string start; // bool literal expressed as string
|
grpc::string start; // bool literal expressed as string
|
||||||
grpc::string method_params; // extra arguments to method
|
grpc::string method_params; // extra arguments to method
|
||||||
grpc::string create_args; // extra arguments to creator
|
grpc::string create_args; // extra arguments to creator
|
||||||
} async_prefixes[] = {{"Async", "true", ", void* tag", ", tag"},
|
} async_prefixes[] = { { "Async", "true", ", void* tag", ", tag" },
|
||||||
{"PrepareAsync", "false", "", ", nullptr"}};
|
{ "PrepareAsync", "false", "", ", nullptr" } };
|
||||||
if (method->NoStreaming()) {
|
if (method->NoStreaming()) {
|
||||||
printer->Print(*vars,
|
printer->Print(*vars,
|
||||||
"::grpc::Status $ns$$Service$::Stub::$Method$("
|
"::grpc::Status $ns$$Service$::Stub::$Method$("
|
||||||
@@ -1226,8 +1199,9 @@ void PrintSourceClientMethod(grpc_generator::Printer *printer,
|
|||||||
" return ::grpc::internal::BlockingUnaryCall"
|
" return ::grpc::internal::BlockingUnaryCall"
|
||||||
"(channel_.get(), rpcmethod_$Method$_, "
|
"(channel_.get(), rpcmethod_$Method$_, "
|
||||||
"context, request, response);\n}\n\n");
|
"context, request, response);\n}\n\n");
|
||||||
for (size_t i = 0; i < sizeof(async_prefixes)/sizeof(async_prefixes[0]); i ++) {
|
for (size_t i = 0; i < sizeof(async_prefixes) / sizeof(async_prefixes[0]);
|
||||||
auto& async_prefix = async_prefixes[i];
|
i++) {
|
||||||
|
auto &async_prefix = async_prefixes[i];
|
||||||
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
||||||
(*vars)["AsyncStart"] = async_prefix.start;
|
(*vars)["AsyncStart"] = async_prefix.start;
|
||||||
printer->Print(*vars,
|
printer->Print(*vars,
|
||||||
@@ -1257,8 +1231,9 @@ void PrintSourceClientMethod(grpc_generator::Printer *printer,
|
|||||||
"rpcmethod_$Method$_, "
|
"rpcmethod_$Method$_, "
|
||||||
"context, response);\n"
|
"context, response);\n"
|
||||||
"}\n\n");
|
"}\n\n");
|
||||||
for (size_t i = 0; i < sizeof(async_prefixes)/sizeof(async_prefixes[0]); i ++) {
|
for (size_t i = 0; i < sizeof(async_prefixes) / sizeof(async_prefixes[0]);
|
||||||
auto& async_prefix = async_prefixes[i];
|
i++) {
|
||||||
|
auto &async_prefix = async_prefixes[i];
|
||||||
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
||||||
(*vars)["AsyncStart"] = async_prefix.start;
|
(*vars)["AsyncStart"] = async_prefix.start;
|
||||||
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
|
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
|
||||||
@@ -1289,8 +1264,9 @@ void PrintSourceClientMethod(grpc_generator::Printer *printer,
|
|||||||
"rpcmethod_$Method$_, "
|
"rpcmethod_$Method$_, "
|
||||||
"context, request);\n"
|
"context, request);\n"
|
||||||
"}\n\n");
|
"}\n\n");
|
||||||
for (size_t i = 0; i < sizeof(async_prefixes)/sizeof(async_prefixes[0]); i ++) {
|
for (size_t i = 0; i < sizeof(async_prefixes) / sizeof(async_prefixes[0]);
|
||||||
auto& async_prefix = async_prefixes[i];
|
i++) {
|
||||||
|
auto &async_prefix = async_prefixes[i];
|
||||||
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
||||||
(*vars)["AsyncStart"] = async_prefix.start;
|
(*vars)["AsyncStart"] = async_prefix.start;
|
||||||
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
|
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
|
||||||
@@ -1321,8 +1297,9 @@ void PrintSourceClientMethod(grpc_generator::Printer *printer,
|
|||||||
"rpcmethod_$Method$_, "
|
"rpcmethod_$Method$_, "
|
||||||
"context);\n"
|
"context);\n"
|
||||||
"}\n\n");
|
"}\n\n");
|
||||||
for (size_t i = 0; i < sizeof(async_prefixes)/sizeof(async_prefixes[0]); i ++) {
|
for (size_t i = 0; i < sizeof(async_prefixes) / sizeof(async_prefixes[0]);
|
||||||
auto& async_prefix = async_prefixes[i];
|
i++) {
|
||||||
|
auto &async_prefix = async_prefixes[i];
|
||||||
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
||||||
(*vars)["AsyncStart"] = async_prefix.start;
|
(*vars)["AsyncStart"] = async_prefix.start;
|
||||||
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
|
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
|
||||||
@@ -1351,10 +1328,11 @@ void PrintSourceServerMethod(grpc_generator::Printer *printer,
|
|||||||
(*vars)["Request"] = method->input_type_name();
|
(*vars)["Request"] = method->input_type_name();
|
||||||
(*vars)["Response"] = method->output_type_name();
|
(*vars)["Response"] = method->output_type_name();
|
||||||
if (method->NoStreaming()) {
|
if (method->NoStreaming()) {
|
||||||
printer->Print(*vars,
|
printer->Print(
|
||||||
"::grpc::Status $ns$$Service$::Service::$Method$("
|
*vars,
|
||||||
"::grpc::ServerContext* /*context*/, "
|
"::grpc::Status $ns$$Service$::Service::$Method$("
|
||||||
"const $Request$* /*request*/, $Response$* /*response*/) {\n");
|
"::grpc::ServerContext* /*context*/, "
|
||||||
|
"const $Request$* /*request*/, $Response$* /*response*/) {\n");
|
||||||
printer->Print(
|
printer->Print(
|
||||||
" return ::grpc::Status("
|
" return ::grpc::Status("
|
||||||
"::grpc::StatusCode::UNIMPLEMENTED, \"\");\n");
|
"::grpc::StatusCode::UNIMPLEMENTED, \"\");\n");
|
||||||
@@ -1519,9 +1497,7 @@ grpc::string GetSourceServices(grpc_generator::File *file,
|
|||||||
// Package string is empty or ends with a dot. It is used to fully qualify
|
// Package string is empty or ends with a dot. It is used to fully qualify
|
||||||
// method names.
|
// method names.
|
||||||
vars["Package"] = file->package();
|
vars["Package"] = file->package();
|
||||||
if (!file->package().empty()) {
|
if (!file->package().empty()) { vars["Package"].append("."); }
|
||||||
vars["Package"].append(".");
|
|
||||||
}
|
|
||||||
if (!params.services_namespace.empty()) {
|
if (!params.services_namespace.empty()) {
|
||||||
vars["ns"] = params.services_namespace + "::";
|
vars["ns"] = params.services_namespace + "::";
|
||||||
vars["prefix"] = params.services_namespace;
|
vars["prefix"] = params.services_namespace;
|
||||||
@@ -1593,9 +1569,9 @@ grpc::string GetMockIncludes(grpc_generator::File *file,
|
|||||||
std::map<grpc::string, grpc::string> vars;
|
std::map<grpc::string, grpc::string> vars;
|
||||||
|
|
||||||
static const char *headers_strs[] = {
|
static const char *headers_strs[] = {
|
||||||
"grpcpp/impl/codegen/async_stream.h",
|
"grpcpp/impl/codegen/async_stream.h",
|
||||||
"grpcpp/impl/codegen/sync_stream.h",
|
"grpcpp/impl/codegen/sync_stream.h",
|
||||||
"gmock/gmock.h",
|
"gmock/gmock.h",
|
||||||
};
|
};
|
||||||
std::vector<grpc::string> headers(headers_strs, array_end(headers_strs));
|
std::vector<grpc::string> headers(headers_strs, array_end(headers_strs));
|
||||||
PrintIncludes(printer.get(), headers, params);
|
PrintIncludes(printer.get(), headers, params);
|
||||||
@@ -1625,15 +1601,17 @@ void PrintMockClientMethods(grpc_generator::Printer *printer,
|
|||||||
grpc::string prefix;
|
grpc::string prefix;
|
||||||
grpc::string method_params; // extra arguments to method
|
grpc::string method_params; // extra arguments to method
|
||||||
int extra_method_param_count;
|
int extra_method_param_count;
|
||||||
} async_prefixes[] = {{"Async", ", void* tag", 1}, {"PrepareAsync", "", 0}};
|
} async_prefixes[] = { { "Async", ", void* tag", 1 },
|
||||||
|
{ "PrepareAsync", "", 0 } };
|
||||||
|
|
||||||
if (method->NoStreaming()) {
|
if (method->NoStreaming()) {
|
||||||
printer->Print(
|
printer->Print(
|
||||||
*vars,
|
*vars,
|
||||||
"MOCK_METHOD3($Method$, ::grpc::Status(::grpc::ClientContext* context, "
|
"MOCK_METHOD3($Method$, ::grpc::Status(::grpc::ClientContext* context, "
|
||||||
"const $Request$& request, $Response$* response));\n");
|
"const $Request$& request, $Response$* response));\n");
|
||||||
for (size_t i = 0; i < sizeof(async_prefixes)/sizeof(async_prefixes[0]); i ++) {
|
for (size_t i = 0; i < sizeof(async_prefixes) / sizeof(async_prefixes[0]);
|
||||||
auto& async_prefix = async_prefixes[i];
|
i++) {
|
||||||
|
auto &async_prefix = async_prefixes[i];
|
||||||
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
||||||
printer->Print(
|
printer->Print(
|
||||||
*vars,
|
*vars,
|
||||||
@@ -1648,12 +1626,13 @@ void PrintMockClientMethods(grpc_generator::Printer *printer,
|
|||||||
"MOCK_METHOD2($Method$Raw, "
|
"MOCK_METHOD2($Method$Raw, "
|
||||||
"::grpc::ClientWriterInterface< $Request$>*"
|
"::grpc::ClientWriterInterface< $Request$>*"
|
||||||
"(::grpc::ClientContext* context, $Response$* response));\n");
|
"(::grpc::ClientContext* context, $Response$* response));\n");
|
||||||
for (size_t i = 0; i < sizeof(async_prefixes)/sizeof(async_prefixes[0]); i ++) {
|
for (size_t i = 0; i < sizeof(async_prefixes) / sizeof(async_prefixes[0]);
|
||||||
auto& async_prefix = async_prefixes[i];
|
i++) {
|
||||||
|
auto &async_prefix = async_prefixes[i];
|
||||||
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
||||||
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
|
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
|
||||||
(*vars)["MockArgs"] =
|
(*vars)["MockArgs"] =
|
||||||
flatbuffers::NumToString(3 + async_prefix.extra_method_param_count);
|
flatbuffers::NumToString(3 + async_prefix.extra_method_param_count);
|
||||||
printer->Print(*vars,
|
printer->Print(*vars,
|
||||||
"MOCK_METHOD$MockArgs$($AsyncPrefix$$Method$Raw, "
|
"MOCK_METHOD$MockArgs$($AsyncPrefix$$Method$Raw, "
|
||||||
"::grpc::ClientAsyncWriterInterface< $Request$>*"
|
"::grpc::ClientAsyncWriterInterface< $Request$>*"
|
||||||
@@ -1666,8 +1645,9 @@ void PrintMockClientMethods(grpc_generator::Printer *printer,
|
|||||||
"MOCK_METHOD2($Method$Raw, "
|
"MOCK_METHOD2($Method$Raw, "
|
||||||
"::grpc::ClientReaderInterface< $Response$>*"
|
"::grpc::ClientReaderInterface< $Response$>*"
|
||||||
"(::grpc::ClientContext* context, const $Request$& request));\n");
|
"(::grpc::ClientContext* context, const $Request$& request));\n");
|
||||||
for (size_t i = 0; i < sizeof(async_prefixes)/sizeof(async_prefixes[0]); i ++) {
|
for (size_t i = 0; i < sizeof(async_prefixes) / sizeof(async_prefixes[0]);
|
||||||
auto& async_prefix = async_prefixes[i];
|
i++) {
|
||||||
|
auto &async_prefix = async_prefixes[i];
|
||||||
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
||||||
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
|
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
|
||||||
(*vars)["MockArgs"] =
|
(*vars)["MockArgs"] =
|
||||||
@@ -1685,8 +1665,9 @@ void PrintMockClientMethods(grpc_generator::Printer *printer,
|
|||||||
"MOCK_METHOD1($Method$Raw, "
|
"MOCK_METHOD1($Method$Raw, "
|
||||||
"::grpc::ClientReaderWriterInterface< $Request$, $Response$>*"
|
"::grpc::ClientReaderWriterInterface< $Request$, $Response$>*"
|
||||||
"(::grpc::ClientContext* context));\n");
|
"(::grpc::ClientContext* context));\n");
|
||||||
for (size_t i = 0; i < sizeof(async_prefixes)/sizeof(async_prefixes[0]); i ++) {
|
for (size_t i = 0; i < sizeof(async_prefixes) / sizeof(async_prefixes[0]);
|
||||||
auto& async_prefix = async_prefixes[i];
|
i++) {
|
||||||
|
auto &async_prefix = async_prefixes[i];
|
||||||
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
||||||
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
|
(*vars)["AsyncMethodParams"] = async_prefix.method_params;
|
||||||
(*vars)["MockArgs"] =
|
(*vars)["MockArgs"] =
|
||||||
@@ -1727,9 +1708,7 @@ grpc::string GetMockServices(grpc_generator::File *file,
|
|||||||
// Package string is empty or ends with a dot. It is used to fully qualify
|
// Package string is empty or ends with a dot. It is used to fully qualify
|
||||||
// method names.
|
// method names.
|
||||||
vars["Package"] = file->package();
|
vars["Package"] = file->package();
|
||||||
if (!file->package().empty()) {
|
if (!file->package().empty()) { vars["Package"].append("."); }
|
||||||
vars["Package"].append(".");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!params.services_namespace.empty()) {
|
if (!params.services_namespace.empty()) {
|
||||||
vars["services_namespace"] = params.services_namespace;
|
vars["services_namespace"] = params.services_namespace;
|
||||||
|
|||||||
@@ -1,36 +1,3 @@
|
|||||||
/*
|
|
||||||
*
|
|
||||||
* Copyright 2015, Google Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are
|
|
||||||
* met:
|
|
||||||
*
|
|
||||||
* * Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* * Redistributions in binary form must reproduce the above
|
|
||||||
* copyright notice, this list of conditions and the following disclaimer
|
|
||||||
* in the documentation and/or other materials provided with the
|
|
||||||
* distribution.
|
|
||||||
* * Neither the name of Google Inc. nor the names of its
|
|
||||||
* contributors may be used to endorse or promote products derived from
|
|
||||||
* this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (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 GRPC_INTERNAL_COMPILER_CPP_GENERATOR_H
|
#ifndef GRPC_INTERNAL_COMPILER_CPP_GENERATOR_H
|
||||||
#define GRPC_INTERNAL_COMPILER_CPP_GENERATOR_H
|
#define GRPC_INTERNAL_COMPILER_CPP_GENERATOR_H
|
||||||
|
|
||||||
@@ -41,12 +8,11 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "src/compiler/config.h"
|
|
||||||
#include "src/compiler/schema_interface.h"
|
#include "src/compiler/schema_interface.h"
|
||||||
|
|
||||||
#ifndef GRPC_CUSTOM_STRING
|
#ifndef GRPC_CUSTOM_STRING
|
||||||
#include <string>
|
# include <string>
|
||||||
#define GRPC_CUSTOM_STRING std::string
|
# define GRPC_CUSTOM_STRING std::string
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace grpc {
|
namespace grpc {
|
||||||
|
|||||||
@@ -1,47 +1,13 @@
|
|||||||
/*
|
|
||||||
*
|
|
||||||
* Copyright 2015, Google Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are
|
|
||||||
* met:
|
|
||||||
*
|
|
||||||
* * Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* * Redistributions in binary form must reproduce the above
|
|
||||||
* copyright notice, this list of conditions and the following disclaimer
|
|
||||||
* in the documentation AN/or other materials provided with the
|
|
||||||
* distribution.
|
|
||||||
* * Neither the name of Google Inc. nor the names of its
|
|
||||||
* contributors may be used to endorse or promote products derived from
|
|
||||||
* this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <map>
|
|
||||||
#include <cctype>
|
|
||||||
#include <sstream>
|
|
||||||
|
|
||||||
#include "src/compiler/go_generator.h"
|
#include "src/compiler/go_generator.h"
|
||||||
|
|
||||||
template <class T>
|
#include <cctype>
|
||||||
grpc::string as_string(T x) {
|
#include <map>
|
||||||
std::ostringstream out;
|
#include <sstream>
|
||||||
out << x;
|
|
||||||
return out.str();
|
template<class T> grpc::string as_string(T x) {
|
||||||
|
std::ostringstream out;
|
||||||
|
out << x;
|
||||||
|
return out.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool ClientOnlyStreaming(const grpc_generator::Method *method) {
|
inline bool ClientOnlyStreaming(const grpc_generator::Method *method) {
|
||||||
@@ -56,18 +22,16 @@ namespace grpc_go_generator {
|
|||||||
|
|
||||||
// Returns string with first letter to lowerCase
|
// Returns string with first letter to lowerCase
|
||||||
grpc::string unexportName(grpc::string s) {
|
grpc::string unexportName(grpc::string s) {
|
||||||
if (s.empty())
|
if (s.empty()) return s;
|
||||||
return s;
|
s[0] = static_cast<char>(std::tolower(s[0]));
|
||||||
s[0] = static_cast<char>(std::tolower(s[0]));
|
return s;
|
||||||
return s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns string with first letter to uppercase
|
// Returns string with first letter to uppercase
|
||||||
grpc::string exportName(grpc::string s) {
|
grpc::string exportName(grpc::string s) {
|
||||||
if (s.empty())
|
if (s.empty()) return s;
|
||||||
return s;
|
s[0] = static_cast<char>(std::toupper(s[0]));
|
||||||
s[0] = static_cast<char>(std::toupper(s[0]));
|
return s;
|
||||||
return s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenerateError(grpc_generator::Printer *printer,
|
void GenerateError(grpc_generator::Printer *printer,
|
||||||
@@ -82,50 +46,65 @@ void GenerateError(grpc_generator::Printer *printer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Generates imports for the service
|
// Generates imports for the service
|
||||||
void GenerateImports(grpc_generator::File *file, grpc_generator::Printer *printer,
|
void GenerateImports(grpc_generator::File *file,
|
||||||
|
grpc_generator::Printer *printer,
|
||||||
std::map<grpc::string, grpc::string> vars) {
|
std::map<grpc::string, grpc::string> vars) {
|
||||||
vars["filename"] = file->filename();
|
vars["filename"] = file->filename();
|
||||||
printer->Print("//Generated by gRPC Go plugin\n");
|
printer->Print("//Generated by gRPC Go plugin\n");
|
||||||
printer->Print("//If you make any local changes, they will be lost\n");
|
printer->Print("//If you make any local changes, they will be lost\n");
|
||||||
printer->Print(vars, "//source: $filename$\n\n");
|
printer->Print(vars, "//source: $filename$\n\n");
|
||||||
printer->Print(vars, "package $Package$\n\n");
|
printer->Print(vars, "package $Package$\n\n");
|
||||||
printer->Print("import (\n");
|
printer->Print("import (\n");
|
||||||
printer->Indent();
|
printer->Indent();
|
||||||
printer->Print(vars, "$context$ \"context\"\n");
|
printer->Print(vars, "$context$ \"context\"\n");
|
||||||
printer->Print("flatbuffers \"github.com/google/flatbuffers/go\"\n");
|
printer->Print("flatbuffers \"github.com/google/flatbuffers/go\"\n");
|
||||||
printer->Print(vars, "$grpc$ \"google.golang.org/grpc\"\n");
|
printer->Print(vars, "$grpc$ \"google.golang.org/grpc\"\n");
|
||||||
printer->Print("\"google.golang.org/grpc/codes\"\n");
|
printer->Print("\"google.golang.org/grpc/codes\"\n");
|
||||||
printer->Print("\"google.golang.org/grpc/status\"\n");
|
printer->Print("\"google.golang.org/grpc/status\"\n");
|
||||||
printer->Outdent();
|
printer->Outdent();
|
||||||
printer->Print(")\n\n");
|
printer->Print(")\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generates Server method signature source
|
// Generates Server method signature source
|
||||||
void GenerateServerMethodSignature(const grpc_generator::Method *method, grpc_generator::Printer *printer,
|
void GenerateServerMethodSignature(const grpc_generator::Method *method,
|
||||||
|
grpc_generator::Printer *printer,
|
||||||
std::map<grpc::string, grpc::string> vars) {
|
std::map<grpc::string, grpc::string> vars) {
|
||||||
vars["Method"] = exportName(method->name());
|
vars["Method"] = exportName(method->name());
|
||||||
vars["Request"] = method->get_input_type_name();
|
vars["Request"] = method->get_input_type_name();
|
||||||
vars["Response"] = (vars["CustomMethodIO"] == "") ? method->get_output_type_name() : vars["CustomMethodIO"];
|
vars["Response"] = (vars["CustomMethodIO"] == "")
|
||||||
if (method->NoStreaming()) {
|
? method->get_output_type_name()
|
||||||
printer->Print(vars, "$Method$($context$.Context, *$Request$) (*$Response$, error)$Ending$");
|
: vars["CustomMethodIO"];
|
||||||
} else if (ServerOnlyStreaming(method)) {
|
if (method->NoStreaming()) {
|
||||||
printer->Print(vars, "$Method$(*$Request$, $Service$_$Method$Server) error$Ending$");
|
printer->Print(
|
||||||
} else {
|
vars,
|
||||||
printer->Print(vars, "$Method$($Service$_$Method$Server) error$Ending$");
|
"$Method$($context$.Context, *$Request$) (*$Response$, error)$Ending$");
|
||||||
}
|
} else if (ServerOnlyStreaming(method)) {
|
||||||
|
printer->Print(
|
||||||
|
vars, "$Method$(*$Request$, $Service$_$Method$Server) error$Ending$");
|
||||||
|
} else {
|
||||||
|
printer->Print(vars, "$Method$($Service$_$Method$Server) error$Ending$");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenerateServerMethod(const grpc_generator::Method *method, grpc_generator::Printer *printer,
|
void GenerateServerMethod(const grpc_generator::Method *method,
|
||||||
|
grpc_generator::Printer *printer,
|
||||||
std::map<grpc::string, grpc::string> vars) {
|
std::map<grpc::string, grpc::string> vars) {
|
||||||
vars["Method"] = exportName(method->name());
|
vars["Method"] = exportName(method->name());
|
||||||
vars["Request"] = method->get_input_type_name();
|
vars["Request"] = method->get_input_type_name();
|
||||||
vars["Response"] = (vars["CustomMethodIO"] == "") ? method->get_output_type_name() : vars["CustomMethodIO"];
|
vars["Response"] = (vars["CustomMethodIO"] == "")
|
||||||
vars["FullMethodName"] = "/" + vars["ServicePrefix"] + vars["Service"] + "/" + vars["Method"];
|
? method->get_output_type_name()
|
||||||
vars["Handler"] = "_" + vars["Service"] + "_" + vars["Method"] + "_Handler";
|
: vars["CustomMethodIO"];
|
||||||
if (method->NoStreaming()) {
|
vars["FullMethodName"] =
|
||||||
printer->Print(vars, "func $Handler$(srv interface{}, ctx $context$.Context,\n\tdec func(interface{}) error, interceptor $grpc$.UnaryServerInterceptor) (interface{}, error) {\n");
|
"/" + vars["ServicePrefix"] + vars["Service"] + "/" + vars["Method"];
|
||||||
printer->Indent();
|
vars["Handler"] = "_" + vars["Service"] + "_" + vars["Method"] + "_Handler";
|
||||||
printer->Print(vars, "in := new($Request$)\n");
|
if (method->NoStreaming()) {
|
||||||
|
printer->Print(
|
||||||
|
vars,
|
||||||
|
"func $Handler$(srv interface{}, ctx $context$.Context,\n\tdec "
|
||||||
|
"func(interface{}) error, interceptor $grpc$.UnaryServerInterceptor) "
|
||||||
|
"(interface{}, error) {\n");
|
||||||
|
printer->Indent();
|
||||||
|
printer->Print(vars, "in := new($Request$)\n");
|
||||||
vars["Error_Check"] = "err := dec(in); err != nil";
|
vars["Error_Check"] = "err := dec(in); err != nil";
|
||||||
GenerateError(printer, vars);
|
GenerateError(printer, vars);
|
||||||
printer->Print("if interceptor == nil {\n");
|
printer->Print("if interceptor == nil {\n");
|
||||||
@@ -133,258 +112,281 @@ void GenerateServerMethod(const grpc_generator::Method *method, grpc_generator::
|
|||||||
printer->Print(vars, "return srv.($Service$Server).$Method$(ctx, in)\n");
|
printer->Print(vars, "return srv.($Service$Server).$Method$(ctx, in)\n");
|
||||||
printer->Outdent();
|
printer->Outdent();
|
||||||
printer->Print("}\n");
|
printer->Print("}\n");
|
||||||
printer->Print(vars, "info := &$grpc$.UnaryServerInfo{\n");
|
printer->Print(vars, "info := &$grpc$.UnaryServerInfo{\n");
|
||||||
printer->Indent();
|
printer->Indent();
|
||||||
printer->Print("Server: srv,\n");
|
printer->Print("Server: srv,\n");
|
||||||
printer->Print(vars, "FullMethod: \"$FullMethodName$\",\n");
|
printer->Print(vars, "FullMethod: \"$FullMethodName$\",\n");
|
||||||
printer->Outdent();
|
printer->Outdent();
|
||||||
printer->Print("}\n");
|
printer->Print("}\n");
|
||||||
printer->Outdent();
|
printer->Outdent();
|
||||||
printer->Print("\n");
|
printer->Print("\n");
|
||||||
printer->Indent();
|
printer->Indent();
|
||||||
printer->Print(vars, "handler := func(ctx $context$.Context, req interface{}) (interface{}, error) {\n");
|
printer->Print(vars,
|
||||||
printer->Indent();
|
"handler := func(ctx $context$.Context, req interface{}) "
|
||||||
printer->Print(vars, "return srv.($Service$Server).$Method$(ctx, req.(*$Request$))\n");
|
"(interface{}, error) {\n");
|
||||||
printer->Outdent();
|
printer->Indent();
|
||||||
printer->Print("}\n");
|
printer->Print(
|
||||||
printer->Print("return interceptor(ctx, in, info, handler)\n");
|
vars, "return srv.($Service$Server).$Method$(ctx, req.(*$Request$))\n");
|
||||||
printer->Outdent();
|
printer->Outdent();
|
||||||
printer->Print("}\n");
|
printer->Print("}\n");
|
||||||
return;
|
printer->Print("return interceptor(ctx, in, info, handler)\n");
|
||||||
}
|
printer->Outdent();
|
||||||
vars["StreamType"] = vars["ServiceUnexported"] + vars["Method"] + "Server";
|
printer->Print("}\n");
|
||||||
printer->Print(vars, "func $Handler$(srv interface{}, stream $grpc$.ServerStream) error {\n");
|
return;
|
||||||
printer->Indent();
|
}
|
||||||
if (ServerOnlyStreaming(method)) {
|
vars["StreamType"] = vars["ServiceUnexported"] + vars["Method"] + "Server";
|
||||||
printer->Print(vars, "m := new($Request$)\n");
|
printer->Print(
|
||||||
|
vars,
|
||||||
|
"func $Handler$(srv interface{}, stream $grpc$.ServerStream) error {\n");
|
||||||
|
printer->Indent();
|
||||||
|
if (ServerOnlyStreaming(method)) {
|
||||||
|
printer->Print(vars, "m := new($Request$)\n");
|
||||||
vars["Error_Check"] = "err := stream.RecvMsg(m); err != nil";
|
vars["Error_Check"] = "err := stream.RecvMsg(m); err != nil";
|
||||||
GenerateError(printer, vars, false);
|
GenerateError(printer, vars, false);
|
||||||
printer->Print(vars, "return srv.($Service$Server).$Method$(m, &$StreamType${stream})\n");
|
printer->Print(
|
||||||
} else {
|
vars,
|
||||||
printer->Print(vars, "return srv.($Service$Server).$Method$(&$StreamType${stream})\n");
|
"return srv.($Service$Server).$Method$(m, &$StreamType${stream})\n");
|
||||||
}
|
} else {
|
||||||
printer->Outdent();
|
printer->Print(
|
||||||
printer->Print("}\n\n");
|
vars, "return srv.($Service$Server).$Method$(&$StreamType${stream})\n");
|
||||||
|
}
|
||||||
|
printer->Outdent();
|
||||||
|
printer->Print("}\n\n");
|
||||||
|
|
||||||
bool genSend = method->BidiStreaming() || ServerOnlyStreaming(method);
|
bool genSend = method->BidiStreaming() || ServerOnlyStreaming(method);
|
||||||
bool genRecv = method->BidiStreaming() || ClientOnlyStreaming(method);
|
bool genRecv = method->BidiStreaming() || ClientOnlyStreaming(method);
|
||||||
bool genSendAndClose = ClientOnlyStreaming(method);
|
bool genSendAndClose = ClientOnlyStreaming(method);
|
||||||
|
|
||||||
printer->Print(vars, "type $Service$_$Method$Server interface {\n");
|
printer->Print(vars, "type $Service$_$Method$Server interface {\n");
|
||||||
printer->Indent();
|
printer->Indent();
|
||||||
if (genSend) {
|
if (genSend) { printer->Print(vars, "Send(*$Response$) error\n"); }
|
||||||
printer->Print(vars, "Send(*$Response$) error\n");
|
if (genRecv) { printer->Print(vars, "Recv() (*$Request$, error)\n"); }
|
||||||
}
|
if (genSendAndClose) {
|
||||||
if (genRecv) {
|
printer->Print(vars, "SendAndClose(*$Response$) error\n");
|
||||||
printer->Print(vars, "Recv() (*$Request$, error)\n");
|
}
|
||||||
}
|
printer->Print(vars, "$grpc$.ServerStream\n");
|
||||||
if (genSendAndClose) {
|
printer->Outdent();
|
||||||
printer->Print(vars, "SendAndClose(*$Response$) error\n");
|
printer->Print("}\n\n");
|
||||||
}
|
|
||||||
printer->Print(vars, "$grpc$.ServerStream\n");
|
|
||||||
printer->Outdent();
|
|
||||||
printer->Print("}\n\n");
|
|
||||||
|
|
||||||
printer->Print(vars, "type $StreamType$ struct {\n");
|
printer->Print(vars, "type $StreamType$ struct {\n");
|
||||||
printer->Indent();
|
printer->Indent();
|
||||||
printer->Print(vars, "$grpc$.ServerStream\n");
|
printer->Print(vars, "$grpc$.ServerStream\n");
|
||||||
printer->Outdent();
|
printer->Outdent();
|
||||||
printer->Print("}\n\n");
|
printer->Print("}\n\n");
|
||||||
|
|
||||||
if (genSend) {
|
if (genSend) {
|
||||||
printer->Print(vars, "func (x *$StreamType$) Send(m *$Response$) error {\n");
|
printer->Print(vars,
|
||||||
printer->Indent();
|
"func (x *$StreamType$) Send(m *$Response$) error {\n");
|
||||||
printer->Print("return x.ServerStream.SendMsg(m)\n");
|
printer->Indent();
|
||||||
printer->Outdent();
|
printer->Print("return x.ServerStream.SendMsg(m)\n");
|
||||||
printer->Print("}\n\n");
|
printer->Outdent();
|
||||||
}
|
printer->Print("}\n\n");
|
||||||
if (genRecv) {
|
}
|
||||||
printer->Print(vars, "func (x *$StreamType$) Recv() (*$Request$, error) {\n");
|
if (genRecv) {
|
||||||
printer->Indent();
|
printer->Print(vars,
|
||||||
printer->Print(vars, "m := new($Request$)\n");
|
"func (x *$StreamType$) Recv() (*$Request$, error) {\n");
|
||||||
|
printer->Indent();
|
||||||
|
printer->Print(vars, "m := new($Request$)\n");
|
||||||
vars["Error_Check"] = "err := x.ServerStream.RecvMsg(m); err != nil";
|
vars["Error_Check"] = "err := x.ServerStream.RecvMsg(m); err != nil";
|
||||||
GenerateError(printer, vars);
|
GenerateError(printer, vars);
|
||||||
printer->Print("return m, nil\n");
|
printer->Print("return m, nil\n");
|
||||||
printer->Outdent();
|
printer->Outdent();
|
||||||
printer->Print("}\n\n");
|
printer->Print("}\n\n");
|
||||||
}
|
}
|
||||||
if (genSendAndClose) {
|
if (genSendAndClose) {
|
||||||
printer->Print(vars, "func (x *$StreamType$) SendAndClose(m *$Response$) error {\n");
|
printer->Print(
|
||||||
printer->Indent();
|
vars, "func (x *$StreamType$) SendAndClose(m *$Response$) error {\n");
|
||||||
printer->Print("return x.ServerStream.SendMsg(m)\n");
|
printer->Indent();
|
||||||
printer->Outdent();
|
printer->Print("return x.ServerStream.SendMsg(m)\n");
|
||||||
printer->Print("}\n\n");
|
printer->Outdent();
|
||||||
}
|
printer->Print("}\n\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generates Client method signature source
|
// Generates Client method signature source
|
||||||
void GenerateClientMethodSignature(const grpc_generator::Method *method, grpc_generator::Printer *printer,
|
void GenerateClientMethodSignature(const grpc_generator::Method *method,
|
||||||
|
grpc_generator::Printer *printer,
|
||||||
std::map<grpc::string, grpc::string> vars) {
|
std::map<grpc::string, grpc::string> vars) {
|
||||||
vars["Method"] = exportName(method->name());
|
vars["Method"] = exportName(method->name());
|
||||||
vars["Request"] = ", in *" + ((vars["CustomMethodIO"] == "") ? method->get_input_type_name() : vars["CustomMethodIO"]);
|
vars["Request"] =
|
||||||
if (ClientOnlyStreaming(method) || method->BidiStreaming()) {
|
", in *" + ((vars["CustomMethodIO"] == "") ? method->get_input_type_name()
|
||||||
vars["Request"] = "";
|
: vars["CustomMethodIO"]);
|
||||||
}
|
if (ClientOnlyStreaming(method) || method->BidiStreaming()) {
|
||||||
vars["Response"] = "*" + method->get_output_type_name();
|
vars["Request"] = "";
|
||||||
if (ClientOnlyStreaming(method) || method->BidiStreaming() || ServerOnlyStreaming(method)) {
|
}
|
||||||
vars["Response"] = vars["Service"] + "_" + vars["Method"] + "Client" ;
|
vars["Response"] = "*" + method->get_output_type_name();
|
||||||
}
|
if (ClientOnlyStreaming(method) || method->BidiStreaming() ||
|
||||||
printer->Print(vars, "$Method$(ctx $context$.Context$Request$,\n\topts ...$grpc$.CallOption) ($Response$, error)$Ending$");
|
ServerOnlyStreaming(method)) {
|
||||||
|
vars["Response"] = vars["Service"] + "_" + vars["Method"] + "Client";
|
||||||
|
}
|
||||||
|
printer->Print(vars,
|
||||||
|
"$Method$(ctx $context$.Context$Request$,\n\topts "
|
||||||
|
"...$grpc$.CallOption) ($Response$, error)$Ending$");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generates Client method source
|
// Generates Client method source
|
||||||
void GenerateClientMethod(const grpc_generator::Method *method, grpc_generator::Printer *printer,
|
void GenerateClientMethod(const grpc_generator::Method *method,
|
||||||
|
grpc_generator::Printer *printer,
|
||||||
std::map<grpc::string, grpc::string> vars) {
|
std::map<grpc::string, grpc::string> vars) {
|
||||||
printer->Print(vars, "func (c *$ServiceUnexported$Client) ");
|
printer->Print(vars, "func (c *$ServiceUnexported$Client) ");
|
||||||
vars["Ending"] = " {\n";
|
vars["Ending"] = " {\n";
|
||||||
GenerateClientMethodSignature(method, printer, vars);
|
GenerateClientMethodSignature(method, printer, vars);
|
||||||
printer->Indent();
|
printer->Indent();
|
||||||
vars["Method"] = exportName(method->name());
|
vars["Method"] = exportName(method->name());
|
||||||
vars["Request"] = (vars["CustomMethodIO"] == "") ? method->get_input_type_name() : vars["CustomMethodIO"];
|
vars["Request"] = (vars["CustomMethodIO"] == "")
|
||||||
vars["Response"] = method->get_output_type_name();
|
? method->get_input_type_name()
|
||||||
vars["FullMethodName"] = "/" + vars["ServicePrefix"] + vars["Service"] + "/" + vars["Method"];
|
: vars["CustomMethodIO"];
|
||||||
if (method->NoStreaming()) {
|
vars["Response"] = method->get_output_type_name();
|
||||||
printer->Print(vars, "out := new($Response$)\n");
|
vars["FullMethodName"] =
|
||||||
printer->Print(vars, "err := c.cc.Invoke(ctx, \"$FullMethodName$\", in, out, opts...)\n");
|
"/" + vars["ServicePrefix"] + vars["Service"] + "/" + vars["Method"];
|
||||||
|
if (method->NoStreaming()) {
|
||||||
|
printer->Print(vars, "out := new($Response$)\n");
|
||||||
|
printer->Print(
|
||||||
|
vars,
|
||||||
|
"err := c.cc.Invoke(ctx, \"$FullMethodName$\", in, out, opts...)\n");
|
||||||
vars["Error_Check"] = "err != nil";
|
vars["Error_Check"] = "err != nil";
|
||||||
GenerateError(printer, vars);
|
GenerateError(printer, vars);
|
||||||
printer->Print("return out, nil\n");
|
printer->Print("return out, nil\n");
|
||||||
printer->Outdent();
|
printer->Outdent();
|
||||||
printer->Print("}\n\n");
|
printer->Print("}\n\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
vars["StreamType"] = vars["ServiceUnexported"] + vars["Method"] + "Client";
|
vars["StreamType"] = vars["ServiceUnexported"] + vars["Method"] + "Client";
|
||||||
printer->Print(vars, "stream, err := c.cc.NewStream(ctx, &$MethodDesc$, \"$FullMethodName$\", opts...)\n");
|
printer->Print(vars,
|
||||||
|
"stream, err := c.cc.NewStream(ctx, &$MethodDesc$, "
|
||||||
|
"\"$FullMethodName$\", opts...)\n");
|
||||||
vars["Error_Check"] = "err != nil";
|
vars["Error_Check"] = "err != nil";
|
||||||
GenerateError(printer, vars);
|
GenerateError(printer, vars);
|
||||||
|
|
||||||
printer->Print(vars, "x := &$StreamType${stream}\n");
|
printer->Print(vars, "x := &$StreamType${stream}\n");
|
||||||
if (ServerOnlyStreaming(method)) {
|
if (ServerOnlyStreaming(method)) {
|
||||||
vars["Error_Check"] = "err := x.ClientStream.SendMsg(in); err != nil";
|
vars["Error_Check"] = "err := x.ClientStream.SendMsg(in); err != nil";
|
||||||
GenerateError(printer, vars);
|
GenerateError(printer, vars);
|
||||||
vars["Error_Check"] = "err := x.ClientStream.CloseSend(); err != nil";
|
vars["Error_Check"] = "err := x.ClientStream.CloseSend(); err != nil";
|
||||||
GenerateError(printer, vars);
|
GenerateError(printer, vars);
|
||||||
}
|
}
|
||||||
printer->Print("return x, nil\n");
|
printer->Print("return x, nil\n");
|
||||||
printer->Outdent();
|
printer->Outdent();
|
||||||
printer->Print("}\n\n");
|
printer->Print("}\n\n");
|
||||||
|
|
||||||
bool genSend = method->BidiStreaming() || ClientOnlyStreaming(method);
|
bool genSend = method->BidiStreaming() || ClientOnlyStreaming(method);
|
||||||
bool genRecv = method->BidiStreaming() || ServerOnlyStreaming(method);
|
bool genRecv = method->BidiStreaming() || ServerOnlyStreaming(method);
|
||||||
bool genCloseAndRecv = ClientOnlyStreaming(method);
|
bool genCloseAndRecv = ClientOnlyStreaming(method);
|
||||||
|
|
||||||
//Stream interface
|
// Stream interface
|
||||||
printer->Print(vars, "type $Service$_$Method$Client interface {\n");
|
printer->Print(vars, "type $Service$_$Method$Client interface {\n");
|
||||||
printer->Indent();
|
printer->Indent();
|
||||||
if (genSend) {
|
if (genSend) { printer->Print(vars, "Send(*$Request$) error\n"); }
|
||||||
printer->Print(vars, "Send(*$Request$) error\n");
|
if (genRecv) { printer->Print(vars, "Recv() (*$Response$, error)\n"); }
|
||||||
}
|
if (genCloseAndRecv) {
|
||||||
if (genRecv) {
|
printer->Print(vars, "CloseAndRecv() (*$Response$, error)\n");
|
||||||
printer->Print(vars, "Recv() (*$Response$, error)\n");
|
}
|
||||||
}
|
printer->Print(vars, "$grpc$.ClientStream\n");
|
||||||
if (genCloseAndRecv) {
|
printer->Outdent();
|
||||||
printer->Print(vars, "CloseAndRecv() (*$Response$, error)\n");
|
printer->Print("}\n\n");
|
||||||
}
|
|
||||||
printer->Print(vars, "$grpc$.ClientStream\n");
|
|
||||||
printer->Outdent();
|
|
||||||
printer->Print("}\n\n");
|
|
||||||
|
|
||||||
//Stream Client
|
// Stream Client
|
||||||
printer->Print(vars, "type $StreamType$ struct {\n");
|
printer->Print(vars, "type $StreamType$ struct {\n");
|
||||||
printer->Indent();
|
printer->Indent();
|
||||||
printer->Print(vars, "$grpc$.ClientStream\n");
|
printer->Print(vars, "$grpc$.ClientStream\n");
|
||||||
printer->Outdent();
|
printer->Outdent();
|
||||||
printer->Print("}\n\n");
|
printer->Print("}\n\n");
|
||||||
|
|
||||||
if (genSend) {
|
if (genSend) {
|
||||||
printer->Print(vars, "func (x *$StreamType$) Send(m *$Request$) error {\n");
|
printer->Print(vars, "func (x *$StreamType$) Send(m *$Request$) error {\n");
|
||||||
printer->Indent();
|
printer->Indent();
|
||||||
printer->Print("return x.ClientStream.SendMsg(m)\n");
|
printer->Print("return x.ClientStream.SendMsg(m)\n");
|
||||||
printer->Outdent();
|
printer->Outdent();
|
||||||
printer->Print("}\n\n");
|
printer->Print("}\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (genRecv) {
|
if (genRecv) {
|
||||||
printer->Print(vars, "func (x *$StreamType$) Recv() (*$Response$, error) {\n");
|
printer->Print(vars,
|
||||||
printer->Indent();
|
"func (x *$StreamType$) Recv() (*$Response$, error) {\n");
|
||||||
printer->Print(vars, "m := new($Response$)\n");
|
printer->Indent();
|
||||||
|
printer->Print(vars, "m := new($Response$)\n");
|
||||||
vars["Error_Check"] = "err := x.ClientStream.RecvMsg(m); err != nil";
|
vars["Error_Check"] = "err := x.ClientStream.RecvMsg(m); err != nil";
|
||||||
GenerateError(printer, vars);
|
GenerateError(printer, vars);
|
||||||
printer->Print("return m, nil\n");
|
printer->Print("return m, nil\n");
|
||||||
printer->Outdent();
|
printer->Outdent();
|
||||||
printer->Print("}\n\n");
|
printer->Print("}\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (genCloseAndRecv) {
|
if (genCloseAndRecv) {
|
||||||
printer->Print(vars, "func (x *$StreamType$) CloseAndRecv() (*$Response$, error) {\n");
|
printer->Print(
|
||||||
printer->Indent();
|
vars, "func (x *$StreamType$) CloseAndRecv() (*$Response$, error) {\n");
|
||||||
|
printer->Indent();
|
||||||
vars["Error_Check"] = "err := x.ClientStream.CloseSend(); err != nil";
|
vars["Error_Check"] = "err := x.ClientStream.CloseSend(); err != nil";
|
||||||
GenerateError(printer, vars);
|
GenerateError(printer, vars);
|
||||||
printer->Print(vars, "m := new($Response$)\n");
|
printer->Print(vars, "m := new($Response$)\n");
|
||||||
vars["Error_Check"] = "err := x.ClientStream.RecvMsg(m); err != nil";
|
vars["Error_Check"] = "err := x.ClientStream.RecvMsg(m); err != nil";
|
||||||
GenerateError(printer, vars);
|
GenerateError(printer, vars);
|
||||||
printer->Print("return m, nil\n");
|
printer->Print("return m, nil\n");
|
||||||
printer->Outdent();
|
printer->Outdent();
|
||||||
printer->Print("}\n\n");
|
printer->Print("}\n\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generates client API for the service
|
// Generates client API for the service
|
||||||
void GenerateService(const grpc_generator::Service *service, grpc_generator::Printer* printer,
|
void GenerateService(const grpc_generator::Service *service,
|
||||||
|
grpc_generator::Printer *printer,
|
||||||
std::map<grpc::string, grpc::string> vars) {
|
std::map<grpc::string, grpc::string> vars) {
|
||||||
vars["Service"] = exportName(service->name());
|
vars["Service"] = exportName(service->name());
|
||||||
// Client Interface
|
// Client Interface
|
||||||
printer->Print(vars, "// Client API for $Service$ service\n");
|
printer->Print(vars, "// Client API for $Service$ service\n");
|
||||||
printer->Print(vars, "type $Service$Client interface {\n");
|
printer->Print(vars, "type $Service$Client interface {\n");
|
||||||
printer->Indent();
|
printer->Indent();
|
||||||
vars["Ending"] = "\n";
|
vars["Ending"] = "\n";
|
||||||
for (int i = 0; i < service->method_count(); i++) {
|
for (int i = 0; i < service->method_count(); i++) {
|
||||||
GenerateClientMethodSignature(service->method(i).get(), printer, vars);
|
GenerateClientMethodSignature(service->method(i).get(), printer, vars);
|
||||||
}
|
}
|
||||||
printer->Outdent();
|
printer->Outdent();
|
||||||
printer->Print("}\n\n");
|
printer->Print("}\n\n");
|
||||||
|
|
||||||
// Client structure
|
// Client structure
|
||||||
vars["ServiceUnexported"] = unexportName(vars["Service"]);
|
vars["ServiceUnexported"] = unexportName(vars["Service"]);
|
||||||
printer->Print(vars, "type $ServiceUnexported$Client struct {\n");
|
printer->Print(vars, "type $ServiceUnexported$Client struct {\n");
|
||||||
printer->Indent();
|
printer->Indent();
|
||||||
printer->Print(vars, "cc $grpc$.ClientConnInterface\n");
|
printer->Print(vars, "cc $grpc$.ClientConnInterface\n");
|
||||||
printer->Outdent();
|
printer->Outdent();
|
||||||
printer->Print("}\n\n");
|
printer->Print("}\n\n");
|
||||||
|
|
||||||
// NewClient
|
// NewClient
|
||||||
printer->Print(vars, "func New$Service$Client(cc $grpc$.ClientConnInterface) $Service$Client {\n");
|
printer->Print(vars,
|
||||||
printer->Indent();
|
"func New$Service$Client(cc $grpc$.ClientConnInterface) "
|
||||||
printer->Print(vars, "return &$ServiceUnexported$Client{cc}");
|
"$Service$Client {\n");
|
||||||
printer->Outdent();
|
printer->Indent();
|
||||||
printer->Print("\n}\n\n");
|
printer->Print(vars, "return &$ServiceUnexported$Client{cc}");
|
||||||
|
printer->Outdent();
|
||||||
|
printer->Print("\n}\n\n");
|
||||||
|
|
||||||
int unary_methods = 0, streaming_methods = 0;
|
int unary_methods = 0, streaming_methods = 0;
|
||||||
vars["ServiceDesc"] = "_" + vars["Service"] + "_serviceDesc";
|
vars["ServiceDesc"] = "_" + vars["Service"] + "_serviceDesc";
|
||||||
for (int i = 0; i < service->method_count(); i++) {
|
for (int i = 0; i < service->method_count(); i++) {
|
||||||
auto method = service->method(i);
|
auto method = service->method(i);
|
||||||
if (method->NoStreaming()) {
|
if (method->NoStreaming()) {
|
||||||
vars["MethodDesc"] = vars["ServiceDesc"] + ".Method[" + as_string(unary_methods) + "]";
|
vars["MethodDesc"] =
|
||||||
unary_methods++;
|
vars["ServiceDesc"] + ".Method[" + as_string(unary_methods) + "]";
|
||||||
} else {
|
unary_methods++;
|
||||||
vars["MethodDesc"] = vars["ServiceDesc"] + ".Streams[" + as_string(streaming_methods) + "]";
|
} else {
|
||||||
streaming_methods++;
|
vars["MethodDesc"] = vars["ServiceDesc"] + ".Streams[" +
|
||||||
}
|
as_string(streaming_methods) + "]";
|
||||||
GenerateClientMethod(method.get(), printer, vars);
|
streaming_methods++;
|
||||||
}
|
}
|
||||||
|
GenerateClientMethod(method.get(), printer, vars);
|
||||||
|
}
|
||||||
|
|
||||||
//Server Interface
|
// Server Interface
|
||||||
printer->Print(vars, "// Server API for $Service$ service\n");
|
printer->Print(vars, "// Server API for $Service$ service\n");
|
||||||
printer->Print(vars, "type $Service$Server interface {\n");
|
printer->Print(vars, "type $Service$Server interface {\n");
|
||||||
printer->Indent();
|
printer->Indent();
|
||||||
vars["Ending"] = "\n";
|
vars["Ending"] = "\n";
|
||||||
for (int i = 0; i < service->method_count(); i++) {
|
for (int i = 0; i < service->method_count(); i++) {
|
||||||
GenerateServerMethodSignature(service->method(i).get(), printer, vars);
|
GenerateServerMethodSignature(service->method(i).get(), printer, vars);
|
||||||
}
|
}
|
||||||
printer->Print(vars, "mustEmbedUnimplemented$Service$Server()\n");
|
printer->Print(vars, "mustEmbedUnimplemented$Service$Server()\n");
|
||||||
printer->Outdent();
|
printer->Outdent();
|
||||||
printer->Print("}\n\n");
|
printer->Print("}\n\n");
|
||||||
|
|
||||||
printer->Print(vars, "type Unimplemented$Service$Server struct {\n");
|
printer->Print(vars, "type Unimplemented$Service$Server struct {\n");
|
||||||
printer->Print("}\n\n");
|
printer->Print("}\n\n");
|
||||||
@@ -397,13 +399,17 @@ void GenerateService(const grpc_generator::Service *service, grpc_generator::Pri
|
|||||||
printer->Print(vars, "func (Unimplemented$Service$Server) ");
|
printer->Print(vars, "func (Unimplemented$Service$Server) ");
|
||||||
GenerateServerMethodSignature(method.get(), printer, vars);
|
GenerateServerMethodSignature(method.get(), printer, vars);
|
||||||
printer->Indent();
|
printer->Indent();
|
||||||
printer->Print(vars, "return $Nil$status.Errorf(codes.Unimplemented, \"method $Method$ not implemented\")\n");
|
printer->Print(vars,
|
||||||
|
"return $Nil$status.Errorf(codes.Unimplemented, \"method "
|
||||||
|
"$Method$ not implemented\")\n");
|
||||||
printer->Outdent();
|
printer->Outdent();
|
||||||
printer->Print("}\n");
|
printer->Print("}\n");
|
||||||
printer->Print("\n");
|
printer->Print("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
printer->Print(vars, "func (Unimplemented$Service$Server) mustEmbedUnimplemented$Service$Server() {}");
|
printer->Print(vars,
|
||||||
|
"func (Unimplemented$Service$Server) "
|
||||||
|
"mustEmbedUnimplemented$Service$Server() {}");
|
||||||
printer->Print("\n\n");
|
printer->Print("\n\n");
|
||||||
|
|
||||||
printer->Print(vars, "type Unsafe$Service$Server interface {\n");
|
printer->Print(vars, "type Unsafe$Service$Server interface {\n");
|
||||||
@@ -411,91 +417,89 @@ void GenerateService(const grpc_generator::Service *service, grpc_generator::Pri
|
|||||||
printer->Print(vars, "mustEmbedUnimplemented$Service$Server()\n");
|
printer->Print(vars, "mustEmbedUnimplemented$Service$Server()\n");
|
||||||
printer->Outdent();
|
printer->Outdent();
|
||||||
printer->Print("}\n\n");
|
printer->Print("}\n\n");
|
||||||
// Server registration.
|
// Server registration.
|
||||||
printer->Print(vars, "func Register$Service$Server(s $grpc$.ServiceRegistrar, srv $Service$Server) {\n");
|
printer->Print(vars,
|
||||||
printer->Indent();
|
"func Register$Service$Server(s $grpc$.ServiceRegistrar, srv "
|
||||||
printer->Print(vars, "s.RegisterService(&$ServiceDesc$, srv)\n");
|
"$Service$Server) {\n");
|
||||||
printer->Outdent();
|
printer->Indent();
|
||||||
printer->Print("}\n\n");
|
printer->Print(vars, "s.RegisterService(&$ServiceDesc$, srv)\n");
|
||||||
|
printer->Outdent();
|
||||||
|
printer->Print("}\n\n");
|
||||||
|
|
||||||
for (int i = 0; i < service->method_count(); i++) {
|
for (int i = 0; i < service->method_count(); i++) {
|
||||||
GenerateServerMethod(service->method(i).get(), printer, vars);
|
GenerateServerMethod(service->method(i).get(), printer, vars);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Service Descriptor
|
|
||||||
printer->Print(vars, "var $ServiceDesc$ = $grpc$.ServiceDesc{\n");
|
|
||||||
printer->Indent();
|
|
||||||
printer->Print(vars, "ServiceName: \"$ServicePrefix$$Service$\",\n");
|
|
||||||
printer->Print(vars, "HandlerType: (*$Service$Server)(nil),\n");
|
|
||||||
printer->Print(vars, "Methods: []$grpc$.MethodDesc{\n");
|
|
||||||
printer->Indent();
|
|
||||||
for (int i = 0; i < service->method_count(); i++) {
|
|
||||||
auto method = service->method(i);
|
|
||||||
vars["Method"] = exportName(method->name());
|
|
||||||
vars["Handler"] = "_" + vars["Service"] + "_" + vars["Method"] + "_Handler";
|
|
||||||
if (method->NoStreaming()) {
|
|
||||||
printer->Print("{\n");
|
|
||||||
printer->Indent();
|
|
||||||
printer->Print(vars, "MethodName: \"$Method$\",\n");
|
|
||||||
printer->Print(vars, "Handler: $Handler$,\n");
|
|
||||||
printer->Outdent();
|
|
||||||
printer->Print("},\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
printer->Outdent();
|
|
||||||
printer->Print("},\n");
|
|
||||||
printer->Print(vars, "Streams: []$grpc$.StreamDesc{\n");
|
|
||||||
printer->Indent();
|
|
||||||
for (int i = 0; i < service->method_count(); i++) {
|
|
||||||
auto method = service->method(i);
|
|
||||||
vars["Method"] = exportName(method->name());
|
|
||||||
vars["Handler"] = "_" + vars["Service"] + "_" + vars["Method"] + "_Handler";
|
|
||||||
if (!method->NoStreaming()) {
|
|
||||||
printer->Print("{\n");
|
|
||||||
printer->Indent();
|
|
||||||
printer->Print(vars, "StreamName: \"$Method$\",\n");
|
|
||||||
printer->Print(vars, "Handler: $Handler$,\n");
|
|
||||||
if (ClientOnlyStreaming(method.get())) {
|
|
||||||
printer->Print("ClientStreams: true,\n");
|
|
||||||
} else if (ServerOnlyStreaming(method.get())) {
|
|
||||||
printer->Print("ServerStreams: true,\n");
|
|
||||||
} else {
|
|
||||||
printer->Print("ServerStreams: true,\n");
|
|
||||||
printer->Print("ClientStreams: true,\n");
|
|
||||||
}
|
|
||||||
printer->Outdent();
|
|
||||||
printer->Print("},\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
printer->Outdent();
|
|
||||||
printer->Print("},\n");
|
|
||||||
printer->Outdent();
|
|
||||||
printer->Print("}\n");
|
|
||||||
|
|
||||||
|
// Service Descriptor
|
||||||
|
printer->Print(vars, "var $ServiceDesc$ = $grpc$.ServiceDesc{\n");
|
||||||
|
printer->Indent();
|
||||||
|
printer->Print(vars, "ServiceName: \"$ServicePrefix$$Service$\",\n");
|
||||||
|
printer->Print(vars, "HandlerType: (*$Service$Server)(nil),\n");
|
||||||
|
printer->Print(vars, "Methods: []$grpc$.MethodDesc{\n");
|
||||||
|
printer->Indent();
|
||||||
|
for (int i = 0; i < service->method_count(); i++) {
|
||||||
|
auto method = service->method(i);
|
||||||
|
vars["Method"] = exportName(method->name());
|
||||||
|
vars["Handler"] = "_" + vars["Service"] + "_" + vars["Method"] + "_Handler";
|
||||||
|
if (method->NoStreaming()) {
|
||||||
|
printer->Print("{\n");
|
||||||
|
printer->Indent();
|
||||||
|
printer->Print(vars, "MethodName: \"$Method$\",\n");
|
||||||
|
printer->Print(vars, "Handler: $Handler$,\n");
|
||||||
|
printer->Outdent();
|
||||||
|
printer->Print("},\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printer->Outdent();
|
||||||
|
printer->Print("},\n");
|
||||||
|
printer->Print(vars, "Streams: []$grpc$.StreamDesc{\n");
|
||||||
|
printer->Indent();
|
||||||
|
for (int i = 0; i < service->method_count(); i++) {
|
||||||
|
auto method = service->method(i);
|
||||||
|
vars["Method"] = exportName(method->name());
|
||||||
|
vars["Handler"] = "_" + vars["Service"] + "_" + vars["Method"] + "_Handler";
|
||||||
|
if (!method->NoStreaming()) {
|
||||||
|
printer->Print("{\n");
|
||||||
|
printer->Indent();
|
||||||
|
printer->Print(vars, "StreamName: \"$Method$\",\n");
|
||||||
|
printer->Print(vars, "Handler: $Handler$,\n");
|
||||||
|
if (ClientOnlyStreaming(method.get())) {
|
||||||
|
printer->Print("ClientStreams: true,\n");
|
||||||
|
} else if (ServerOnlyStreaming(method.get())) {
|
||||||
|
printer->Print("ServerStreams: true,\n");
|
||||||
|
} else {
|
||||||
|
printer->Print("ServerStreams: true,\n");
|
||||||
|
printer->Print("ClientStreams: true,\n");
|
||||||
|
}
|
||||||
|
printer->Outdent();
|
||||||
|
printer->Print("},\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printer->Outdent();
|
||||||
|
printer->Print("},\n");
|
||||||
|
printer->Outdent();
|
||||||
|
printer->Print("}\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Returns source for the service
|
// Returns source for the service
|
||||||
grpc::string GenerateServiceSource(grpc_generator::File *file,
|
grpc::string GenerateServiceSource(grpc_generator::File *file,
|
||||||
const grpc_generator::Service *service,
|
const grpc_generator::Service *service,
|
||||||
grpc_go_generator::Parameters *parameters) {
|
grpc_go_generator::Parameters *parameters) {
|
||||||
grpc::string out;
|
grpc::string out;
|
||||||
auto p = file->CreatePrinter(&out, '\t');
|
auto p = file->CreatePrinter(&out, '\t');
|
||||||
p->SetIndentationSize(1);
|
p->SetIndentationSize(1);
|
||||||
auto printer = p.get();
|
auto printer = p.get();
|
||||||
std::map<grpc::string, grpc::string> vars;
|
std::map<grpc::string, grpc::string> vars;
|
||||||
vars["Package"] = parameters->package_name;
|
vars["Package"] = parameters->package_name;
|
||||||
vars["ServicePrefix"] = parameters->service_prefix;
|
vars["ServicePrefix"] = parameters->service_prefix;
|
||||||
if (!parameters->service_prefix.empty())
|
if (!parameters->service_prefix.empty()) vars["ServicePrefix"].append(".");
|
||||||
vars["ServicePrefix"].append(".");
|
vars["grpc"] = "grpc";
|
||||||
vars["grpc"] = "grpc";
|
vars["context"] = "context";
|
||||||
vars["context"] = "context";
|
GenerateImports(file, printer, vars);
|
||||||
GenerateImports(file, printer, vars);
|
if (parameters->custom_method_io_type != "") {
|
||||||
if (parameters->custom_method_io_type != "") {
|
vars["CustomMethodIO"] = parameters->custom_method_io_type;
|
||||||
vars["CustomMethodIO"] = parameters->custom_method_io_type;
|
}
|
||||||
}
|
GenerateService(service, printer, vars);
|
||||||
GenerateService(service, printer, vars);
|
return out;
|
||||||
return out;
|
|
||||||
}
|
}
|
||||||
}// Namespace grpc_go_generator
|
} // Namespace grpc_go_generator
|
||||||
|
|||||||
@@ -1,40 +1,8 @@
|
|||||||
/*
|
|
||||||
*
|
|
||||||
* Copyright 2015, Google Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are
|
|
||||||
* met:
|
|
||||||
*
|
|
||||||
* * Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* * Redistributions in binary form must reproduce the above
|
|
||||||
* copyright notice, this list of conditions and the following disclaimer
|
|
||||||
* in the documentation and/or other materials provided with the
|
|
||||||
* distribution.
|
|
||||||
* * Neither the name of Google Inc. nor the names of its
|
|
||||||
* contributors may be used to endorse or promote products derived from
|
|
||||||
* this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (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 GRPC_INTERNAL_COMPILER_GO_GENERATOR_H
|
#ifndef GRPC_INTERNAL_COMPILER_GO_GENERATOR_H
|
||||||
#define GRPC_INTERNAL_COMPILER_GO_GENERATOR_H
|
#define GRPC_INTERNAL_COMPILER_GO_GENERATOR_H
|
||||||
|
|
||||||
//go generator is used to generate GRPC code for serialization system, such as flatbuffers
|
// go generator is used to generate GRPC code for serialization system, such as
|
||||||
|
// flatbuffers
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@@ -43,14 +11,15 @@
|
|||||||
namespace grpc_go_generator {
|
namespace grpc_go_generator {
|
||||||
|
|
||||||
struct Parameters {
|
struct Parameters {
|
||||||
//Defines the custom parameter types for methods
|
// Defines the custom parameter types for methods
|
||||||
//eg: flatbuffers uses flatbuffers.Builder as input for the client and output for the server
|
// eg: flatbuffers uses flatbuffers.Builder as input for the client and output
|
||||||
|
// for the server
|
||||||
grpc::string custom_method_io_type;
|
grpc::string custom_method_io_type;
|
||||||
|
|
||||||
//Package name for the service
|
// Package name for the service
|
||||||
grpc::string package_name;
|
grpc::string package_name;
|
||||||
|
|
||||||
//Prefix for RPC Calls
|
// Prefix for RPC Calls
|
||||||
grpc::string service_prefix;
|
grpc::string service_prefix;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -59,6 +28,6 @@ grpc::string GenerateServiceSource(grpc_generator::File *file,
|
|||||||
const grpc_generator::Service *service,
|
const grpc_generator::Service *service,
|
||||||
grpc_go_generator::Parameters *parameters);
|
grpc_go_generator::Parameters *parameters);
|
||||||
|
|
||||||
}
|
} // namespace grpc_go_generator
|
||||||
|
|
||||||
#endif // GRPC_INTERNAL_COMPILER_GO_GENERATOR_H
|
#endif // GRPC_INTERNAL_COMPILER_GO_GENERATOR_H
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "src/compiler/config.h"
|
|
||||||
#include "src/compiler/schema_interface.h"
|
#include "src/compiler/schema_interface.h"
|
||||||
|
|
||||||
namespace grpc_python_generator {
|
namespace grpc_python_generator {
|
||||||
|
|||||||
@@ -19,11 +19,10 @@
|
|||||||
#ifndef GRPC_INTERNAL_COMPILER_SCHEMA_INTERFACE_H
|
#ifndef GRPC_INTERNAL_COMPILER_SCHEMA_INTERFACE_H
|
||||||
#define GRPC_INTERNAL_COMPILER_SCHEMA_INTERFACE_H
|
#define GRPC_INTERNAL_COMPILER_SCHEMA_INTERFACE_H
|
||||||
|
|
||||||
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "src/compiler/config.h"
|
|
||||||
|
|
||||||
#ifndef GRPC_CUSTOM_STRING
|
#ifndef GRPC_CUSTOM_STRING
|
||||||
# include <string>
|
# include <string>
|
||||||
# define GRPC_CUSTOM_STRING std::string
|
# define GRPC_CUSTOM_STRING std::string
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "src/compiler/config.h"
|
|
||||||
#include "src/compiler/schema_interface.h"
|
#include "src/compiler/schema_interface.h"
|
||||||
|
|
||||||
#ifndef GRPC_CUSTOM_STRING
|
#ifndef GRPC_CUSTOM_STRING
|
||||||
|
|||||||
@@ -1,41 +1,7 @@
|
|||||||
/*
|
|
||||||
*
|
|
||||||
* Copyright 2020, Google Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are
|
|
||||||
* met:
|
|
||||||
*
|
|
||||||
* * Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* * Redistributions in binary form must reproduce the above
|
|
||||||
* copyright notice, this list of conditions and the following disclaimer
|
|
||||||
* in the documentation and/or other materials provided with the
|
|
||||||
* distribution.
|
|
||||||
* * Neither the name of Google Inc. nor the names of its
|
|
||||||
* contributors may be used to endorse or promote products derived from
|
|
||||||
* this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
|
||||||
#include <set>
|
#include <set>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "src/compiler/config.h"
|
|
||||||
#include "src/compiler/schema_interface.h"
|
#include "src/compiler/schema_interface.h"
|
||||||
|
|
||||||
#ifndef GRPC_CUSTOM_STRING
|
#ifndef GRPC_CUSTOM_STRING
|
||||||
@@ -58,4 +24,3 @@ grpc::string GenerateInterface(grpc_generator::File *file,
|
|||||||
const grpc_generator::Service *service,
|
const grpc_generator::Service *service,
|
||||||
const grpc::string &filename);
|
const grpc::string &filename);
|
||||||
} // namespace grpc_ts_generator
|
} // namespace grpc_ts_generator
|
||||||
|
|
||||||
|
|||||||
@@ -1,33 +1,3 @@
|
|||||||
// Protocol Buffers - Google's data interchange format
|
|
||||||
// Copyright 2008 Google Inc. All rights reserved.
|
|
||||||
// https://developers.google.com/protocol-buffers/
|
|
||||||
//
|
|
||||||
// Redistribution and use in source and binary forms, with or without
|
|
||||||
// modification, are permitted provided that the following conditions are
|
|
||||||
// met:
|
|
||||||
//
|
|
||||||
// * Redistributions of source code must retain the above copyright
|
|
||||||
// notice, this list of conditions and the following disclaimer.
|
|
||||||
// * Redistributions in binary form must reproduce the above
|
|
||||||
// copyright notice, this list of conditions and the following disclaimer
|
|
||||||
// in the documentation and/or other materials provided with the
|
|
||||||
// distribution.
|
|
||||||
// * Neither the name of Google Inc. nor the names of its
|
|
||||||
// contributors may be used to endorse or promote products derived from
|
|
||||||
// this software without specific prior written permission.
|
|
||||||
//
|
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
package com.google.flatbuffers;
|
package com.google.flatbuffers;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
|||||||
Reference in New Issue
Block a user