github stephenberry/glaze v2.2.1
2.2.1

latest releases: v8.3.0, v8.2.0, v8.1.0...
2 years ago

glz::raw_or_file

glz::raw_or_file is somewhat like a glz::file_include, but also handles serialization. The purpose is to allow JSON files to be optionally referred to within higher level configuration files, but once loaded, the files behave as glz::raw_json, where the format does not need to be understood until deserialized.

How glz::raw_or_file behaves:
If the input is a valid file path within a string, the entire file will be read into a std::string within the glz::raw_or_file member. The internal buffer does not escape characters, as it is handled like glz::raw_json.
If the input is not a valid file path or not a string, the value is simply validated and stored like glz::raw_json
When serialized, the value is dumped like glz::raw_json, which means it will look like the input file was copied and pasted into the higher level document.

Benefits of this approach include:

  • The layout for the file loaded into glz::raw_or_file does not need to be known by the program. As long as it is valid JSON it can be passed along.
  • The serialized output after loading the file looks like a combined file, which is easier to read and format than an escaped string version of the file. It is also more efficient because escaping/unescaping doesn't need to be performed, only validation.

by @stephenberry in #808

glz::asio_server improvements

  • API changes make it work more like glz::asio_client, which allows setup from a JSON read separate from initialization
  • init for initializing the registry has been renamed to init_registry
  • The port can now be set by the user. It was hardcoded before <face slap!>
    by @stephenberry in #809

Full Changelog: v2.2.0...v2.2.1

Don't miss a new glaze release

NewReleases is sending notifications on new releases.