def print_class()

in tools/cripts/genconfig.py [0:0]


def print_class(tree, cur="", indent=0):
    firstInstance = True
    for k in tree.keys():
        if isinstance(tree[k], dict):
            if indent > 0:
                indentp("private:", indent - 1)
                if cur == "proxy":
                    indentp("friend class cripts::Context; // Needed to set the state", indent)
                    print()
            indentp("class {}".format(k.title()), indent)
            indentp("{", indent)
            print_class(tree[k], k, indent + 1)
        else:
            if firstInstance:
                indentp("public:", indent - 1)
                firstInstance = False
            if tree[k][1] == "TS_RECORDDATATYPE_INT":
                indentp("cripts::IntConfig {}{{\"{}\"}};".format(k, tree[k][2]), indent)
            elif tree[k][1] == "TS_RECORDDATATYPE_FLOAT":
                indentp("cripts::FloatConfig {}{{\"{}\"}};".format(k, tree[k][2]), indent)
            elif tree[k][1] == "TS_RECORDDATATYPE_STRING":
                indentp("cripts::StringConfig {}{{\"{}\"}};".format(k, tree[k][2]), indent)
            else:
                print("The source file has a bad configuration data type: {}".format(tree[k][1]))
    if cur:
        indentp("}}; // End class {}".format(cur.title()), indent - 1)
        print()
        if cur != "proxy":
            indentp("public:", indent - 2)
            indentp("{} {};".format(cur.title(), cur), indent - 1)
            print()