Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing some symbol names and compilation breaks in other code #120

Merged
merged 2 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions adobe/enum_ops.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#define ADOBE_ENUM_OPS_HPP

/**************************************************************************************************/

#include <type_traits>

/**************************************************************************************************/
Expand All @@ -25,11 +26,11 @@
defined for an enumeration type, \c E, the result will be of type \c E exactly when the
operand(s) are of type \c E.

\c ADOBE_DEFINE_BITSET_OPS(E) or auto stlab_enable_bitmask_enum(E) -> std::true_type;
\c ADOBE_DEFINE_BITSET_OPS(E) or auto adobe_enable_bitmask_enum(E) -> std::true_type;
enables the bitset operations <code>~, |, &, ^, |=, &=, ^= </code>
for enumeration type \c E.

\c ADOBE_DEFINE_ARITHMETIC_OPS(E) or auto stlab_enable_arithmetic_enum(E) -> std::true_type;
\c ADOBE_DEFINE_ARITHMETIC_OPS(E) or auto adobe_enable_arithmetic_enum(E) -> std::true_type;
enables the typesafe arithmetic operations <code>+, -, *, /,
%, +=, *=, -=, /=, \%=</code> for enumeration type \c E.

Expand Down Expand Up @@ -58,8 +59,8 @@ namespace adobe {

/**************************************************************************************************/

auto stlab_enable_bitmask_enum(...) -> std::false_type;
auto stlab_enable_arithmetic_enum(...) -> std::false_type;
auto adobe_enable_bitmask_enum(...) -> std::false_type;
auto adobe_enable_arithmetic_enum(...) -> std::false_type;

/**************************************************************************************************/

Expand All @@ -69,10 +70,10 @@ namespace implementation {

#if !defined(ADOBE_NO_DOCUMENTATION)
template <typename T>
constexpr bool has_enabled_bitmask = decltype(stlab_enable_bitmask_enum(std::declval<T>()))::value;
constexpr bool has_enabled_bitmask = decltype(adobe_enable_bitmask_enum(std::declval<T>()))::value;
template <typename T>
constexpr bool has_enabled_arithmetic =
decltype(stlab_enable_arithmetic_enum(std::declval<T>()))::value;
decltype(adobe_enable_arithmetic_enum(std::declval<T>()))::value;
#endif

/**************************************************************************************************/
Expand All @@ -87,7 +88,7 @@ constexpr bool has_enabled_arithmetic =

// this exist to mantain backwards compatability with the old ops
#define ADOBE_DEFINE_BITSET_OPS(EnumType) \
constexpr auto stlab_enable_bitmask_enum(EnumType)->std::true_type;
constexpr auto adobe_enable_bitmask_enum(EnumType)->std::true_type;


template <typename T>
Expand Down Expand Up @@ -138,7 +139,7 @@ constexpr auto operator|=(T& lhs, const T rhs)

// this exist to mantain backwards compatability with the old ops
#define ADOBE_DEFINE_ARITHMETIC_OPS(EnumType) \
constexpr auto stlab_enable_arithmetic_enum(EnumType)->std::true_type;
constexpr auto adobe_enable_arithmetic_enum(EnumType)->std::true_type;
template <typename T>
constexpr auto operator+(const T a)
-> std::enable_if_t<adobe::implementation::has_enabled_arithmetic<T>, T> {
Expand Down
8 changes: 4 additions & 4 deletions adobe/widget_attributes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ ADOBE_DEFINE_BITSET_OPS(theme_t)
behaviors
*/

enum modifiers_t {
enum modifiers_t : std::uint32_t {
/// No modifiers
modifiers_none_s = 0,

Expand Down Expand Up @@ -114,13 +114,13 @@ enum modifiers_t {
modifiers_any_command_s = 1 << 7,

/// Any shift key
modifiers_any_shift_s = modifiers_left_shift_s | modifiers_right_shift_s,
modifiers_any_shift_s = static_cast<std::underlying_type_t<modifiers_t>>(modifiers_left_shift_s) | static_cast<std::underlying_type_t<modifiers_t>>(modifiers_right_shift_s),

/// Any option (or alt) key (if applicable)
modifiers_any_option_s = modifiers_left_option_s | modifiers_right_option_s,
modifiers_any_option_s = static_cast<std::underlying_type_t<modifiers_t>>(modifiers_left_option_s) | static_cast<std::underlying_type_t<modifiers_t>>(modifiers_right_option_s),

/// Any control key (if applicable)
modifiers_any_control_s = modifiers_left_control_s | modifiers_right_control_s,
modifiers_any_control_s = static_cast<std::underlying_type_t<modifiers_t>>(modifiers_left_control_s) | static_cast<std::underlying_type_t<modifiers_t>>(modifiers_right_control_s),
modifiers_all_s = UINT_MAX
};

Expand Down
4 changes: 2 additions & 2 deletions test/unit_tests/enum_ops/enum_ops_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ enum class Num : int {
num_7 = 7
};

auto stlab_enable_bitmask_enum(Views) -> std::true_type;
auto adobe_enable_bitmask_enum(Views) -> std::true_type;

ADOBE_DEFINE_BITSET_OPS(Number)

Expand Down Expand Up @@ -89,7 +89,7 @@ BOOST_AUTO_TEST_CASE(enumclass_bitset_ops) {


ADOBE_DEFINE_ARITHMETIC_OPS(Number)
auto stlab_enable_arithmetic_enum(Num) -> std::true_type;
auto adobe_enable_arithmetic_enum(Num) -> std::true_type;

BOOST_AUTO_TEST_CASE(enum_arith_ops) {
Number x;
Expand Down
Loading