ReUseX  0.0.5
3D Point Cloud Processing for Building Reuse
Loading...
Searching...
No Matches
materialepas_property_types.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 <optional>
8#include <string_view>
9
11
45
52constexpr std::string_view to_data_type_string(PropertyType type) noexcept {
53 switch (type) {
55 return "string";
57 return "integer";
59 return "double";
61 return "boolean";
63 return "tristate";
65 return "string_array";
67 return "enum";
69 return "enum_array";
71 return "object_array";
72 }
73 return "unknown";
74}
75
82inline std::optional<PropertyType>
83property_type_from_string(std::string_view str) noexcept {
84 if (str == "string")
86 if (str == "integer")
88 if (str == "double")
90 if (str == "boolean")
92 if (str == "tristate")
94 if (str == "string_array")
96 if (str == "enum")
98 if (str == "enum_array")
100 if (str == "object_array")
102
103 return std::nullopt;
104}
105
106} // namespace reusex::core::traits
constexpr std::string_view to_data_type_string(PropertyType type) noexcept
Convert PropertyType to database data_type string.
PropertyType
Property type enumeration for MaterialPassport serialization.
@ TriState
TriState enum (yes/no/unknown).
@ ObjectArray
std::vector<StructType> (nested objects)
std::optional< PropertyType > property_type_from_string(std::string_view str) noexcept
Convert database data_type string to PropertyType.
TriState
Tri-state value for Yes/No/Unknown fields.