34namespace serialization {
133 "Converting deserialized quantity to target unit");
146namespace derived_serialization {
155 static_assert(
is_compound_v<Tag>,
"derived_serialization::to_json requires a compound quantity");
175 static_assert(
is_compound_v<Tag>,
"derived_serialization::from_json requires a compound type");
Core quantity template and error translation utilities.
Quantity< typename ExtractTag< T >::type > from_json(std::string_view json)
Deserialize a JSON string into a compound quantity.
std::string to_json(const Quantity< Tag > &q)
Serialize a compound quantity as JSON.
Quantity< typename ExtractTag< T >::type > from_json_value(std::string_view json)
Deserialize a JSON numeric value into a typed quantity.
std::string to_json(const Quantity< UnitTag > &q)
Serialize a typed quantity as JSON object with value and unit id.
std::string to_json_value(const Quantity< UnitTag > &q)
Serialize only the numeric value as JSON for a typed quantity.
UnitId unit_id_from_u32(uint32_t raw)
Quantity< typename ExtractTag< T >::type > from_json(std::string_view json)
Deserialize a JSON quantity object into a requested target type.
std::string from_owned_c(char *ptr)
Convert an owned C string from FFI into std::string and free it.
constexpr bool is_angular_v
void check_status(QttyStatus status, const char *operation)
Convert qtty FFI status codes into typed C++ exceptions.
int32_t qtty_quantity_from_json_value(UnitId unit, const char *json, qtty_quantity_t *out)
void qtty_string_free(char *s)
int32_t qtty_derived_from_json(const char *json, qtty_derived_quantity_t *out)
int32_t qtty_quantity_from_json(const char *json, qtty_quantity_t *out)
int32_t qtty_quantity_to_json_value(qtty_quantity_t src, char **out_json)
int32_t qtty_derived_to_json(qtty_derived_quantity_t src, char **out)
int32_t qtty_quantity_to_json(qtty_quantity_t src, char **out_json)