[Yunq] Move to using jinja for codegen.
This commit is contained in:
parent
3faa19e4cb
commit
963cc0b4fa
8 changed files with 283 additions and 411 deletions
|
|
@ -102,11 +102,22 @@ type_str_dict = {
|
|||
"capability": Type.CAPABILITY,
|
||||
}
|
||||
|
||||
type_to_cppstr = {
|
||||
Type.U64: "uint64_t",
|
||||
Type.I64: "int64_t",
|
||||
Type.STRING: "glcr::String",
|
||||
Type.CAPABILITY: "z_cap_t",
|
||||
Type.BYTES: "glcr::Vector<uint8_t>"
|
||||
}
|
||||
|
||||
class Field():
|
||||
def __init__(self, fieldtype: Type, name: str):
|
||||
self.type = fieldtype
|
||||
self.name = name
|
||||
|
||||
def cpp_type(self):
|
||||
return type_to_cppstr[self.type]
|
||||
|
||||
class Message():
|
||||
def __init__(self, name: str, fields: list[Field]):
|
||||
self.name = name
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue