an Odin implementation
WSV is just like csv, but it uses standardized whitespaces as separators instead of commas(or whatever else you feel like on that day). For more information about the format, please check the specification here.
By leveraging Odin's reflection we can parse .wsv files and store its values directly on generic structs that have the supported types of .wsv as its members. This package uses the concepts of Array of Structs(AOS) and Struct of Arrays(SOA) to creat a neat generic API. It works on arrays, structs and also #soa Odin arrays.
You are encouraged to look at the code and understand how it works and, if desired, create your own more specific implementations.
- For reading:
read_file_into_struct_of_arrays;read_file_into_array_of_structsReaderwithiterator_nextorread_all
- For writing:
write_struct_of_arrays_to_file;write_struct_of_arrays_to_builder;write_array_of_structs_to_file;write_array_of_structs_to_builder;write_all
- For converting from .wsv to .csv:
convert_to_csv
write_(whatever)_to_builderalways writes using utf8- You can check
examples.odinfor usage examples - The
filesfolder is only used for tests and examples, you can delete it in in your project
These are the things I haven't implemented and am not thinking about implementing, so if you, yes, you, the reader, wants to contribute I would start with them:
- Missing utf32 big and little endian encoding
- Missing conversion from .csv to .wsv
- Missing serialization and deserialization of complex and quaternion types
- Missing unit tests (I only implemented 2 unit tests and the project could for sure use more)