From 13771971cfaef6356ba47668cae6ce25c5c2071f Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Sun, 29 Mar 2020 22:59:04 +0300 Subject: Drop dependency on serge-sans-paille/frozen format: - instead of frozen::unordered_map, create two std::arrays with the aliased names (entries) and respective data (values) libembed: - Resources and CompressedResources convenience classes for raw and compressed resources respectively - Resources can be constexpr in regular usage - Annotate Resources::decompress accordingly --- scripts/rcc_format.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'scripts/rcc_format.py') diff --git a/scripts/rcc_format.py b/scripts/rcc_format.py index d0ab06d..7fcfe34 100644 --- a/scripts/rcc_format.py +++ b/scripts/rcc_format.py @@ -37,7 +37,7 @@ def write_header(file, namespace): def write_item(file, array_name, array_data): line_items = 0 - print("constexpr unsigned char {}[] = {{".format(array_name), file=file) + print("constexpr uint8_t {}[] = {{".format(array_name), file=file) for byte in array_data[0:len(array_data)]: line_items+=1 @@ -52,10 +52,15 @@ def write_item(file, array_name, array_data): print("constexpr size_t {}_len = {};\n".format(array_name, len(array_data)), file=file) def write_entries(file, resource_list): - print("constexpr auto entries = frozen::make_unordered_map>({", file=file) + print("constexpr std::array entries {", file=file) for f in resource_list: - print(" {{ \"{}\", std::span({}, {}_len) }},".format(f.alias, f.variable, f.variable), file=file) - print("});\n", file=file) + print(" \"{}\", ".format(f.alias), file=file) + print("};\n", file=file) + + print("constexpr std::array values {", file=file) + for f in resource_list: + print(" std::span( {}, {}_len ),".format(f.variable, f.variable), file=file) + print("};\n", file=file) def write_footer(file, namespace): print("\n}} // namespace {}".format(namespace), file=file) -- cgit v1.2.1