ReUseX
0.0.5
3D Point Cloud Processing for Building Reuse
Toggle main menu visibility
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
10
namespace
reusex::core::traits
{
11
18
enum class
PropertyType
{
20
String
,
21
23
Integer
,
24
26
Double
,
27
29
Boolean
,
30
32
TriState
,
33
35
StringArray
,
36
38
EnumValue
,
39
41
EnumArray
,
42
44
ObjectArray
45
};
46
53
constexpr
std::string_view
to_data_type_string
(
PropertyType
type)
noexcept
{
54
switch
(type) {
55
case
PropertyType::String
:
56
return
"string"
;
57
case
PropertyType::Integer
:
58
return
"integer"
;
59
case
PropertyType::Double
:
60
return
"double"
;
61
case
PropertyType::Boolean
:
62
return
"boolean"
;
63
case
PropertyType::TriState
:
64
return
"tristate"
;
65
case
PropertyType::StringArray
:
66
return
"string_array"
;
67
case
PropertyType::EnumValue
:
68
return
"enum"
;
69
case
PropertyType::EnumArray
:
70
return
"enum_array"
;
71
case
PropertyType::ObjectArray
:
72
return
"object_array"
;
73
}
74
return
"unknown"
;
75
}
76
83
inline
std::optional<PropertyType>
84
property_type_from_string
(std::string_view str)
noexcept
{
85
if
(str ==
"string"
)
86
return
PropertyType::String
;
87
if
(str ==
"integer"
)
88
return
PropertyType::Integer
;
89
if
(str ==
"double"
)
90
return
PropertyType::Double
;
91
if
(str ==
"boolean"
)
92
return
PropertyType::Boolean
;
93
if
(str ==
"tristate"
)
94
return
PropertyType::TriState
;
95
if
(str ==
"string_array"
)
96
return
PropertyType::StringArray
;
97
if
(str ==
"enum"
)
98
return
PropertyType::EnumValue
;
99
if
(str ==
"enum_array"
)
100
return
PropertyType::EnumArray
;
101
if
(str ==
"object_array"
)
102
return
PropertyType::ObjectArray
;
103
104
return
std::nullopt;
105
}
106
107
}
// namespace reusex::core::traits
reusex::core::traits
Definition
materialepas_property_types.hpp:10
reusex::core::traits::to_data_type_string
constexpr std::string_view to_data_type_string(PropertyType type) noexcept
Convert PropertyType to database data_type string.
Definition
materialepas_property_types.hpp:53
reusex::core::traits::PropertyType
PropertyType
Property type enumeration for MaterialPassport serialization.
Definition
materialepas_property_types.hpp:18
reusex::core::traits::PropertyType::String
@ String
std::string
Definition
materialepas_property_types.hpp:20
reusex::core::traits::PropertyType::Boolean
@ Boolean
std::optional<bool>
Definition
materialepas_property_types.hpp:29
reusex::core::traits::PropertyType::EnumValue
@ EnumValue
Enum values (Material, etc.).
Definition
materialepas_property_types.hpp:38
reusex::core::traits::PropertyType::EnumArray
@ EnumArray
std::vector<EnumType>
Definition
materialepas_property_types.hpp:41
reusex::core::traits::PropertyType::StringArray
@ StringArray
std::vector<std::string>
Definition
materialepas_property_types.hpp:35
reusex::core::traits::PropertyType::Integer
@ Integer
std::optional<int>
Definition
materialepas_property_types.hpp:23
reusex::core::traits::PropertyType::TriState
@ TriState
TriState enum (yes/no/unknown).
Definition
materialepas_property_types.hpp:32
reusex::core::traits::PropertyType::Double
@ Double
std::optional<double>
Definition
materialepas_property_types.hpp:26
reusex::core::traits::PropertyType::ObjectArray
@ ObjectArray
std::vector<StructType> (nested objects)
Definition
materialepas_property_types.hpp:44
reusex::core::traits::property_type_from_string
std::optional< PropertyType > property_type_from_string(std::string_view str) noexcept
Convert database data_type string to PropertyType.
Definition
materialepas_property_types.hpp:84
reusex::core::TriState
TriState
Tri-state value for Yes/No/Unknown fields.
Definition
materialepas_enums.hpp:155
libs
reusex
include
core
materialepas_property_types.hpp
Generated by
1.17.0