first commit
This commit is contained in:
commit
7dd9dd689e
40 changed files with 4100 additions and 0 deletions
58
ProtoGen/ProtoOutput.h
Normal file
58
ProtoGen/ProtoOutput.h
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <optional>
|
||||
#include <variant>
|
||||
|
||||
// Declaraciones de estructuras
|
||||
|
||||
namespace proto {
|
||||
struct FieldComment {
|
||||
size_t offset;
|
||||
uint32_t xor_const;
|
||||
};
|
||||
|
||||
struct Field {
|
||||
std::string kind;
|
||||
std::string name;
|
||||
uint32_t number;
|
||||
std::optional<FieldComment> comment;
|
||||
};
|
||||
|
||||
struct Oneof {
|
||||
std::string name;
|
||||
std::vector<Field> fields;
|
||||
};
|
||||
|
||||
struct Enum {
|
||||
std::string name;
|
||||
std::vector<std::pair<std::string, int32_t>> variants;
|
||||
};
|
||||
|
||||
struct Message {
|
||||
uint16_t cmd_id;
|
||||
std::string name;
|
||||
std::vector<Field> fields;
|
||||
std::vector<Oneof> oneofs;
|
||||
};
|
||||
|
||||
using ProtoItem = std::variant<Message, Enum>;
|
||||
struct ProtoFile {
|
||||
std::string syntax;
|
||||
std::vector<std::string> imports;
|
||||
std::vector<ProtoItem> items;
|
||||
};
|
||||
|
||||
// Declaración de operadores de salida
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const FieldComment& c);
|
||||
std::ostream& operator<<(std::ostream& os, const Field& f);
|
||||
std::ostream& operator<<(std::ostream& os, const Oneof& o);
|
||||
std::ostream& operator<<(std::ostream& os, const Enum& e);
|
||||
std::ostream& operator<<(std::ostream& os, const Message& m);
|
||||
std::ostream& operator<<(std::ostream& os, const ProtoItem& item);
|
||||
std::ostream& operator<<(std::ostream& os, const ProtoFile& pf);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue