diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2020-03-29 22:59:04 +0300 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2020-03-29 22:59:04 +0300 |
commit | 13771971cfaef6356ba47668cae6ce25c5c2071f (patch) | |
tree | f2706c35edb06cbf43fc18a7c30608dfea67587f /scripts/rcc_format.py | |
parent | Change rcc command line (diff) | |
download | rcc-13771971cfaef6356ba47668cae6ce25c5c2071f.tar.xz |
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
Diffstat (limited to 'scripts/rcc_format.py')
-rw-r--r-- | scripts/rcc_format.py | 13 |
1 files changed, 9 insertions, 4 deletions
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<frozen::string, std::span<const unsigned char>>({", 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) |