ReUseX  0.0.5
3D Point Cloud Processing for Building Reuse
Loading...
Searching...
No Matches
reusex::core::json_import Namespace Reference

Functions

MaterialPassport from_json (const nlohmann::json &j)
 Import a single MaterialPassport from a JSON object.
std::vector< MaterialPassportfrom_json_array (const nlohmann::json &j)
 Import multiple MaterialPassports from a JSON array.
std::vector< MaterialPassportfrom_json_string (std::string_view json_str)
 Import MaterialPassport(s) from a JSON string.

Function Documentation

◆ from_json()

MaterialPassport reusex::core::json_import::from_json ( const nlohmann::json & j)
nodiscard

Import a single MaterialPassport from a JSON object.

Parses a JSON object matching the Danish "Materialepas for genbrugte byggevarer" interchange format and populates a MaterialPassport struct.

Parameters
jJSON object containing sections, log, and metadata
Returns
Populated MaterialPassport
Exceptions
std::runtime_errorif required keys are missing

◆ from_json_array()

std::vector< MaterialPassport > reusex::core::json_import::from_json_array ( const nlohmann::json & j)
nodiscard

Import multiple MaterialPassports from a JSON array.

Each element in the array must be a full passport JSON object.

Parameters
jJSON array of passport objects
Returns
Vector of MaterialPassport instances
Exceptions
std::runtime_errorif j is not an array

◆ from_json_string()

std::vector< MaterialPassport > reusex::core::json_import::from_json_string ( std::string_view json_str)
nodiscard

Import MaterialPassport(s) from a JSON string.

Auto-detects whether the string contains a single passport object or an array of passports.

Parameters
json_strJSON string to parse
Returns
Vector of MaterialPassport instances (single-element for objects)
Exceptions
nlohmann::json::parse_errorif the string is not valid JSON
std::runtime_errorif required keys are missing