[ox/model] Rename and fix isBString helpers
All checks were successful
Build / build (push) Successful in 1m8s
All checks were successful
Build / build (push) Successful in 1m8s
This commit is contained in:
2
deps/ox/src/ox/model/descwrite.hpp
vendored
2
deps/ox/src/ox/model/descwrite.hpp
vendored
@@ -187,7 +187,7 @@ constexpr ox::Error TypeDescWriter::setTypeInfo(
|
|||||||
PrimitiveType pt;
|
PrimitiveType pt;
|
||||||
if constexpr(is_union_v<T>) {
|
if constexpr(is_union_v<T>) {
|
||||||
pt = PrimitiveType::Union;
|
pt = PrimitiveType::Union;
|
||||||
} else if constexpr(isBasicString_v<T> || isBString_v<T>) {
|
} else if constexpr(isBasicString_v<T> || isIString_v<T>) {
|
||||||
pt = PrimitiveType::String;
|
pt = PrimitiveType::String;
|
||||||
} else {
|
} else {
|
||||||
pt = PrimitiveType::Struct;
|
pt = PrimitiveType::Struct;
|
||||||
|
|||||||
2
deps/ox/src/ox/model/modelvalue.hpp
vendored
2
deps/ox/src/ox/model/modelvalue.hpp
vendored
@@ -100,7 +100,7 @@ class ModelValue {
|
|||||||
return Type::Union;
|
return Type::Union;
|
||||||
} else if constexpr(is_same_v<U, ModelObject>) {
|
} else if constexpr(is_same_v<U, ModelObject>) {
|
||||||
return Type::Object;
|
return Type::Object;
|
||||||
} else if constexpr(isBasicString_v<U> || isBString_v<U>) {
|
} else if constexpr(isBasicString_v<U> || isIString_v<U>) {
|
||||||
return Type::String;
|
return Type::String;
|
||||||
} else if constexpr(is_same_v<U, ModelValueVector>) {
|
} else if constexpr(is_same_v<U, ModelValueVector>) {
|
||||||
return Type::Vector;
|
return Type::Vector;
|
||||||
|
|||||||
30
deps/ox/src/ox/model/types.hpp
vendored
30
deps/ox/src/ox/model/types.hpp
vendored
@@ -31,18 +31,18 @@
|
|||||||
namespace ox {
|
namespace ox {
|
||||||
|
|
||||||
namespace types {
|
namespace types {
|
||||||
constexpr StringView BasicString = "net.drinkingtea.ox.BasicString";
|
constexpr StringLiteral BasicString = "net.drinkingtea.ox.BasicString";
|
||||||
constexpr StringView IString = "net.drinkingtea.ox.IString";
|
constexpr StringLiteral IString = "net.drinkingtea.ox.IString";
|
||||||
constexpr StringView String = "B.string";
|
constexpr StringLiteral String = "B.string";
|
||||||
constexpr StringView Bool = "B.bool";
|
constexpr StringLiteral Bool = "B.bool";
|
||||||
constexpr StringView Uint8 = "B.uint8";
|
constexpr StringLiteral Uint8 = "B.uint8";
|
||||||
constexpr StringView Uint16 = "B.uint16";
|
constexpr StringLiteral Uint16 = "B.uint16";
|
||||||
constexpr StringView Uint32 = "B.uint32";
|
constexpr StringLiteral Uint32 = "B.uint32";
|
||||||
constexpr StringView Uint64 = "B.uint64";
|
constexpr StringLiteral Uint64 = "B.uint64";
|
||||||
constexpr StringView Int8 = "B.int8";
|
constexpr StringLiteral Int8 = "B.int8";
|
||||||
constexpr StringView Int16 = "B.int16";
|
constexpr StringLiteral Int16 = "B.int16";
|
||||||
constexpr StringView Int32 = "B.int32";
|
constexpr StringLiteral Int32 = "B.int32";
|
||||||
constexpr StringView Int64 = "B.int64";
|
constexpr StringLiteral Int64 = "B.int64";
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
@@ -63,17 +63,17 @@ static_assert(isBasicString_v<ox::BasicString<8ul>>);
|
|||||||
static_assert(isBasicString_v<ox::String>);
|
static_assert(isBasicString_v<ox::String>);
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
consteval bool isBString(const T*) noexcept {
|
consteval bool isIString(const T*) noexcept {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t SmallVecSize>
|
template<std::size_t SmallVecSize>
|
||||||
consteval bool isBString(const BasicString<SmallVecSize>*) noexcept {
|
consteval bool isIString(const BasicString<SmallVecSize>*) noexcept {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
constexpr bool isBString_v = isBasicString(static_cast<const T*>(nullptr));
|
constexpr bool isIString_v = isIString(static_cast<const T*>(nullptr));
|
||||||
|
|
||||||
static_assert(isBasicString_v<ox::BasicString<0ul>>);
|
static_assert(isBasicString_v<ox::BasicString<0ul>>);
|
||||||
static_assert(isBasicString_v<ox::BasicString<8ul>>);
|
static_assert(isBasicString_v<ox::BasicString<8ul>>);
|
||||||
|
|||||||
Reference in New Issue
Block a user