Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
z
Enumerations
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
z
Classes
Class List
Class Hierarchy
Class Members
All
:
[
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
[
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
Enumerations
a
b
c
d
e
f
h
i
k
l
m
n
o
p
r
s
t
u
v
w
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
Properties
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
Related Functions
:
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
z
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
grpc
src
compiler
ruby_plugin.cc
Go to the documentation of this file.
1
/*
2
*
3
* Copyright 2015 gRPC authors.
4
*
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
* you may not use this file except in compliance with the License.
7
* You may obtain a copy of the License at
8
*
9
* http://www.apache.org/licenses/LICENSE-2.0
10
*
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
16
*
17
*/
18
19
// Generates Ruby gRPC service interface out of Protobuf IDL.
20
21
#include <memory>
22
23
#include "
src/compiler/config.h
"
24
#include "
src/compiler/ruby_generator.h
"
25
#include "
src/compiler/ruby_generator_helpers-inl.h
"
26
27
class
RubyGrpcGenerator
:
public
grpc::protobuf::compiler::CodeGenerator
{
28
public
:
29
RubyGrpcGenerator
() {}
30
~RubyGrpcGenerator
() {}
31
32
uint64_t
GetSupportedFeatures
()
const override
{
33
return
FEATURE_PROTO3_OPTIONAL;
34
}
35
36
bool
Generate
(
const
grpc::protobuf::FileDescriptor
*
file
,
37
const
std::string
&
/*parameter*/
,
38
grpc::protobuf::compiler::GeneratorContext
*
context
,
39
std::string
*
/*error*/
)
const override
{
40
std::string
code
=
grpc_ruby_generator::GetServices
(
file
);
41
if
(
code
.size() == 0) {
42
return
true
;
// don't generate a file if there are no services
43
}
44
45
// Get output file name.
46
std::string
file_name;
47
if
(!
grpc_ruby_generator::ServicesFilename
(
file
, &file_name)) {
48
return
false
;
49
}
50
std::unique_ptr<grpc::protobuf::io::ZeroCopyOutputStream>
output
(
51
context
->Open(file_name));
52
grpc::protobuf::io::CodedOutputStream
coded_out(
output
.get());
53
coded_out.WriteRaw(
code
.data(),
code
.size());
54
return
true
;
55
}
56
};
57
58
int
main
(
int
argc,
char
* argv[]) {
59
RubyGrpcGenerator
generator;
60
return
grpc::protobuf::compiler::PluginMain
(argc, argv, &generator);
61
}
RubyGrpcGenerator::RubyGrpcGenerator
RubyGrpcGenerator()
Definition:
ruby_plugin.cc:29
grpc::protobuf::FileDescriptor
GRPC_CUSTOM_FILEDESCRIPTOR FileDescriptor
Definition:
include/grpcpp/impl/codegen/config_protobuf.h:85
config.h
testing::internal::string
::std::string string
Definition:
bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
RubyGrpcGenerator
Definition:
ruby_plugin.cc:27
file
Definition:
bloaty/third_party/zlib/examples/gzappend.c:170
ruby_generator_helpers-inl.h
grpc::protobuf::compiler::GeneratorContext
GRPC_CUSTOM_GENERATORCONTEXT GeneratorContext
Definition:
src/compiler/config.h:42
grpc::protobuf::compiler::CodeGenerator
GRPC_CUSTOM_CODEGENERATOR CodeGenerator
Definition:
src/compiler/config.h:41
gmock_output_test.output
output
Definition:
bloaty/third_party/googletest/googlemock/test/gmock_output_test.py:175
uint64_t
unsigned __int64 uint64_t
Definition:
stdint-msvc2008.h:90
grpc_ruby_generator::GetServices
std::string GetServices(const FileDescriptor *file)
Definition:
src/compiler/ruby_generator.cc:146
main
int main(int argc, char *argv[])
Definition:
ruby_plugin.cc:58
grpc::protobuf::io::CodedOutputStream
GRPC_CUSTOM_CODEDOUTPUTSTREAM CodedOutputStream
Definition:
src/compiler/config.h:55
grpc::protobuf::compiler::PluginMain
static int PluginMain(int argc, char *argv[], const CodeGenerator *generator)
Definition:
src/compiler/config.h:43
RubyGrpcGenerator::Generate
bool Generate(const grpc::protobuf::FileDescriptor *file, const std::string &, grpc::protobuf::compiler::GeneratorContext *context, std::string *) const override
Definition:
ruby_plugin.cc:36
RubyGrpcGenerator::GetSupportedFeatures
uint64_t GetSupportedFeatures() const override
Definition:
ruby_plugin.cc:32
grpc_ruby_generator::ServicesFilename
bool ServicesFilename(const grpc::protobuf::FileDescriptor *file, std::string *file_name_or_error)
Definition:
ruby_generator_helpers-inl.h:28
ruby_generator.h
context
grpc::ClientContext context
Definition:
istio_echo_server_lib.cc:61
code
Definition:
bloaty/third_party/zlib/contrib/infback9/inftree9.h:24
RubyGrpcGenerator::~RubyGrpcGenerator
~RubyGrpcGenerator()
Definition:
ruby_plugin.cc:30
grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:01:13