Skip to content

Commit

Permalink
vector: prefix macros with AQ_
Browse files Browse the repository at this point in the history
  • Loading branch information
vaxerski committed Jun 19, 2024
1 parent 4f13512 commit 725f63a
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions include/hyprutils/math/Vector2D.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ namespace Hyprutils {
}

// absolutely ridiculous formatter spec parsing
#define FORMAT_PARSE(specs__, type__) \
#define AQ_FORMAT_PARSE(specs__, type__) \
template <typename FormatContext> \
constexpr auto parse(FormatContext& ctx) { \
auto it = ctx.begin(); \
Expand All @@ -112,10 +112,10 @@ namespace Hyprutils {
return it; \
}

#define FORMAT_FLAG(spec__, flag__) \
#define AQ_FORMAT_FLAG(spec__, flag__) \
case spec__: (flag__) = true; break;

#define FORMAT_NUMBER(buf__) \
#define AQ_FORMAT_NUMBER(buf__) \
case '0': \
case '1': \
case '2': \
Expand All @@ -138,9 +138,9 @@ struct std::formatter<Hyprutils::Math::Vector2D, CharT> : std::formatter<CharT>
bool formatJson = false;
bool formatX = false;
std::string precision = "";
FORMAT_PARSE(FORMAT_FLAG('j', formatJson) //
FORMAT_FLAG('X', formatX) //
FORMAT_NUMBER(precision),
AQ_FORMAT_PARSE(AQ_FORMAT_FLAG('j', formatJson) //
AQ_FORMAT_FLAG('X', formatX) //
AQ_FORMAT_NUMBER(precision),
Hyprutils::Math::Vector2D)

template <typename FormatContext>
Expand All @@ -159,7 +159,3 @@ struct std::formatter<Hyprutils::Math::Vector2D, CharT> : std::formatter<CharT>
} catch (std::format_error& e) { return std::format_to(ctx.out(), "[{}, {}]", vec.x, vec.y); }
}
};

#undef FORMAT_PARSE
#undef FORMAT_FLAG
#undef FORMAT_NUMBER

0 comments on commit 725f63a

Please sign in to comment.