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
46
53constexpr std::string_view to_data_type_string(PropertyType type) noexcept {
54 switch (type) {
56 return "string";
58 return "integer";
60 return "double";
62 return "boolean";
64 return "tristate";
66 return "string_array";
68 return "enum";
70 return "enum_array";
72 return "object_array";
73 }
74 return "unknown";
75}
76
83inline std::optional<PropertyType>
84property_type_from_string(std::string_view str) noexcept {
85 if (str == "string")
87 if (str == "integer")
89 if (str == "double")
91 if (str == "boolean")
93 if (str == "tristate")
95 if (str == "string_array")
97 if (str == "enum")
99 if (str == "enum_array")
101 if (str == "object_array")
103
104 return std::nullopt;
105}
106
107} // 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.