ReUseX  0.0.5
3D Point Cloud Processing for Building Reuse
Loading...
Searching...
No Matches
materialepas_json_export.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2025 Povl Filip Sonne-Frederiksen
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#pragma once
6
9
10#include <nlohmann/json.hpp>
11
12#include <span>
13#include <string>
14#include <vector>
15
17
26 const char *name_en;
27
29 const char *name_da;
30
33
36
39};
40
51std::span<const SectionDescriptor> section_descriptors();
52
62[[nodiscard]] nlohmann::json to_json(const MaterialPassport &passport);
63
79[[nodiscard]] nlohmann::json to_json_with_defaults(const MaterialPassport &passport);
80
98[[nodiscard]] nlohmann::json generate_blank_template();
99
108[[nodiscard]] nlohmann::json
109to_json(const std::vector<MaterialPassport> &passports);
110
118[[nodiscard]] std::string to_json_string(const MaterialPassport &passport,
119 int indent = 4);
120
128[[nodiscard]] std::string
129to_json_string(const std::vector<MaterialPassport> &passports,
130 int indent = 4);
131
132} // namespace reusex::core::json_export
nlohmann::json generate_blank_template()
Generate a blank MaterialPassport template as JSON.
std::string to_json_string(const MaterialPassport &passport, int indent=4)
Export a single passport as a formatted JSON string.
nlohmann::json to_json(const MaterialPassport &passport)
Export a single MaterialPassport to JSON.
nlohmann::json to_json_with_defaults(const MaterialPassport &passport)
Export a single MaterialPassport to JSON with sensible defaults.
std::span< const SectionDescriptor > section_descriptors()
Get the section descriptors in JSON template order.
A complete material passport for a reused building material.
Describes a section in the JSON export template.
size_t passport_offset
Offset of the section struct within MaterialPassport.
size_t property_count
Number of properties in the array.
const char * name_en
English section name (e.g., "Owner").
const char * name_da
Danish section name (e.g., "Ejer").
const traits::PropertyDescriptor * properties
Pointer to property descriptor array for this section.