ReUseX
0.0.5
3D Point Cloud Processing for Building Reuse
Toggle main menu visibility
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
7
#include "
MaterialPassport.hpp
"
8
#include "
materialepas_traits.hpp
"
9
10
#include <nlohmann/json.hpp>
11
12
#include <span>
13
#include <string>
14
#include <vector>
15
16
namespace
reusex::core::json_export
{
17
24
struct
SectionDescriptor
{
26
const
char
*
name_en
;
27
29
const
char
*
name_da
;
30
32
const
traits::PropertyDescriptor
*
properties
;
33
35
size_t
property_count
;
36
38
size_t
passport_offset
;
39
};
40
51
std::span<const SectionDescriptor>
section_descriptors
();
52
62
[[nodiscard]] nlohmann::json
to_json
(
const
MaterialPassport
&passport);
63
79
[[nodiscard]] nlohmann::json
80
to_json_with_defaults
(
const
MaterialPassport
&passport);
81
99
[[nodiscard]] nlohmann::json
generate_blank_template
();
100
109
[[nodiscard]] nlohmann::json
110
to_json
(
const
std::vector<MaterialPassport> &passports);
111
119
[[nodiscard]] std::string
to_json_string
(
const
MaterialPassport
&passport,
120
int
indent = 4);
121
129
[[nodiscard]] std::string
130
to_json_string
(
const
std::vector<MaterialPassport> &passports,
int
indent = 4);
131
132
}
// namespace reusex::core::json_export
MaterialPassport.hpp
materialepas_traits.hpp
reusex::core::json_export
Definition
materialepas_json_export.hpp:16
reusex::core::json_export::generate_blank_template
nlohmann::json generate_blank_template()
Generate a blank MaterialPassport template as JSON.
reusex::core::json_export::to_json_string
std::string to_json_string(const MaterialPassport &passport, int indent=4)
Export a single passport as a formatted JSON string.
reusex::core::json_export::to_json
nlohmann::json to_json(const MaterialPassport &passport)
Export a single MaterialPassport to JSON.
reusex::core::json_export::to_json_with_defaults
nlohmann::json to_json_with_defaults(const MaterialPassport &passport)
Export a single MaterialPassport to JSON with sensible defaults.
reusex::core::json_export::section_descriptors
std::span< const SectionDescriptor > section_descriptors()
Get the section descriptors in JSON template order.
reusex::core::MaterialPassport
A complete material passport for a reused building material.
Definition
MaterialPassport.hpp:82
reusex::core::json_export::SectionDescriptor
Describes a section in the JSON export template.
Definition
materialepas_json_export.hpp:24
reusex::core::json_export::SectionDescriptor::passport_offset
size_t passport_offset
Offset of the section struct within MaterialPassport.
Definition
materialepas_json_export.hpp:38
reusex::core::json_export::SectionDescriptor::property_count
size_t property_count
Number of properties in the array.
Definition
materialepas_json_export.hpp:35
reusex::core::json_export::SectionDescriptor::name_en
const char * name_en
English section name (e.g., "Owner").
Definition
materialepas_json_export.hpp:26
reusex::core::json_export::SectionDescriptor::name_da
const char * name_da
Danish section name (e.g., "Ejer").
Definition
materialepas_json_export.hpp:29
reusex::core::json_export::SectionDescriptor::properties
const traits::PropertyDescriptor * properties
Pointer to property descriptor array for this section.
Definition
materialepas_json_export.hpp:32
reusex::core::traits::PropertyDescriptor
Property metadata descriptor.
Definition
materialepas_traits.hpp:20
libs
reusex
include
core
materialepas_json_export.hpp
Generated by
1.17.0