logging: implement std::formatter for some types (#3380)

This commit is contained in:
memchr
2023-09-20 15:25:03 +00:00
committed by GitHub
parent 6594b50e57
commit 3785defaf1
20 changed files with 217 additions and 96 deletions

View File

@@ -1,11 +1,12 @@
#pragma once
#include "IHyprLayout.hpp"
#include <list>
#include <deque>
#include "../render/decorations/CHyprGroupBarDecoration.hpp"
#include <array>
#include <optional>
#include <format>
class CHyprDwindleLayout;
enum eFullscreenMode : uint8_t;
@@ -85,3 +86,17 @@ class CHyprDwindleLayout : public IHyprLayout {
friend struct SDwindleNodeData;
};
template <typename CharT>
struct std::formatter<SDwindleNodeData*, CharT> : std::formatter<CharT> {
template <typename FormatContext>
auto format(const SDwindleNodeData* const& node, FormatContext& ctx) const {
auto out = ctx.out();
if (!node)
return std::format_to(out, "[Node nullptr]");
std::format_to(out, "[Node {:x}: workspace: {}, pos: {:j2}, size: {:j2}", (uintptr_t)node, node->workspaceID, node->position, node->size);
if (!node->isNode && node->pWindow)
std::format_to(out, ", window: {:x}", node->pWindow);
return std::format_to(out, "]");
}
};