Go to the documentation of this file.
26 #include <google/protobuf/compiler/plugin.h>
27 #include <google/protobuf/io/printer.h>
29 #include "absl/strings/str_replace.h"
30 #include "absl/strings/string_view.h"
31 #include "absl/strings/substitute.h"
32 #include "google/protobuf/compiler/code_generator.h"
33 #include "google/protobuf/descriptor.h"
34 #include "google/protobuf/descriptor.pb.h"
36 namespace protoc = ::google::protobuf::compiler;
37 namespace protobuf = ::google::protobuf;
47 if (lastdot == std::string::npos) {
67 text =
'A' + (digit - 10);
69 printer->WriteRaw(&
text, 1);
75 while (max_cols > 0 && !
str->empty()) {
78 printer->PrintRaw(
"\\\\");
80 }
else if (
ch ==
'\'') {
81 printer->PrintRaw(
"\\'");
84 printer->WriteRaw(&
ch, 1);
87 unsigned char byte =
ch;
88 printer->PrintRaw(
"\\x");
93 str->remove_prefix(1);
106 for (
int i = 0;
i <
file->dependency_count();
i++) {
108 printer.Print(
"require('$name$')\n",
"name",
ModuleName(
dep));
111 printer.Print(
"local upb = require('upb')\n");
114 file->CopyTo(&file_proto);
116 file_proto.SerializeToString(&
file_data);
118 printer.Print(
"local descriptor = table.concat({\n");
120 while (!
data.empty()) {
123 printer.Print(
",\n");
125 printer.Print(
"})\n");
127 printer.Print(
"return upb._generated_module(descriptor)\n");
132 int main(
int argc,
char** argv) {
static std::string Filename(const protobuf::FileDescriptor *file)
GRPC_CUSTOM_PRINTER Printer
GRPC_CUSTOM_ZEROCOPYOUTPUTSTREAM ZeroCopyOutputStream
int PluginMain(int argc, char *argv[], const CodeGenerator *generator)
static std::string StripExtension(absl::string_view fname)
int main(int argc, char **argv)
static std::string ModuleName(const protobuf::FileDescriptor *file)
static void PrintString(int max_cols, absl::string_view *str, protobuf::io::Printer *printer)
bool Generate(const protobuf::FileDescriptor *file, const std::string ¶meter, protoc::GeneratorContext *context, std::string *error) const override
UniquePtr< SSL_SESSION > ret
std::string StrReplaceAll(absl::string_view s, strings_internal::FixedMapping replacements)
size_type find_last_of(string_view s, size_type pos=npos) const noexcept
static void PrintHexDigit(char digit, protobuf::io::Printer *printer)
GRPC_CUSTOM_FILEDESCRIPTORPROTO FileDescriptorProto
grpc::ClientContext context
constexpr string_view substr(size_type pos=0, size_type n=npos) const
grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:01:47