From 0581cf73da571c217214088b7a81f1a6d10c49b9 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Fri, 9 Feb 2024 15:57:19 +0000 Subject: [PATCH] format --- src/debug/HyprCtl.cpp | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp index 9d67154be..56dfd283f 100644 --- a/src/debug/HyprCtl.cpp +++ b/src/debug/HyprCtl.cpp @@ -1195,28 +1195,28 @@ std::string dispatchGetOption(eHyprCtlOutputFormat format, std::string request) if (format == FORMAT_NORMAL) { if (TYPE == typeid(Hyprlang::INT)) - return std::format("int: {}\nset: {}", std::any_cast(VAL), VAR->m_bSetByUser); - else if (TYPE == typeid(Hyprlang::FLOAT)) - return std::format("float: {:2f}\nset: {}", std::any_cast(VAL), VAR->m_bSetByUser); - else if (TYPE == typeid(Hyprlang::VEC2)) - return std::format("vec2: [{}, {}]\nset: {}", std::any_cast(VAL).x, std::any_cast(VAL).y, VAR->m_bSetByUser); - else if (TYPE == typeid(Hyprlang::STRING)) - return std::format("str: {}\nset: {}", std::any_cast(VAL), VAR->m_bSetByUser); - else if (TYPE == typeid(Hyprlang::CUSTOMTYPE*)) - return std::format("custom type at: {:x}\nset: {}", (uintptr_t)std::any_cast(VAL), VAR->m_bSetByUser); + return std::format("int: {}\nset: {}", std::any_cast(VAL), VAR->m_bSetByUser); + else if (TYPE == typeid(Hyprlang::FLOAT)) + return std::format("float: {:2f}\nset: {}", std::any_cast(VAL), VAR->m_bSetByUser); + else if (TYPE == typeid(Hyprlang::VEC2)) + return std::format("vec2: [{}, {}]\nset: {}", std::any_cast(VAL).x, std::any_cast(VAL).y, VAR->m_bSetByUser); + else if (TYPE == typeid(Hyprlang::STRING)) + return std::format("str: {}\nset: {}", std::any_cast(VAL), VAR->m_bSetByUser); + else if (TYPE == typeid(Hyprlang::CUSTOMTYPE*)) + return std::format("custom type at: {:x}\nset: {}", (uintptr_t)std::any_cast(VAL), VAR->m_bSetByUser); } else { if (TYPE == typeid(Hyprlang::INT)) - return std::format("{{\"option\": \"{}\", \"int\": {}, \"set\": {} }}", curitem, std::any_cast(VAL), VAR->m_bSetByUser); - else if (TYPE == typeid(Hyprlang::FLOAT)) - return std::format("{{\"option\": \"{}\", \"float\": {:2f}, \"set\": {} }}", curitem, std::any_cast(VAL), VAR->m_bSetByUser); - else if (TYPE == typeid(Hyprlang::VEC2)) - return std::format("{{\"option\": \"{}\", \"vec2\": [{},{}], \"set\": {} }}", curitem, std::any_cast(VAL).x, std::any_cast(VAL).y, VAR->m_bSetByUser); - else if (TYPE == typeid(Hyprlang::STRING)) - return std::format("{{\"option\": \"{}\", \"str\": \"{}\", \"set\": {} }}", curitem, escapeJSONStrings(std::any_cast(VAL)), VAR->m_bSetByUser); - else if (TYPE == typeid(Hyprlang::CUSTOMTYPE*)) - return std::format("{{\"option\": \"{}\", \"custom\": \"{:x}\", \"set\": {} }}", curitem, (uintptr_t)std::any_cast(VAL), VAR->m_bSetByUser); + return std::format("{{\"option\": \"{}\", \"int\": {}, \"set\": {} }}", curitem, std::any_cast(VAL), VAR->m_bSetByUser); + else if (TYPE == typeid(Hyprlang::FLOAT)) + return std::format("{{\"option\": \"{}\", \"float\": {:2f}, \"set\": {} }}", curitem, std::any_cast(VAL), VAR->m_bSetByUser); + else if (TYPE == typeid(Hyprlang::VEC2)) + return std::format("{{\"option\": \"{}\", \"vec2\": [{},{}], \"set\": {} }}", curitem, std::any_cast(VAL).x, std::any_cast(VAL).y, + VAR->m_bSetByUser); + else if (TYPE == typeid(Hyprlang::STRING)) + return std::format("{{\"option\": \"{}\", \"str\": \"{}\", \"set\": {} }}", curitem, escapeJSONStrings(std::any_cast(VAL)), VAR->m_bSetByUser); + else if (TYPE == typeid(Hyprlang::CUSTOMTYPE*)) + return std::format("{{\"option\": \"{}\", \"custom\": \"{:x}\", \"set\": {} }}", curitem, (uintptr_t)std::any_cast(VAL), VAR->m_bSetByUser); } - return "invalid type (internal error)"; }