esphome-api-client 0.5.0
Modern C++17 client for the ESPHome native API (plaintext + Noise)
Loading...
Searching...
No Matches
emit.hpp
Go to the documentation of this file.
1#pragma once
2
7
8#include "model.hpp"
9
10#include <string>
11
12namespace protogen {
13
14// Append "_" to C++ keywords (e.g. proto message "void" -> "void_"), following
15// the standard proto -> C++ name mangling. Other names are already C++-safe in
16// the vendored proto.
17std::string cpp_ident(const std::string& name);
18
19// C++ element type for a field (the scalar / enum / message type, ignoring
20// `repeated`). Strings and bytes map to std::string.
21std::string cpp_element_type(const ProtoField& f);
22
23// generated/include/esphome/api/proto/api_enums.hpp
24void emit_enums(const ProtoFile& file, const std::string& out_dir);
25
26// generated/include/esphome/api/proto/api_messages.hpp (+ src/api_messages.cpp)
27void emit_messages(const ProtoFile& file, const std::string& include_dir,
28 const std::string& src_dir);
29
30// generated/src/api_registry.cpp + generated/include/esphome/api/proto/message_id.hpp
31void emit_registry(const ProtoFile& file, const std::string& include_dir,
32 const std::string& src_dir);
33
34} // namespace protogen
std::string name
Definition emit_registry.cpp:14
protogen AST for the proto3 subset the ESPHome native API uses — populated by the parser,...
Definition emit.hpp:12
std::string cpp_element_type(const ProtoField &f)
Definition emit_messages.cpp:35
void emit_registry(const ProtoFile &file, const std::string &include_dir, const std::string &src_dir)
Definition emit_registry.cpp:36
std::string cpp_ident(const std::string &name)
Definition emit_messages.cpp:15
void emit_messages(const ProtoFile &file, const std::string &include_dir, const std::string &src_dir)
Definition emit_messages.cpp:534
void emit_enums(const ProtoFile &file, const std::string &out_dir)
Definition emit_enums.cpp:8
Definition model.hpp:33
Definition model.hpp:63