![]() |
qtty-cpp
Header-only C++ wrapper for qtty
|
Functions | |
| std::string | from_owned_c (char *ptr) |
| Convert an owned C string from FFI into std::string and free it. | |
| template<typename UnitTag > | |
| std::string | to_json_value (const Quantity< UnitTag > &q) |
| Serialize only the numeric value as JSON for a typed quantity. | |
| template<typename T > | |
| Quantity< typename ExtractTag< T >::type > | from_json_value (std::string_view json) |
| Deserialize a JSON numeric value into a typed quantity. | |
| template<typename UnitTag > | |
| std::string | to_json (const Quantity< UnitTag > &q) |
| Serialize a typed quantity as JSON object with value and unit id. | |
| UnitId | unit_id_from_u32 (uint32_t raw) |
| template<typename T > | |
| Quantity< typename ExtractTag< T >::type > | from_json (std::string_view json) |
| Deserialize a JSON quantity object into a requested target type. | |
| Quantity< typename ExtractTag< T >::type > qtty::serialization::from_json | ( | std::string_view | json | ) |
Deserialize a JSON quantity object into a requested target type.
| T | Unit tag or Quantity type of the target. |
| json | JSON input string view. |
Definition at line 119 of file serialization.hpp.
References qtty::check_status(), qtty_quantity_from_json(), and qtty::Quantity< UnitTag >::value().
| Quantity< typename ExtractTag< T >::type > qtty::serialization::from_json_value | ( | std::string_view | json | ) |
Deserialize a JSON numeric value into a typed quantity.
| T | Unit tag or Quantity type of the target. |
| json | JSON input string view. |
Definition at line 75 of file serialization.hpp.
References qtty::check_status(), qtty_quantity_from_json_value(), and qtty::Quantity< UnitTag >::value().
|
inline |
Convert an owned C string from FFI into std::string and free it.
| ptr | Pointer allocated by qtty-ffi. |
ptr is null). Definition at line 39 of file serialization.hpp.
References qtty_string_free().
Referenced by to_json(), and to_json_value().
Serialize a typed quantity as JSON object with value and unit id.
| UnitTag | Unit tag of the source quantity. |
| q | Source quantity. |
Definition at line 93 of file serialization.hpp.
References qtty::check_status(), from_owned_c(), qtty_quantity_to_json(), and qtty::Quantity< UnitTag >::value().
Serialize only the numeric value as JSON for a typed quantity.
| UnitTag | Unit tag of the source quantity. |
| q | Source quantity. |
Definition at line 57 of file serialization.hpp.
References qtty::check_status(), from_owned_c(), qtty_quantity_to_json_value(), and qtty::Quantity< UnitTag >::value().
Definition at line 104 of file serialization.hpp.