toml11 icon indicating copy to clipboard operation
toml11 copied to clipboard

Formatting integer values in hexadecimal notation

Open amasciotta opened this issue 3 years ago • 1 comments

Hello! I would like to serialize to file a toml::array. However, I would like to serialize some integers (but not all of them) contained in my data structure using the hexadecimal notation (e.g. 0xA1B2C3D4). Is there a way to do so?

More in general it would be great to have the possibility to specify a custom formatting for some of the values, using a syntax like the fmt library.

amasciotta avatar Feb 01 '21 14:02 amasciotta

Sorry, currently it does not have an API to do that. For an excuse, hexadecimal, octal nor binary numbers were not in the TOML spec when I started this library. But yeah, we need to make it possible. It can be done via the serializer options or adding format-related flags in a toml::value. These months I didn't have much spare time nor mental rest, but I think the situation will improve, hopefully. At least, I want to find a way to do this.

ToruNiina avatar Feb 02 '21 14:02 ToruNiina