This commit is contained in:
2
deps/ox/src/ox/model/descwrite.hpp
vendored
2
deps/ox/src/ox/model/descwrite.hpp
vendored
@@ -357,7 +357,7 @@ constexpr const DescriptorType *TypeDescWriter::type(const char*) const noexcept
|
||||
template<std::size_t sz>
|
||||
constexpr const DescriptorType *TypeDescWriter::type(const IString<sz>*) const noexcept {
|
||||
constexpr auto PT = PrimitiveType::String;
|
||||
return getType(types::BString, 0, PT, 0);
|
||||
return getType(types::IString, 0, PT, 0);
|
||||
}
|
||||
|
||||
constexpr const DescriptorType *TypeDescWriter::getType(StringViewCR tn, int typeVersion, PrimitiveType pt, int b,
|
||||
|
||||
3
deps/ox/src/ox/model/modelvalue.cpp
vendored
3
deps/ox/src/ox/model/modelvalue.cpp
vendored
@@ -20,4 +20,7 @@ static_assert([]() -> ox::Error {
|
||||
return {};
|
||||
}() == ox::Error{});
|
||||
|
||||
// a dummy function to prevent linker errors in a library that has no other symbols
|
||||
void modelDummyFunc() noexcept {}
|
||||
|
||||
}
|
||||
|
||||
2
deps/ox/src/ox/model/modelvalue.hpp
vendored
2
deps/ox/src/ox/model/modelvalue.hpp
vendored
@@ -1098,7 +1098,7 @@ constexpr Error ModelValue::setType(
|
||||
} else if (type->typeName == types::Bool) {
|
||||
m_type = Type::Bool;
|
||||
} else if (type->typeName == types::BasicString ||
|
||||
type->typeName == types::BString ||
|
||||
type->typeName == types::IString ||
|
||||
type->typeName == types::String) {
|
||||
m_type = Type::String;
|
||||
m_data.str = new String;
|
||||
|
||||
6
deps/ox/src/ox/model/types.hpp
vendored
6
deps/ox/src/ox/model/types.hpp
vendored
@@ -32,7 +32,7 @@ namespace ox {
|
||||
|
||||
namespace types {
|
||||
constexpr StringView BasicString = "net.drinkingtea.ox.BasicString";
|
||||
constexpr StringView BString = "net.drinkingtea.ox.BString";
|
||||
constexpr StringView IString = "net.drinkingtea.ox.IString";
|
||||
constexpr StringView String = "B.string";
|
||||
constexpr StringView Bool = "B.bool";
|
||||
constexpr StringView Uint8 = "B.uint8";
|
||||
@@ -169,12 +169,12 @@ constexpr bool isSmartPtr_v<::std::unique_ptr<T>> = true;
|
||||
#endif
|
||||
|
||||
|
||||
template<typename Union, bool force = false>
|
||||
template<typename Union, bool force = false> requires(force || is_union_v<Union>)
|
||||
class UnionView {
|
||||
|
||||
protected:
|
||||
int m_idx = -1;
|
||||
typename enable_if<is_union_v<Union> || force, Union>::type *m_union = nullptr;
|
||||
Union *m_union = nullptr;
|
||||
|
||||
public:
|
||||
constexpr UnionView(Union *u, int idx) noexcept: m_idx(idx), m_union(u) {
|
||||
|
||||
26
deps/ox/src/ox/std/test/tests.cpp
vendored
26
deps/ox/src/ox/std/test/tests.cpp
vendored
@@ -539,18 +539,20 @@ OX_CLANG_NOWARN_END
|
||||
{
|
||||
"intToStr",
|
||||
[] {
|
||||
oxExpect(ox::intToStr(static_cast<int8_t>(127)), "127");
|
||||
oxExpect(ox::intToStr(static_cast<int8_t>(-128)), "-128");
|
||||
oxExpect(ox::intToStr(static_cast<uint8_t>(255)), "255");
|
||||
oxExpect(ox::intToStr(static_cast<uint16_t>(65535)), "65535");
|
||||
oxExpect(ox::intToStr(static_cast<int16_t>(32767)), "32767");
|
||||
oxExpect(ox::intToStr(static_cast<int16_t>(-32768)), "-32768");
|
||||
oxExpect(ox::intToStr(static_cast<uint32_t>(4294967295)), "4294967295");
|
||||
oxExpect(ox::intToStr(static_cast<int32_t>(2147483647)), "2147483647");
|
||||
oxExpect(ox::intToStr(static_cast<int32_t>(-2147483648)), "-2147483648");
|
||||
oxExpect(ox::intToStr(static_cast<uint64_t>(18446744073709551615u)), "18446744073709551615");
|
||||
oxExpect(ox::intToStr(static_cast<int64_t>(9223372036854775807)), "9223372036854775807");
|
||||
oxExpect(ox::intToStr(static_cast<int64_t>(-9223372036854775807)), "-9223372036854775807");
|
||||
oxExpect(ox::intToStr<uint8_t>(255u), "255");
|
||||
oxExpect(ox::intToStr<int8_t>(127), "127");
|
||||
oxExpect(ox::intToStr<int8_t>(-128), "-128");
|
||||
oxExpect(ox::intToStr<uint16_t>(65535u), "65535");
|
||||
oxExpect(ox::intToStr<int16_t>(32767), "32767");
|
||||
oxExpect(ox::intToStr<int16_t>(-32768), "-32768");
|
||||
oxExpect(ox::intToStr<uint32_t>(4294967295u), "4294967295");
|
||||
oxExpect(ox::intToStr<int32_t>(2147483647), "2147483647");
|
||||
oxExpect(ox::intToStr<int32_t>(-2147483648), "-2147483648");
|
||||
oxExpect(ox::intToStr<uint64_t>(18446744073709551615u), "18446744073709551615");
|
||||
oxExpect(ox::intToStr<int64_t>(9223372036854775807), "9223372036854775807");
|
||||
oxExpect(ox::intToStr<int64_t>(-9223372036854775807), "-9223372036854775807");
|
||||
oxExpect(ox::intToStr<uint64_t>(0), "0");
|
||||
oxExpect(ox::intToStr<uint64_t>(5), "5");
|
||||
oxExpect(ox::intToStr(0), "0");
|
||||
oxExpect(ox::intToStr(5), "5");
|
||||
oxExpect(ox::intToStr(5000), "5000");
|
||||
|
||||
14
deps/ox/src/ox/std/typetraits.hpp
vendored
14
deps/ox/src/ox/std/typetraits.hpp
vendored
@@ -180,20 +180,6 @@ struct is_same<T, T>: true_type {};
|
||||
template<typename T, typename U>
|
||||
constexpr auto is_same_v = is_same<T, U>::value;
|
||||
|
||||
// enable_if ///////////////////////////////////////////////////////////////////
|
||||
|
||||
template<bool B, class T = void>
|
||||
struct enable_if {
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct enable_if<true, T> {
|
||||
using type = T;
|
||||
};
|
||||
|
||||
template<bool B, typename T>
|
||||
using enable_if_t = typename enable_if<B, T>::type;
|
||||
|
||||
template<typename T>
|
||||
struct is_pointer {
|
||||
static constexpr bool value = false;
|
||||
|
||||
Reference in New Issue
Block a user