#include <functional>
#include <memory>
#include <set>
#include <string>
#include <google/protobuf/compiler/code_generator.h>
#include <google/protobuf/compiler/plugin.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/io/printer.h>
#include <google/protobuf/io/zero_copy_stream.h>
#include "perfetto/ext/base/string_utils.h"
namespace perfetto {
namespace ipc {
namespace {
FileDescriptor;
MethodDescriptor;
ServiceDescriptor;
GeneratorContext;
Printer;
ZeroCopyOutputStream;
SplitString;
StripChars;
StripSuffix;
ToUpper;
static const char kBanner[] = …;
static const char kHeaderSvcClass[] = …;
static const char kHeaderProxyClass[] = …;
static const char kCppClassDefinitions[] = …;
static const char kCppMethodDescriptor[] = …;
static const char kCppMethod[] = …;
std::string StripName(const FileDescriptor& file) { … }
std::string GetStubName(const FileDescriptor& file) { … }
void ForEachMethod(const ServiceDescriptor& svc,
std::function<void(const MethodDescriptor&,
const std::string&,
const std::string&)> function) { … }
class IPCGenerator : public ::google::protobuf::compiler::CodeGenerator { … };
IPCGenerator::IPCGenerator() = default;
IPCGenerator::~IPCGenerator() = default;
void IPCGenerator::GenerateServiceHeader(const FileDescriptor& file,
const ServiceDescriptor& svc,
Printer* printer) const { … }
void IPCGenerator::GenerateServiceCpp(const FileDescriptor& file,
const ServiceDescriptor& svc,
Printer* printer) const { … }
bool IPCGenerator::Generate(const FileDescriptor* file,
const std::string& options,
GeneratorContext* context,
std::string* error) const { … }
}
}
}
int main(int argc, char* argv[]) { … }