Example #1
0
def generate_h(struct: Struct):
    header = Header()
    header.set_header_guard(
        "__{uname}_{proj}_DB_ENTITY_STRUCT_{name}_H".format(
            name=struct.name.upper(),
            proj=proj_name.upper(),
            uname=os.getlogin()))
    header.add_pragma("once")
    header.add_local_include("db/orm/entity.h")
    header.add_struct(struct)
    return str(header)
Example #2
0
def generate_entity_h(structs: List[Struct]):
    entity_h = Header()
    entity_h.set_header_guard("__{name}_{proj}_DB_ENTITY_H".format(
        name=os.getlogin().upper(), proj=proj_name.upper()))
    entity_h.add_pragma("once")
    entity_h.add_global_include("string.h")
    entity_h.add_global_include("stdlib.h")
    entity_h.add_global_include("mysql/mysql.h")

    entity_h.add_local_include("db/dbc.h")

    for struct in structs:
        entity_h.add_local_include(f"db/orm/{struct.name}.h")

    return str(entity_h)