Skip to content

Releases: stephenberry/glaze

v4.4.3

18 Feb 22:10
Compare
Choose a tag to compare

Removed lots of internal macros for the use of Glaze as a C++20 module (in development).

In Development

  • Removed macros in #1614
  • Remove forced reflection for top level structs in repe::registry by @stephenberry in #1623

Full Changelog: v4.4.2...v4.4.3

v4.4.2

14 Feb 17:18
Compare
Choose a tag to compare

Fixes

  • Fix trailing comma for tagged variants with null members in #1609
  • Fix for empty objects with tagged variants in #1610

Improvements

  • Added support for custom static strings by @SlaaneshChosen in #1605
    • Use glaze_static_string = true in your glz::meta for your static string type.

In Development

Full Changelog: v4.4.1...v4.4.2

v4.4.1

07 Feb 22:08
Compare
Choose a tag to compare

Fixes

  • Fix mismatch create function for shared library API (missing noexcept) in #1596
  • Fix ODR violations by @arturbac in #1604

Improvements

  • Safer boolean write to avoid issues with UB booleans (non-initialized booleans) in #1597
  • Add error_handler to asio_server by @stephenberry in #1602

Full Changelog: v4.4.0...v4.4.1

v4.4.0

04 Feb 20:10
Compare
Choose a tag to compare

Improvements

  • Adds feature test macros for recent breaking changes in #1582
  • Unify defines for tests in #1585

Fixes

  • Fix wrong begin/end indices in get_name by @PaideiaDilemma in #1569
  • reflect: fix uint16 compile error in find_unique_sized_index by @timsjostrand in #1575
  • ASAN non null_terminated fix in #1583
  • New CMake option glaze_DISABLE_SIMD_WHEN_SUPPORTED to disable SIMD like AVX2 when cross-compiling by @arturbac in #1590
    • Glaze no longer adds compiler intrinsic flags to its CMake interface definition, and instead relies on the developer's compiler flags

Test Improvements

  • Testing with -Wall and -Werror for GCC (13+) by @stephenberry in #1563
    • Fixed a number of warnings

Full Changelog: v4.3.1...v4.4.0

v4.3.1

13 Jan 17:05
Compare
Choose a tag to compare

Improvements

Fixes

Full Changelog: v4.3.0...v4.3.1

v4.3.0

06 Jan 18:39
Compare
Choose a tag to compare

New append_arrays compile time option

Adds the compile time option (and wrapper) append_arrays, which appends data to types like std::vector rather than overwrite. (#1549)

Example:

std::vector<int> v{};
constexpr glz::opts append_opts{.append_arrays = true};
expect(not glz::read<append_opts>(v, "[1,2,3]"));
expect(v == std::vector<int>{1,2,3});
expect(not glz::read<append_opts>(v, "[4,5,6]"));
expect(v == std::vector<int>{1,2,3,4,5,6});

Improvements

  • Support for dynamically sized Eigen types by @WanZhiQiu-ac in #1541
  • Support for reflection with Eigen vector types in #1552
  • Improved glz::async_string with more methods and std::format support by @stephenberry in #1536, #1538
  • Cleanup of map writing in #1542
  • Fix for always_null_t in object handling and faster always null write in #1545
  • More efficient numerical keys in dynamic maps in #1546

Minor Deprecation

  • Removed global glz::trace in #1544

Because C++ has inline variables and other ways to make global instances it is better to let the programmer handle global instances of glz::trace rather than offer two separate APIs. This also removes the unnecessary glz::write_file_trace as glz::write_file_json(trace is more generic and there is no longer a global instance of the trace.

New Contributors

Full Changelog: v4.2.4...v4.3.0

v4.2.4

02 Jan 16:18
Compare
Choose a tag to compare

Improvements

  • Skipping and tuple cleanup in #1531
  • Faster writing in #1534
  • number option clarification and better errors in #1535

In Development

Full Changelog: v4.2.3...v4.2.4

v4.2.3

26 Dec 20:37
Compare
Choose a tag to compare

Improvements

Fixes

  • Fixed glz::merge with empty objects in #1519 (thanks @SenseOnline)
  • Fixed enum string read for vector of pairs in concatenate mode by @sjanel in #1525

In Development

  • REPE conformance for registry errors in #1526

Full Changelog: v4.2.2...v4.2.3

v4.2.2

18 Dec 15:45
Compare
Choose a tag to compare

Slice support for glz::read_jmespath

std::vector<int> data{0,1,2,3,4,5,6,7,8,9};
std::string buffer{};
expect(not glz::write_json(data, buffer));

std::vector<int> slice{};
expect(not glz::read_jmespath<"[0:5]">(slice, buffer));
expect(slice.size() == 5);
expect(slice[0] == 0);
expect(slice[1] == 1);
expect(slice[2] == 2);
expect(slice[3] == 3);
expect(slice[4] == 4);

Pre-compute JMESPath run-time expressions

The run-time version of glz::read_jmespath also now takes in a const jmespath_expression&. This allows a jmespath_expression to be "compiled" once in the code and reused for much better runtime performance. This caches the tokenization.

Person child{};
// A runtime expression can be pre-computed and saved for more efficient lookups
glz::jmespath_expression expression{"family.children[0]"};
expect(not glz::read_jmespath(expression, child, buffer));
expect(child.first_name == "Lilly");

Note that this still works:

expect(not glz::read_jmespath("family.children[0]", child, buffer));

by @stephenberry in #1510

Fixes

  • Include missing version header that could cause segfaults with GCC in #1508 (Many thanks to @hs-vc)

Full Changelog: v4.2.1...v4.2.2

v4.2.1

17 Dec 17:31
Compare
Choose a tag to compare

First steps for compile-time and run-time JMESPath query support

v4.2.0 neutered the partial_read option, due to its complexity and confusing behavior (and to make it faster). This release brings another approach to partial reading that is far more extensible, by utilizing the JMESPath query specification.

More JMESPath support will be added in the future, but this release brings both compile-time and run-time JMESPath expression handling to read a value at a target location in a buffer.

Example

struct Person
{
   std::string first_name{};
   std::string last_name{};
   uint16_t age{};
};

struct Family
{
   Person father{};
   Person mother{};
   std::vector<Person> children{};
};

struct Home
{
   Family family{};
   std::string address{};
};

suite jmespath_read_at_tests = [] {
   "compile-time read_jmespath"_test = [] {
      Home home{.family = {.father = {"Gilbert", "Fox", 28},
                           .mother = {"Anne", "Fox", 30},
                           .children = {{"Lilly"}, {"Vincent"}}}};

      std::string buffer{};
      expect(not glz::write_json(home, buffer));

      std::string first_name{};
      auto ec = glz::read_jmespath<"family.father.first_name">(first_name, buffer);
      expect(not ec) << glz::format_error(ec, buffer);
      expect(first_name == "Gilbert");

      Person child{};
      expect(not glz::read_jmespath<"family.children[0]">(child, buffer));
      expect(child.first_name == "Lilly");
      expect(not glz::read_jmespath<"family.children[1]">(child, buffer));
      expect(child.first_name == "Vincent");
   };

   "run-time read_jmespath"_test = [] {
      Home home{.family = {.father = {"Gilbert", "Fox", 28},
                           .mother = {"Anne", "Fox", 30},
                           .children = {{"Lilly"}, {"Vincent"}}}};

      std::string buffer{};
      expect(not glz::write_json(home, buffer));

      std::string first_name{};
      auto ec = glz::read_jmespath("family.father.first_name", first_name, buffer);
      expect(not ec) << glz::format_error(ec, buffer);
      expect(first_name == "Gilbert");

      Person child{};
      expect(not glz::read_jmespath("family.children[0]", child, buffer));
      expect(child.first_name == "Lilly");
      expect(not glz::read_jmespath("family.children[1]", child, buffer));
      expect(child.first_name == "Vincent");
   };
};

by @stephenberry in #1509

Other Improvements

Full Changelog: v4.2.0...v4.2.1