parser fix again
parent
a2a60b18b5
commit
a1c1f51cb4
|
@ -1,6 +1,6 @@
|
||||||
cmake_minimum_required(VERSION 3.20)
|
cmake_minimum_required(VERSION 3.20)
|
||||||
include(cmake/color.cmake)
|
include(cmake/color.cmake)
|
||||||
set(BLT_VERSION 5.1.5)
|
set(BLT_VERSION 5.1.6)
|
||||||
|
|
||||||
set(BLT_TARGET BLT)
|
set(BLT_TARGET BLT)
|
||||||
|
|
||||||
|
|
|
@ -88,14 +88,19 @@ namespace blt::logging
|
||||||
{
|
{
|
||||||
if constexpr (std::is_trivially_copyable_v<T>)
|
if constexpr (std::is_trivially_copyable_v<T>)
|
||||||
{
|
{
|
||||||
|
// copy bytes of type
|
||||||
char buffer[sizeof(T)];
|
char buffer[sizeof(T)];
|
||||||
std::memcpy(buffer, &t, sizeof(T));
|
std::memcpy(buffer, &t, sizeof(T));
|
||||||
|
// display prefix
|
||||||
if (type.alternate_form)
|
if (type.alternate_form)
|
||||||
stream << '0' << (type.uppercase ? 'B' : 'b');
|
stream << '0' << (type.uppercase ? 'B' : 'b');
|
||||||
|
// print bytes
|
||||||
for (size_t i = 0; i < sizeof(T); ++i)
|
for (size_t i = 0; i < sizeof(T); ++i)
|
||||||
{
|
{
|
||||||
|
// print bits
|
||||||
for (size_t j = 0; j < 8; ++j)
|
for (size_t j = 0; j < 8; ++j)
|
||||||
stream << ((buffer[i] & (1 << j)) ? '1' : '0');
|
stream << ((buffer[i] & (1 << j)) ? '1' : '0');
|
||||||
|
// special seperator defined via sign (weird hack, change?)
|
||||||
if (type.sign == fmt_sign_t::SPACE && i != sizeof(T) - 1)
|
if (type.sign == fmt_sign_t::SPACE && i != sizeof(T) - 1)
|
||||||
stream << ' ';
|
stream << ' ';
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,6 +154,7 @@ namespace blt::logging
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case fmt_token_type::STRING:
|
case fmt_token_type::STRING:
|
||||||
|
return;
|
||||||
case fmt_token_type::COLON:
|
case fmt_token_type::COLON:
|
||||||
{
|
{
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
|
|
|
@ -20,9 +20,6 @@
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
|
||||||
using endl_t = decltype(static_cast<std::ostream& (*)(std::ostream&)>(std::endl));
|
|
||||||
// blt::logging::println("{} | {} | {} | {}", blt::type_string<endl_t>());
|
|
||||||
blt::logging::println("This is a println!");
|
blt::logging::println("This is a println!");
|
||||||
blt::logging::println("This is a println with args '{}'", 42);
|
blt::logging::println("This is a println with args '{}'", 42);
|
||||||
blt::logging::println("This is a println with multiple args '{}' '{:.100}' '{}'", 42, 32.34231233f, "Hello World!");
|
blt::logging::println("This is a println with multiple args '{}' '{:.100}' '{}'", 42, 32.34231233f, "Hello World!");
|
||||||
|
@ -40,5 +37,7 @@ int main()
|
||||||
blt::logging::println("This is a println with hex with leading {:#.10x}", 4250);
|
blt::logging::println("This is a println with hex with leading {:#.10x}", 4250);
|
||||||
blt::logging::println("This is a println with binary {:#b}", 6969420);
|
blt::logging::println("This is a println with binary {:#b}", 6969420);
|
||||||
blt::logging::println("This is a println with binary with space {: #b}", 6969421);
|
blt::logging::println("This is a println with binary with space {: #b}", 6969421);
|
||||||
|
blt::logging::println("This is a println with octal {:#o}", 6669);
|
||||||
|
blt::logging::println("This is a println with hexfloat {:a}", 402.4320);
|
||||||
// blt::logging::println("This is println {}\twith a std::endl in the middle of it");
|
// blt::logging::println("This is println {}\twith a std::endl in the middle of it");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue