Skip to content

Commit

Permalink
Update vendor
Browse files Browse the repository at this point in the history
  • Loading branch information
tekezo committed Apr 15, 2023
1 parent 922f0f4 commit 2ff0fd4
Show file tree
Hide file tree
Showing 14 changed files with 116 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ else()
endif()


# if the installed project requested no architecture check, don't perform the check
if("FALSE")
return()
endif()

# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "")
return()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if(CMAKE_VERSION VERSION_LESS "2.8.3")
message(FATAL_ERROR "CMake >= 2.8.3 required")
endif()
cmake_policy(PUSH)
cmake_policy(VERSION 2.8.3...3.23)
cmake_policy(VERSION 2.8.3...3.24)
#----------------------------------------------------------------
# Generated CMake target import file.
#----------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

// pqrs::hid v2.9
// pqrs::hid v2.10

// (C) Copyright Takayama Fumihiko 2020.
// Distributed under the Boost Software License, Version 1.0.
Expand All @@ -9,6 +9,7 @@
#include "hid/country_code.hpp"
#include "hid/hash.hpp"
#include "hid/product_id.hpp"
#include "hid/report_id.hpp"
#include "hid/usage.hpp"
#include "hid/usage_page.hpp"
#include "hid/usage_pair.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ inline std::size_t hash_value(const value_t& value) {
}
} // namespace product_id

namespace report_id {
inline std::size_t hash_value(const value_t& value) {
return std::hash<value_t>{}(value);
}
} // namespace report_id

namespace usage_page {
inline std::size_t hash_value(const value_t& value) {
return std::hash<value_t>{}(value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ inline void from_json(const nlohmann::json& j, value_t& value) {
}
} // namespace product_id

namespace report_id {
inline void to_json(nlohmann::json& j, const value_t& value) {
j = type_safe::get(value);
}

inline void from_json(const nlohmann::json& j, value_t& value) {
json::requires_number(j, "json");

value = value_t(j.get<type_safe::underlying_type<value_t>>());
}
} // namespace report_id

namespace usage_page {
inline void to_json(nlohmann::json& j, const value_t& value) {
j = type_safe::get(value);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#pragma once

// (C) Copyright Takayama Fumihiko 2023.
// Distributed under the Boost Software License, Version 1.0.
// (See http://www.boost.org/LICENSE_1_0.txt)

#include <compare>
#include <functional>
#include <iostream>
#include <type_safe/strong_typedef.hpp>

namespace pqrs {
namespace hid {
namespace report_id {
struct value_t : type_safe::strong_typedef<value_t, int32_t>,
type_safe::strong_typedef_op::equality_comparison<value_t>,
type_safe::strong_typedef_op::relational_comparison<value_t> {
using strong_typedef::strong_typedef;

constexpr auto operator<=>(const value_t& other) const {
return type_safe::get(*this) <=> type_safe::get(other);
}
};

inline std::ostream& operator<<(std::ostream& stream, const value_t& value) {
return stream << type_safe::get(value);
}
} // namespace report_id
} // namespace hid
} // namespace pqrs

namespace std {
template <>
struct hash<pqrs::hid::report_id::value_t> : type_safe::hashable<pqrs::hid::report_id::value_t> {
};
} // namespace std
1 change: 1 addition & 0 deletions example/vendor/include/pqrs/hid/report_id.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ else()
endif()


# if the installed project requested no architecture check, don't perform the check
if("FALSE")
return()
endif()

# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "")
return()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if(CMAKE_VERSION VERSION_LESS "2.8.3")
message(FATAL_ERROR "CMake >= 2.8.3 required")
endif()
cmake_policy(PUSH)
cmake_policy(VERSION 2.8.3...3.23)
cmake_policy(VERSION 2.8.3...3.24)
#----------------------------------------------------------------
# Generated CMake target import file.
#----------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

// pqrs::hid v2.9
// pqrs::hid v2.10

// (C) Copyright Takayama Fumihiko 2020.
// Distributed under the Boost Software License, Version 1.0.
Expand All @@ -9,6 +9,7 @@
#include "hid/country_code.hpp"
#include "hid/hash.hpp"
#include "hid/product_id.hpp"
#include "hid/report_id.hpp"
#include "hid/usage.hpp"
#include "hid/usage_page.hpp"
#include "hid/usage_pair.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ inline std::size_t hash_value(const value_t& value) {
}
} // namespace product_id

namespace report_id {
inline std::size_t hash_value(const value_t& value) {
return std::hash<value_t>{}(value);
}
} // namespace report_id

namespace usage_page {
inline std::size_t hash_value(const value_t& value) {
return std::hash<value_t>{}(value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ inline void from_json(const nlohmann::json& j, value_t& value) {
}
} // namespace product_id

namespace report_id {
inline void to_json(nlohmann::json& j, const value_t& value) {
j = type_safe::get(value);
}

inline void from_json(const nlohmann::json& j, value_t& value) {
json::requires_number(j, "json");

value = value_t(j.get<type_safe::underlying_type<value_t>>());
}
} // namespace report_id

namespace usage_page {
inline void to_json(nlohmann::json& j, const value_t& value) {
j = type_safe::get(value);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#pragma once

// (C) Copyright Takayama Fumihiko 2023.
// Distributed under the Boost Software License, Version 1.0.
// (See http://www.boost.org/LICENSE_1_0.txt)

#include <compare>
#include <functional>
#include <iostream>
#include <type_safe/strong_typedef.hpp>

namespace pqrs {
namespace hid {
namespace report_id {
struct value_t : type_safe::strong_typedef<value_t, int32_t>,
type_safe::strong_typedef_op::equality_comparison<value_t>,
type_safe::strong_typedef_op::relational_comparison<value_t> {
using strong_typedef::strong_typedef;

constexpr auto operator<=>(const value_t& other) const {
return type_safe::get(*this) <=> type_safe::get(other);
}
};

inline std::ostream& operator<<(std::ostream& stream, const value_t& value) {
return stream << type_safe::get(value);
}
} // namespace report_id
} // namespace hid
} // namespace pqrs

namespace std {
template <>
struct hash<pqrs::hid::report_id::value_t> : type_safe::hashable<pqrs::hid::report_id::value_t> {
};
} // namespace std
1 change: 1 addition & 0 deletions tests/vendor/include/pqrs/hid/report_id.hpp

0 comments on commit 2ff0fd4

Please sign in to comment.