[ox] Remove oxIgnoreError

This commit is contained in:
Gary Talent 2024-04-22 23:38:51 -05:00
parent e9a6a09629
commit ea1feb726e
14 changed files with 33 additions and 36 deletions

View File

@ -61,14 +61,14 @@ struct type_version<T, decltype((void) T::TypeVersion, -1)> {
template<typename T>
constexpr const char *getTypeName(const T *t) noexcept {
TypeInfoCatcher tnc;
oxIgnoreError(model(&tnc, t));
std::ignore = model(&tnc, t);
return tnc.name;
}
template<typename T>
constexpr int getTypeVersion(const T *t) noexcept {
TypeInfoCatcher tnc;
oxIgnoreError(model(&tnc, t));
std::ignore = model(&tnc, t);
return tnc.version;
}

View File

@ -391,7 +391,7 @@ Error Signal<Error(Args...)>::disconnectObject(const void *receiver) const noexc
template<class... Args>
void Signal<Error(Args...)>::emit(Args... args) const noexcept {
for (auto &f : m_slots) {
oxIgnoreError(f->call(ox::forward<Args>(args)...));
std::ignore = f->call(ox::forward<Args>(args)...);
}
}

View File

@ -98,7 +98,7 @@ void LoggerConn::msgSend() noexcept {
break;
}
//std::printf("LoggerConn: sending %lu bytes\n", read);
oxIgnoreError(send(tmp.data(), read));
std::ignore = send(tmp.data(), read);
}
}
}

View File

@ -276,8 +276,8 @@ constexpr void moveModel(T *dst, T *src) noexcept {
constexpr auto size = ModelFieldCount_v<T>;
detail::MemberList<size> dstFields;
detail::Mover<size> mover(&dstFields);
oxIgnoreError(model(&dstFields, dst));
oxIgnoreError(model(&mover, src));
std::ignore = model(&dstFields, dst);
std::ignore = model(&mover, src);
}
template<typename T>
@ -285,8 +285,8 @@ constexpr void copyModel(T *dst, const T *src) noexcept {
constexpr auto size = ModelFieldCount_v<T>;
detail::MemberList<size> dstFields;
detail::Copier<size> copier(&dstFields);
oxIgnoreError(model(&dstFields, dst));
oxIgnoreError(model(&copier, src));
std::ignore = model(&dstFields, dst);
std::ignore = model(&copier, src);
}
template<typename T>
@ -295,8 +295,8 @@ constexpr bool equalsModel(T *a, T *b) noexcept {
constexpr auto size = T::Fields;
detail::MemberList<size> aFields;
detail::Equals<size> equals(&aFields);
oxIgnoreError(model(&aFields, a));
oxIgnoreError(model(&equals, b));
std::ignore = model(&aFields, a);
std::ignore = model(&equals, b);
return equals.value;
}

View File

@ -1057,13 +1057,13 @@ constexpr ModelValue::ModelValue(ModelValue &&other) noexcept {
template<typename T>
constexpr ModelValue::ModelValue(const T &val) noexcept
requires(!ox::is_same_v<ox::remove_reference_t<T>, ModelValue>) {
oxIgnoreError(set(val));
std::ignore = set(val);
}
template<typename T>
constexpr ModelValue::ModelValue(T &&val) noexcept
requires(!ox::is_same_v<ox::remove_reference_t<T>, ModelValue>) {
oxIgnoreError(set(ox::forward<T>(val)));
std::ignore = set(ox::forward<T>(val));
}
constexpr ModelValue::~ModelValue() noexcept {

View File

@ -99,7 +99,7 @@ struct TypeInfoCatcher {
template<typename T>
constexpr int getModelTypeVersion(T *val) noexcept {
TypeInfoCatcher nc;
oxIgnoreError(model(&nc, val));
std::ignore = model(&nc, val);
return nc.version;
}
@ -122,7 +122,7 @@ consteval int requireModelTypeVersion() noexcept {
template<typename T, typename Str = const char*>
constexpr Str getModelTypeName(T *val) noexcept {
TypeNameCatcher nc;
oxIgnoreError(model(&nc, val));
std::ignore = model(&nc, val);
return nc.name;
}

View File

@ -8,6 +8,7 @@
#pragma once
#include "ignore.hpp"
#include "memops.hpp"
#include "stringview.hpp"
#include "strops.hpp"
@ -145,7 +146,7 @@ constexpr BString<size> &BString<size>::operator=(char *str) noexcept {
template<std::size_t size>
constexpr BString<size> &BString<size>::operator+=(const char *str) noexcept {
std::size_t strLen = ox::strlen(str) + 1;
oxIgnoreError(append(str, strLen));
std::ignore = append(str, strLen);
return *this;
}
@ -164,7 +165,7 @@ constexpr BString<size> &BString<size>::operator+=(Integer_c auto i) noexcept {
template<std::size_t size>
constexpr BString<size> &BString<size>::operator+=(StringView s) noexcept {
std::size_t strLen = s.bytes();
oxIgnoreError(append(s.data(), strLen));
std::ignore = append(s.data(), strLen);
return *this;
}
@ -172,7 +173,7 @@ template<std::size_t size>
constexpr BString<size> BString<size>::operator+(const char *str) const noexcept {
auto out = *this;
std::size_t strLen = ox::strlen(str) + 1;
oxIgnoreError(out.append(str, strLen));
std::ignore = out.append(str, strLen);
return out;
}

View File

@ -314,7 +314,3 @@ constexpr Error toError(const Result<T> &r) noexcept {
}
}
constexpr void oxIgnoreError(const ox::Error&) noexcept {}
template<typename T>
constexpr void oxIgnoreError(const ox::Result<T>&) noexcept {}

View File

@ -18,6 +18,7 @@
#include "realstd.hpp"
#include "error.hpp"
#include "ignore.hpp"
#include "bstring.hpp"
#include "string.hpp"
#include "strops.hpp"
@ -191,12 +192,12 @@ constexpr StringType sfmt(StringView fmt, Args&&... args) noexcept {
StringType out;
const auto fmtSegments = ox::detail::fmtSegments<sizeof...(args)+1>(fmt);
const auto &firstSegment = fmtSegments.segments[0];
oxIgnoreError(out.append(firstSegment.str, firstSegment.length));
std::ignore = out.append(firstSegment.str, firstSegment.length);
const detail::FmtArg elements[sizeof...(args)] = {args...};
for (size_t i = 0; i < fmtSegments.size - 1; ++i) {
out += elements[i].out;
const auto &s = fmtSegments.segments[i + 1];
oxIgnoreError(out.append(s.str, s.length));
std::ignore = out.append(s.str, s.length);
}
return out;
}

View File

@ -9,6 +9,7 @@
#pragma once
#include "algorithm.hpp"
#include "ignore.hpp"
#include "stringview.hpp"
#include "strops.hpp"
#include "vector.hpp"
@ -175,13 +176,13 @@ constexpr void HashMap<K, T>::erase(MaybeView_t<K> const&k) {
while (true) {
const auto &p = m_pairs[h];
if (p == nullptr || p->key == k) {
oxIgnoreError(m_pairs.erase(h));
std::ignore = m_pairs.erase(h);
break;
} else {
h = hash(h) % m_pairs.size();
}
}
oxIgnoreError(m_keys.erase(ox::find(m_keys.begin(), m_keys.end(), k)));
std::ignore = m_keys.erase(ox::find(m_keys.begin(), m_keys.end(), k));
}
template<typename K, typename T>

View File

@ -13,6 +13,7 @@
#endif
#include "algorithm.hpp"
#include "ignore.hpp"
#include "memops.hpp"
#include "serialize.hpp"
#include "stringliteral.hpp"
@ -33,9 +34,6 @@ class BasicString {
constexpr explicit BasicString(std::size_t cap) noexcept;
template<size_t Sz>
constexpr BasicString(char const (&str)[Sz]) noexcept;
constexpr explicit BasicString(const char *str) noexcept;
constexpr explicit BasicString(const char8_t *str) noexcept;
@ -364,7 +362,7 @@ constexpr BasicString<SmallStringSize_v> &BasicString<SmallStringSize_v>::operat
template<std::size_t SmallStringSize_v>
constexpr BasicString<SmallStringSize_v> &BasicString<SmallStringSize_v>::operator+=(const char *str) noexcept {
std::size_t strLen = ox::strlen(str);
oxIgnoreError(append(str, strLen));
std::ignore = append(str, strLen);
return *this;
}
@ -389,13 +387,13 @@ constexpr BasicString<SmallStringSize_v> &BasicString<SmallStringSize_v>::operat
template<std::size_t SmallStringSize_v>
constexpr BasicString<SmallStringSize_v> &BasicString<SmallStringSize_v>::operator+=(StringView s) noexcept {
std::size_t strLen = s.bytes();
oxIgnoreError(append(s.data(), strLen));
std::ignore = append(s.data(), strLen);
return *this;
}
template<std::size_t SmallStringSize_v>
constexpr BasicString<SmallStringSize_v> &BasicString<SmallStringSize_v>::operator+=(BasicString const&src) noexcept {
oxIgnoreError(append(src.c_str(), src.len()));
std::ignore = append(src.c_str(), src.len());
return *this;
}

View File

@ -37,7 +37,7 @@ void setLogger(Logger *logger) noexcept {
}
void send(const TraceMsg &msg) noexcept {
oxIgnoreError(logger->send(msg));
std::ignore = logger->send(msg);
}
}

View File

@ -148,12 +148,12 @@ class OutStream {
m_msg.line = line;
m_msg.ch = ch;
const auto &firstSegment = fmtSegments.segments[0];
oxIgnoreError(m_msg.msg.append(firstSegment.str, firstSegment.length));
std::ignore = m_msg.msg.append(firstSegment.str, firstSegment.length);
//const detail::FmtArg elements[sizeof...(args)] = {args...};
for (size_t i = 0; auto const&e : std::initializer_list<detail::FmtArg>{elements...}) {
m_msg.msg += e.out;
const auto &s = fmtSegments.segments[i + 1];
oxIgnoreError(m_msg.msg.append(s.str, s.length));
std::ignore = m_msg.msg.append(s.str, s.length);
++i;
}
}

View File

@ -155,7 +155,7 @@ class UUID {
for (auto i = 0u; i < cnt; ++i) {
const auto v = value[valueI];
const auto h = detail::toHex(v);
oxIgnoreError(writer.write(h.c_str(), h.len()));
std::ignore = writer.write(h.c_str(), h.len());
++valueI;
}
};
@ -175,7 +175,7 @@ class UUID {
constexpr UUIDStr toString() const noexcept {
UUIDStr out;
ox::CharBuffWriter bw(out.data(), out.cap());
oxIgnoreError(toString(bw));
std::ignore = toString(bw);
out[out.cap()] = 0;
return out;
}