Doxygen fixes, style fixes
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
7373f7a26b
commit
8e35267bb0
|
@ -19,11 +19,12 @@ namespace ArbUt {
|
||||||
/// @brief Initialise a OptionalUniquePtr with a specific raw pointer.
|
/// @brief Initialise a OptionalUniquePtr with a specific raw pointer.
|
||||||
inline OptionalUniquePtr<T>(T* nullable ptr) : _raw(ptr){};
|
inline OptionalUniquePtr<T>(T* nullable ptr) : _raw(ptr){};
|
||||||
|
|
||||||
|
/// @brief We do not allow copying or moving of unique pointers, as that would cause memory leaks and use after
|
||||||
|
/// frees.
|
||||||
NO_COPY_OR_MOVE(OptionalUniquePtr);
|
NO_COPY_OR_MOVE(OptionalUniquePtr);
|
||||||
|
|
||||||
~OptionalUniquePtr() noexcept { delete _raw; }
|
~OptionalUniquePtr() noexcept { delete _raw; }
|
||||||
|
|
||||||
|
|
||||||
/// @brief Return whether the pointer is null or not.
|
/// @brief Return whether the pointer is null or not.
|
||||||
[[nodiscard]] inline bool HasValue() const noexcept { return _raw != nullptr; }
|
[[nodiscard]] inline bool HasValue() const noexcept { return _raw != nullptr; }
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,8 @@ namespace ArbUt {
|
||||||
#if defined(__clang__)
|
#if defined(__clang__)
|
||||||
[[clang::no_sanitize("nullability-assign")]]
|
[[clang::no_sanitize("nullability-assign")]]
|
||||||
#endif
|
#endif
|
||||||
inline T* non_null TakeOwnership() noexcept {
|
inline T* non_null
|
||||||
|
TakeOwnership() noexcept {
|
||||||
auto raw = _raw;
|
auto raw = _raw;
|
||||||
_raw = nullptr;
|
_raw = nullptr;
|
||||||
return raw;
|
return raw;
|
||||||
|
|
|
@ -19,6 +19,8 @@ namespace ArbUt {
|
||||||
/// @brief Initialise a UniquePtr with a specific raw pointer.
|
/// @brief Initialise a UniquePtr with a specific raw pointer.
|
||||||
inline UniquePtr<T>(T* non_null ptr) : _raw(ptr){EnsureNotNull(ptr)};
|
inline UniquePtr<T>(T* non_null ptr) : _raw(ptr){EnsureNotNull(ptr)};
|
||||||
|
|
||||||
|
/// @brief We do not allow copying or moving of unique pointers, as that would cause memory leaks and use after
|
||||||
|
/// frees.
|
||||||
NO_COPY_OR_MOVE(UniquePtr);
|
NO_COPY_OR_MOVE(UniquePtr);
|
||||||
|
|
||||||
#if !WINDOWS // This doesn't work on mingw-w64 for some reason
|
#if !WINDOWS // This doesn't work on mingw-w64 for some reason
|
||||||
|
|
|
@ -9,6 +9,6 @@
|
||||||
/* @brief: Copy assignment is not allowed */ \
|
/* @brief: Copy assignment is not allowed */ \
|
||||||
type& operator=(const type&) = delete; \
|
type& operator=(const type&) = delete; \
|
||||||
/* @brief: Copy assignment is not allowed */ \
|
/* @brief: Copy assignment is not allowed */ \
|
||||||
type& operator=(type&&) = delete;
|
type& operator=(type&&) = delete
|
||||||
|
|
||||||
#endif // ARBUTILS_MISC_HPP
|
#endif // ARBUTILS_MISC_HPP
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
|
|
||||||
// PCG uses unsigned shifts, and overflows a lot. Disable the sanitizer for that.
|
// PCG uses unsigned shifts, and overflows a lot. Disable the sanitizer for that.
|
||||||
#if defined(__clang__)
|
#if defined(__clang__)
|
||||||
// If we don't ignore this diagnostic, and the sanitizer is not known yet in the clang version, this spams tens of thousands
|
// If we don't ignore this diagnostic, and the sanitizer is not known yet in the clang version, this spams tens of
|
||||||
// of warnings. Hence we disable it for a bit.
|
// thousands of warnings. Hence we disable it for a bit.
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma clang diagnostic ignored "-Wunknown-sanitizers"
|
#pragma clang diagnostic ignored "-Wunknown-sanitizers"
|
||||||
#pragma clang attribute push(__attribute__((no_sanitize("unsigned-shift-base", "unsigned-integer-overflow"))), \
|
#pragma clang attribute push(__attribute__((no_sanitize("unsigned-shift-base", "unsigned-integer-overflow"))), \
|
||||||
|
|
|
@ -94,7 +94,8 @@ namespace ArbUt {
|
||||||
/// @brief Instantiate a StringView using a C string.
|
/// @brief Instantiate a StringView using a C string.
|
||||||
/// @param str A null-terminated C string.
|
/// @param str A null-terminated C string.
|
||||||
StringView(const char* non_null str)
|
StringView(const char* non_null str)
|
||||||
: BasicStringView(CalcLength(str), Hash(str, CalcLength(str))), _str(new __ConstStringCharHolder(str, CalcLength(str))) {}
|
: BasicStringView(CalcLength(str), Hash(str, CalcLength(str))),
|
||||||
|
_str(new __ConstStringCharHolder(str, CalcLength(str))) {}
|
||||||
/// @brief Instantiate a StringView using a C string, as well as it's length.
|
/// @brief Instantiate a StringView using a C string, as well as it's length.
|
||||||
/// @param str A null-terminated C string.
|
/// @param str A null-terminated C string.
|
||||||
/// @param length The length of the C string
|
/// @param length The length of the C string
|
||||||
|
@ -143,9 +144,13 @@ namespace ArbUt {
|
||||||
return _hash != Hash(rhs.data(), rhs.size());
|
return _hash != Hash(rhs.data(), rhs.size());
|
||||||
}
|
}
|
||||||
/// @brief Check equality with standard C style string.
|
/// @brief Check equality with standard C style string.
|
||||||
inline constexpr bool operator==(const char* non_null rhs) const noexcept final { return _hash == Hash(rhs, CalcLength(rhs)); }
|
inline constexpr bool operator==(const char* non_null rhs) const noexcept final {
|
||||||
|
return _hash == Hash(rhs, CalcLength(rhs));
|
||||||
|
}
|
||||||
/// @brief Check inequality with standard C style string.
|
/// @brief Check inequality with standard C style string.
|
||||||
inline constexpr bool operator!=(const char* non_null rhs) const noexcept final { return _hash != Hash(rhs, CalcLength(rhs)); }
|
inline constexpr bool operator!=(const char* non_null rhs) const noexcept final {
|
||||||
|
return _hash != Hash(rhs, CalcLength(rhs));
|
||||||
|
}
|
||||||
|
|
||||||
/// @brief Calculates the hash for a given C string.
|
/// @brief Calculates the hash for a given C string.
|
||||||
/// @param val A null-terminated C string.
|
/// @param val A null-terminated C string.
|
||||||
|
|
|
@ -41,9 +41,13 @@ namespace ArbUt {
|
||||||
return _hash != Hash(rhs.data(), rhs.size());
|
return _hash != Hash(rhs.data(), rhs.size());
|
||||||
}
|
}
|
||||||
/// @brief Check equality with standard C style string.
|
/// @brief Check equality with standard C style string.
|
||||||
inline constexpr bool operator==(const char* non_null rhs) const noexcept final { return _hash == Hash(rhs, CalcLength(rhs)); }
|
inline constexpr bool operator==(const char* non_null rhs) const noexcept final {
|
||||||
|
return _hash == Hash(rhs, CalcLength(rhs));
|
||||||
|
}
|
||||||
/// @brief Check inequality with standard C style string.
|
/// @brief Check inequality with standard C style string.
|
||||||
inline constexpr bool operator!=(const char* non_null rhs) const noexcept final { return _hash != Hash(rhs, CalcLength(rhs)); }
|
inline constexpr bool operator!=(const char* non_null rhs) const noexcept final {
|
||||||
|
return _hash != Hash(rhs, CalcLength(rhs));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue