#include <stdio.h>
#include <stdlib.h>
#include <fstream>
#include <iostream>
#include <map>
#include <set>
#include <stack>
#include <vector>
#include <google/protobuf/compiler/code_generator.h>
#include <google/protobuf/compiler/importer.h>
#include <google/protobuf/compiler/plugin.h>
#include <google/protobuf/io/printer.h>
#include "perfetto/ext/base/string_utils.h"
namespace protozero {
namespace {
usingnamespacegoogle::protobuf;
usingnamespacegoogle::protobuf::compiler;
usingnamespacegoogle::protobuf::io;
SplitString;
StripChars;
StripSuffix;
ToUpper;
static constexpr auto TYPE_STRING = …;
static constexpr auto TYPE_MESSAGE = …;
static constexpr auto TYPE_SINT32 = …;
static constexpr auto TYPE_SINT64 = …;
static const char kHeader[] = …;
class CppObjGenerator : public ::google::protobuf::compiler::CodeGenerator { … };
CppObjGenerator::CppObjGenerator() = default;
CppObjGenerator::~CppObjGenerator() = default;
bool CppObjGenerator::Generate(const google::protobuf::FileDescriptor* file,
const std::string& options,
GeneratorContext* context,
std::string* error) const { … }
std::string CppObjGenerator::GetCppType(const FieldDescriptor* field,
bool constref) const { … }
std::string CppObjGenerator::GetProtozeroSetter(
const FieldDescriptor* field) const { … }
std::string CppObjGenerator::GetPackedBuffer(
const FieldDescriptor* field) const { … }
std::string CppObjGenerator::GetPackedWireType(
const FieldDescriptor* field) const { … }
void CppObjGenerator::GenEnum(const EnumDescriptor* enum_desc,
Printer* p) const { … }
void CppObjGenerator::GenEnumAliases(const EnumDescriptor* enum_desc,
Printer* p) const { … }
void CppObjGenerator::GenClassDecl(const Descriptor* msg, Printer* p) const { … }
void CppObjGenerator::GenClassDef(const Descriptor* msg, Printer* p) const { … }
}
}
int main(int argc, char** argv) { … }