mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-15 17:30:27 +08:00
style: 按照 review 意见修改代码格式
Co-authored-by: Horror Proton <107091537+horror-proton@users.noreply.github.com>
This commit is contained in:
@@ -21,7 +21,7 @@ AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: MultiLine
|
||||
AlwaysBreakTemplateDeclarations: true
|
||||
AttributeMacros:
|
||||
- __capability
|
||||
BinPackArguments: true
|
||||
|
||||
@@ -51,7 +51,8 @@ namespace asst::infrast
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <> struct hash<asst::infrast::Skill>
|
||||
template <>
|
||||
struct hash<asst::infrast::Skill>
|
||||
{
|
||||
size_t operator()(const asst::infrast::Skill& skill) const noexcept
|
||||
{
|
||||
|
||||
@@ -197,7 +197,8 @@ namespace asst
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <> struct hash<asst::Point>
|
||||
template <>
|
||||
struct hash<asst::Point>
|
||||
{
|
||||
size_t operator()(const asst::Point& point) const noexcept
|
||||
{
|
||||
@@ -205,7 +206,8 @@ namespace std
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct hash<asst::Rect>
|
||||
template <>
|
||||
struct hash<asst::Rect>
|
||||
{
|
||||
size_t operator()(const asst::Rect& rect) const noexcept
|
||||
{
|
||||
@@ -213,7 +215,8 @@ namespace std
|
||||
std::hash<int>()(rect.height);
|
||||
}
|
||||
};
|
||||
template <> struct hash<asst::TextRect>
|
||||
template <>
|
||||
struct hash<asst::TextRect>
|
||||
{
|
||||
size_t operator()(const asst::TextRect& tr) const noexcept
|
||||
{
|
||||
|
||||
@@ -109,7 +109,8 @@ namespace asst::utils
|
||||
return buff;
|
||||
}
|
||||
|
||||
template <typename _ = void> inline std::string ansi_to_utf8(const std::string& ansi_str)
|
||||
template <typename _ = void>
|
||||
inline std::string ansi_to_utf8(const std::string& ansi_str)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
const char* src_str = ansi_str.c_str();
|
||||
@@ -138,7 +139,8 @@ namespace asst::utils
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename _ = void> inline std::string utf8_to_ansi(const std::string& utf8_str)
|
||||
template <typename _ = void>
|
||||
inline std::string utf8_to_ansi(const std::string& utf8_str)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
const char* src_str = utf8_str.c_str();
|
||||
@@ -167,7 +169,8 @@ namespace asst::utils
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename _ = void> inline std::string utf8_to_unicode_escape(const std::string& utf8_str)
|
||||
template <typename _ = void>
|
||||
inline std::string utf8_to_unicode_escape(const std::string& utf8_str)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
const char* src_str = utf8_str.c_str();
|
||||
@@ -203,7 +206,8 @@ namespace asst::utils
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename RetTy, typename ArgType> constexpr inline RetTy make_rect(const ArgType& rect)
|
||||
template <typename RetTy, typename ArgType>
|
||||
constexpr inline RetTy make_rect(const ArgType& rect)
|
||||
{
|
||||
return RetTy { rect.x, rect.y, rect.width, rect.height };
|
||||
}
|
||||
|
||||
@@ -40,7 +40,8 @@ namespace asst
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename... Args> inline void debug([[maybe_unused]] Args&&... args)
|
||||
template <typename... Args>
|
||||
inline void debug([[maybe_unused]] Args&&... args)
|
||||
{
|
||||
#ifdef ASST_DEBUG
|
||||
std::string_view level = "DEB";
|
||||
@@ -48,27 +49,32 @@ namespace asst
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename... Args> inline void trace(Args&&... args)
|
||||
template <typename... Args>
|
||||
inline void trace(Args&&... args)
|
||||
{
|
||||
std::string_view level = "TRC";
|
||||
log(level, std::forward<Args>(args)...);
|
||||
}
|
||||
template <typename... Args> inline void info(Args&&... args)
|
||||
template <typename... Args>
|
||||
inline void info(Args&&... args)
|
||||
{
|
||||
std::string_view level = "INF";
|
||||
log(level, std::forward<Args>(args)...);
|
||||
}
|
||||
template <typename... Args> inline void warn(Args&&... args)
|
||||
template <typename... Args>
|
||||
inline void warn(Args&&... args)
|
||||
{
|
||||
std::string_view level = "WRN";
|
||||
log(level, std::forward<Args>(args)...);
|
||||
}
|
||||
template <typename... Args> inline void error(Args&&... args)
|
||||
template <typename... Args>
|
||||
inline void error(Args&&... args)
|
||||
{
|
||||
std::string_view level = "ERR";
|
||||
log(level, std::forward<Args>(args)...);
|
||||
}
|
||||
template <typename... Args> inline void log_with_custom_level(std::string_view level, Args&&... args)
|
||||
template <typename... Args>
|
||||
inline void log_with_custom_level(std::string_view level, Args&&... args)
|
||||
{
|
||||
log(level, std::forward<Args>(args)...);
|
||||
}
|
||||
@@ -118,7 +124,8 @@ namespace asst
|
||||
trace("-----------------------------");
|
||||
}
|
||||
|
||||
template <typename... Args> void log(std::string_view level, Args&&... args)
|
||||
template <typename... Args>
|
||||
void log(std::string_view level, Args&&... args)
|
||||
{
|
||||
std::unique_lock<std::mutex> trace_lock(m_trace_mutex);
|
||||
|
||||
@@ -161,7 +168,8 @@ namespace asst
|
||||
: std::true_type
|
||||
{};
|
||||
|
||||
template <bool ToAnsi, typename Stream, typename T> static Stream& stream_put(Stream& s, T&& v)
|
||||
template <bool ToAnsi, typename Stream, typename T>
|
||||
static Stream& stream_put(Stream& s, T&& v)
|
||||
{
|
||||
if constexpr (std::is_constructible_v<std::string, T>) {
|
||||
if constexpr (ToAnsi)
|
||||
@@ -195,9 +203,11 @@ namespace asst
|
||||
}
|
||||
}
|
||||
|
||||
template <bool ToAnsi, typename Stream, typename... Args> struct stream_put_line_impl;
|
||||
template <bool ToAnsi, typename Stream, typename... Args>
|
||||
struct stream_put_line_impl;
|
||||
|
||||
template <bool ToAnsi, typename Stream> struct stream_put_line_impl<ToAnsi, Stream>
|
||||
template <bool ToAnsi, typename Stream>
|
||||
struct stream_put_line_impl<ToAnsi, Stream>
|
||||
{
|
||||
static constexpr Stream& apply(Stream& s)
|
||||
{
|
||||
@@ -206,7 +216,8 @@ namespace asst
|
||||
}
|
||||
};
|
||||
|
||||
template <bool ToAnsi, typename Stream, typename Only> struct stream_put_line_impl<ToAnsi, Stream, Only>
|
||||
template <bool ToAnsi, typename Stream, typename Only>
|
||||
struct stream_put_line_impl<ToAnsi, Stream, Only>
|
||||
{
|
||||
static constexpr Stream& apply(Stream& s, Only&& only)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user