21#if defined(WMTK_ENABLED_CPP20)
23 auto tmp = std::ranges::views::split(attribute_path,
"/"sv) |
24 std::views::transform([](
const auto& r)
noexcept -> std::string_view {
25 return std::string_view(r.begin(), r.end());
28 std::array<std::string_view, 2> ret;
29 std::ranges::copy(tmp, ret.begin());
31 std::swap(ret[0], ret[1]);
36 std::array<std::string, 2> ret;
37 std::vector<std::string> tmp;
38 if (attribute_path.empty()) {
43 std::string v = std::string(attribute_path);
44 std::istringstream iss(v);
46 if (v.size() > 0 && v[0] ==
'/') {
49 while (std::getline(iss, token,
'/')) {
50 if (!token.empty()) tmp.emplace_back(token);
53 assert(tmp.size() <= 2);
54 if (tmp.size() == 1) {
58 return std::array<std::string, 2>{{tmp[0], tmp[1]}};
106 const std::string_view& name,
107 std::optional<PrimitiveType> pt,
108 std::optional<wmtk::attribute::AttributeType> type)
112 constexpr static std::array<AT, 4> types{{AT::Char, AT::Int64, AT::Double, AT::Rational}};
114 std::vector<AttributeDescription> possibilities;
122 if (pt.has_value() && type.has_value()) {
123 add_option(pt.value(), type.value());
125 }
else if (pt.has_value()) {
126 for (
AT at : types) {
128 add_option(pt.value(), at);
133 }
else if (type.has_value()) {
136 add_option(p, type.value());
142 for (
AT at : types) {
154 if (possibilities.empty()) {
156 }
else if (possibilities.size() > 1) {