Commit Graph
5 Commits
Author SHA1 Message Date
Marc Mutz aee4f97f52 tst_Encoder: port away from Q_FOREACH
Qt is defaulting to QT_NO_FOREACH these days, so make sure we
integrate nicely with downstream and fix the single Q_FOREACH/foreach
user, in tst_encoder.cpp.

Unfortunately, the container's initialization code doesn't exactly
lend itself to making the container const (not even IILE
(Immediately-Invoked Lambda Expression) would help here, due to the
interdependency with `len`), so the idiomatic solution would be to use
std::as_const()/qAsConst().

The former is available from C++17, which we don't require, yet, and
the latter is not available under QT_NO_AS_CONST (the default for Qt
these days), so grab the nettle and implement a t17::as_const() that
switches between a manual implementation of std::as_const and the real
thing, depending on __cpp_lib_as_const. The `t17` here mimicks the qNN
(q20::remove_cvref_t/q23::forward_like/etc) mechanism used in Qt
itself for backports, with s/q/t/ because ... _T_inyCbor.

The t17 implementation is local to tst_encoder.cpp, but can easily be
extracted into a separate header once more users emerge.
2023-08-07 09:08:56 -07:00
Thiago Macieira 2085ad872e Add initial support for building with Visual Studio
cbortojson.c uses open_memstream for part of its functionality, which
isn't available with the Microsoft CRT, so it's excluded.

Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
2016-06-07 17:43:02 -07:00
Thiago Macieira cd724957e1 Use libtinycbor.a from the unit tests too
We then avoid recompiling every time. Exceptions:
 - tst_parser requires a recursion limit set
 - tst_cpp #includes so that the sources are compiled as C++

Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
2015-09-16 12:11:20 -07:00
Thiago Macieira f1cadf0024 Add support for encoding fixed types
Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
2015-05-12 17:45:37 +09:00
Thiago Macieira a43a4efc8d Make the CBOR decoder API begin to work
This commit also starts to add unit tests.

The API, as tested, works. The simplereader.c example is probably broken
and will be fixed later.

Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
2015-05-12 17:45:36 +09:00