17 return m_buffer.data();
22 const size_t available = m_buffer.size() - 1 - m_len;
23 const size_t numCharsToAppend = strnlen(message, available);
24 appendImpl(std::string_view(message, numCharsToAppend));
29 const size_t available = m_buffer.size() - 1 - m_len;
30 const size_t numCharsToAppend = std::min(messageLen, available);
31 appendImpl(std::string_view(message, numCharsToAppend));
34 void CppRuntimeException::appendImpl(std::string_view message)
36 if (message.size() > 0)
38 (void)std::copy(message.begin(), message.end(), m_buffer.begin() + m_len);
39 m_len += message.size();
41 m_buffer.at(m_len) =
'\0';
52 return exception << (value ?
"true" :
"false");
57 std::array<char, 24> integerPartBuffer = {};
58 std::array<char, 24> floatingPartBuffer = {};
59 const char* integerPartString =
nullptr;
60 const char* floatingPartString =
nullptr;
61 convertFloatToString(integerPartBuffer, floatingPartBuffer, value, integerPartString, floatingPartString);
63 if (floatingPartString !=
nullptr)
65 result = result <<
"." << floatingPartString;
73 return exception << (static_cast<float>(value));
78 exception.
append(value.data(), value.size());
const char * what() const noexcept override
CppRuntimeException(const char *message="")
void append(const char *message)
CppRuntimeException & operator<<(CppRuntimeException &exception, const BasicBitBuffer< ALLOC > &bitBuffer)
void convertFloatToString(std::array< char, 24 > &integerPartBuffer, std::array< char, 24 > &floatingPartBuffer, float value, const char *&integerPartString, const char *&floatingPartString)