esphome-api-client 0.5.0
Modern C++17 client for the ESPHome native API (plaintext + Noise)
Loading...
Searching...
No Matches
Classes | Enumerations | Functions
protogen Namespace Reference

Classes

struct  ProtoEnum
 
struct  ProtoEnumValue
 
struct  ProtoField
 
struct  ProtoFile
 
struct  ProtoMessageDef
 
struct  Token
 

Enumerations

enum class  TokKind {
  Identifier , Number , String , Symbol ,
  End
}
 
enum class  FieldType {
  Double , Float , Int32 , Int64 ,
  Uint32 , Uint64 , Sint32 , Sint64 ,
  Fixed32 , Fixed64 , Sfixed32 , Sfixed64 ,
  Bool , String , Bytes , Enum ,
  Message
}
 

Functions

std::string cpp_ident (const std::string &name)
 
std::string cpp_element_type (const ProtoField &f)
 
void emit_enums (const ProtoFile &file, const std::string &out_dir)
 
void emit_messages (const ProtoFile &file, const std::string &include_dir, const std::string &src_dir)
 
void emit_registry (const ProtoFile &file, const std::string &include_dir, const std::string &src_dir)
 
std::vector< Tokenlex (const std::string &src, const std::string &filename)
 Tokenize proto source. Throws std::runtime_error on a lexical error.
 
bool is_scalar_type (const std::string &t)
 True for the 15 proto3 scalar keywords.
 
int wire_type_of (const ProtoField &f)
 Wire type number (0/1/2/5) for a resolved field.
 
bool is_packed (const ProtoField &f)
 True if a repeated field of this type is packed (honoring explicit flag).
 
void parse_into (const std::vector< Token > &tokens, const std::string &filename, ProtoFile &file)
 Parse one proto file's tokens, appending its enums/messages to file.
 
void resolve_types (ProtoFile &file)
 Resolve every field's type_name to FieldType::Enum / FieldType::Message (or a scalar).
 

Enumeration Type Documentation

◆ FieldType

enum class protogen::FieldType
strong
Enumerator
Double 
Float 
Int32 
Int64 
Uint32 
Uint64 
Sint32 
Sint64 
Fixed32 
Fixed64 
Sfixed32 
Sfixed64 
Bool 
String 
Bytes 
Enum 
Message 

◆ TokKind

enum class protogen::TokKind
strong
Enumerator
Identifier 
Number 
String 
Symbol 
End 

Function Documentation

◆ cpp_element_type()

std::string protogen::cpp_element_type ( const ProtoField f)

◆ cpp_ident()

std::string protogen::cpp_ident ( const std::string &  name)

◆ emit_enums()

void protogen::emit_enums ( const ProtoFile file,
const std::string &  out_dir 
)

◆ emit_messages()

void protogen::emit_messages ( const ProtoFile file,
const std::string &  include_dir,
const std::string &  src_dir 
)

◆ emit_registry()

void protogen::emit_registry ( const ProtoFile file,
const std::string &  include_dir,
const std::string &  src_dir 
)

◆ is_packed()

bool protogen::is_packed ( const ProtoField f)

True if a repeated field of this type is packed (honoring explicit flag).

◆ is_scalar_type()

bool protogen::is_scalar_type ( const std::string &  t)

True for the 15 proto3 scalar keywords.

◆ lex()

std::vector< Token > protogen::lex ( const std::string &  src,
const std::string &  filename 
)

Tokenize proto source. Throws std::runtime_error on a lexical error.

◆ parse_into()

void protogen::parse_into ( const std::vector< Token > &  tokens,
const std::string &  filename,
ProtoFile file 
)

Parse one proto file's tokens, appending its enums/messages to file.

Throws std::runtime_error on any unsupported construct.

◆ resolve_types()

void protogen::resolve_types ( ProtoFile file)

Resolve every field's type_name to FieldType::Enum / FieldType::Message (or a scalar).

Throws if a type name is unknown.

◆ wire_type_of()

int protogen::wire_type_of ( const ProtoField f)

Wire type number (0/1/2/5) for a resolved field.