Skip to content

Commit

Permalink
Update vendor
Browse files Browse the repository at this point in the history
  • Loading branch information
tekezo committed Apr 22, 2024
1 parent 7864f6f commit b1264cf
Show file tree
Hide file tree
Showing 16 changed files with 290 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.8)
message(FATAL_ERROR "CMake >= 2.8.0 required")
endif()
if(CMAKE_VERSION VERSION_LESS "2.8.3")
message(FATAL_ERROR "CMake >= 2.8.3 required")
if(CMAKE_VERSION VERSION_LESS "3.1.0")
message(FATAL_ERROR "CMake >= 3.1.0 required")
endif()
cmake_policy(PUSH)
cmake_policy(VERSION 2.8.3...3.26)
cmake_policy(VERSION 3.1.0...3.27)
#----------------------------------------------------------------
# Generated CMake target import file.
#----------------------------------------------------------------
Expand Down Expand Up @@ -63,10 +63,6 @@ set_target_properties(debug_assert PROPERTIES
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
)

if(CMAKE_VERSION VERSION_LESS 3.1.0)
message(FATAL_ERROR "This file relies on consumers using CMake 3.1.0 or greater.")
endif()

# Load information for each installed configuration.
file(GLOB _cmake_config_files "${CMAKE_CURRENT_LIST_DIR}/debug_assert-targets-*.cmake")
foreach(_cmake_config_file IN LISTS _cmake_config_files)
Expand All @@ -80,9 +76,12 @@ set(_IMPORT_PREFIX)

# Loop over all imported files and verify that they actually exist
foreach(_cmake_target IN LISTS _cmake_import_check_targets)
foreach(_cmake_file IN LISTS "_cmake_import_check_files_for_${_cmake_target}")
if(NOT EXISTS "${_cmake_file}")
message(FATAL_ERROR "The imported target \"${_cmake_target}\" references the file
if(CMAKE_VERSION VERSION_LESS "3.28"
OR NOT DEFINED _cmake_import_check_xcframework_for_${_cmake_target}
OR NOT IS_DIRECTORY "${_cmake_import_check_xcframework_for_${_cmake_target}}")
foreach(_cmake_file IN LISTS "_cmake_import_check_files_for_${_cmake_target}")
if(NOT EXISTS "${_cmake_file}")
message(FATAL_ERROR "The imported target \"${_cmake_target}\" references the file
\"${_cmake_file}\"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
Expand All @@ -91,8 +90,9 @@ but this file does not exist. Possible reasons include:
\"${CMAKE_CURRENT_LIST_FILE}\"
but not all the files it references.
")
endif()
endforeach()
endif()
endforeach()
endif()
unset(_cmake_file)
unset("_cmake_import_check_files_for_${_cmake_target}")
endforeach()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
#pragma once

// pqrs::hid v2.13
// pqrs::hid v2.14

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

#include "hid/country_code.hpp"
#include "hid/hash.hpp"
#include "hid/manufacturer_string.hpp"
#include "hid/product_id.hpp"
#include "hid/product_string.hpp"
#include "hid/report_id.hpp"
#include "hid/usage.hpp"
#include "hid/usage_page.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@

namespace pqrs {
namespace hid {

//
// number values
//

namespace country_code {
inline std::size_t hash_value(const value_t& value) {
return std::hash<value_t>{}(value);
Expand Down Expand Up @@ -44,6 +49,26 @@ inline std::size_t hash_value(const value_t& value) {
}
} // namespace vendor_id

//
// string values
//

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

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

//
// usage_pair
//

inline std::size_t hash_value(const usage_pair& value) {
return std::hash<usage_pair>{}(value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@

namespace pqrs {
namespace hid {

//
// number values
//

namespace country_code {
inline void to_json(nlohmann::json& j, const value_t& value) {
j = type_safe::get(value);
Expand Down Expand Up @@ -81,6 +86,34 @@ inline void from_json(const nlohmann::json& j, value_t& value) {
}
} // namespace vendor_id

//
// string values
//

namespace manufacturer_string {
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_string(j, "json");

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

namespace product_string {
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_string(j, "json");

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

//
// usage_pair
//
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#pragma once

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

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

namespace pqrs {
namespace hid {
namespace manufacturer_string {
struct value_t : type_safe::strong_typedef<value_t, std::string>,
type_safe::strong_typedef_op::equality_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 manufacturer_string
} // namespace hid
} // namespace pqrs

namespace std {
template <>
struct hash<pqrs::hid::manufacturer_string::value_t> : type_safe::hashable<pqrs::hid::manufacturer_string::value_t> {
};
} // namespace std
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#pragma once

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

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

namespace pqrs {
namespace hid {
namespace product_string {
struct value_t : type_safe::strong_typedef<value_t, std::string>,
type_safe::strong_typedef_op::equality_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 product_string
} // namespace hid
} // namespace pqrs

namespace std {
template <>
struct hash<pqrs::hid::product_string::value_t> : type_safe::hashable<pqrs::hid::product_string::value_t> {
};
} // namespace std
1 change: 1 addition & 0 deletions example/vendor/include/pqrs/hid/manufacturer_string.hpp
1 change: 1 addition & 0 deletions example/vendor/include/pqrs/hid/product_string.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.8)
message(FATAL_ERROR "CMake >= 2.8.0 required")
endif()
if(CMAKE_VERSION VERSION_LESS "2.8.3")
message(FATAL_ERROR "CMake >= 2.8.3 required")
if(CMAKE_VERSION VERSION_LESS "3.1.0")
message(FATAL_ERROR "CMake >= 3.1.0 required")
endif()
cmake_policy(PUSH)
cmake_policy(VERSION 2.8.3...3.26)
cmake_policy(VERSION 3.1.0...3.27)
#----------------------------------------------------------------
# Generated CMake target import file.
#----------------------------------------------------------------
Expand Down Expand Up @@ -63,10 +63,6 @@ set_target_properties(debug_assert PROPERTIES
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
)

if(CMAKE_VERSION VERSION_LESS 3.1.0)
message(FATAL_ERROR "This file relies on consumers using CMake 3.1.0 or greater.")
endif()

# Load information for each installed configuration.
file(GLOB _cmake_config_files "${CMAKE_CURRENT_LIST_DIR}/debug_assert-targets-*.cmake")
foreach(_cmake_config_file IN LISTS _cmake_config_files)
Expand All @@ -80,9 +76,12 @@ set(_IMPORT_PREFIX)

# Loop over all imported files and verify that they actually exist
foreach(_cmake_target IN LISTS _cmake_import_check_targets)
foreach(_cmake_file IN LISTS "_cmake_import_check_files_for_${_cmake_target}")
if(NOT EXISTS "${_cmake_file}")
message(FATAL_ERROR "The imported target \"${_cmake_target}\" references the file
if(CMAKE_VERSION VERSION_LESS "3.28"
OR NOT DEFINED _cmake_import_check_xcframework_for_${_cmake_target}
OR NOT IS_DIRECTORY "${_cmake_import_check_xcframework_for_${_cmake_target}}")
foreach(_cmake_file IN LISTS "_cmake_import_check_files_for_${_cmake_target}")
if(NOT EXISTS "${_cmake_file}")
message(FATAL_ERROR "The imported target \"${_cmake_target}\" references the file
\"${_cmake_file}\"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
Expand All @@ -91,8 +90,9 @@ but this file does not exist. Possible reasons include:
\"${CMAKE_CURRENT_LIST_FILE}\"
but not all the files it references.
")
endif()
endforeach()
endif()
endforeach()
endif()
unset(_cmake_file)
unset("_cmake_import_check_files_for_${_cmake_target}")
endforeach()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
#pragma once

// pqrs::hid v2.13
// pqrs::hid v2.14

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

#include "hid/country_code.hpp"
#include "hid/hash.hpp"
#include "hid/manufacturer_string.hpp"
#include "hid/product_id.hpp"
#include "hid/product_string.hpp"
#include "hid/report_id.hpp"
#include "hid/usage.hpp"
#include "hid/usage_page.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@

namespace pqrs {
namespace hid {

//
// number values
//

namespace country_code {
inline std::size_t hash_value(const value_t& value) {
return std::hash<value_t>{}(value);
Expand Down Expand Up @@ -44,6 +49,26 @@ inline std::size_t hash_value(const value_t& value) {
}
} // namespace vendor_id

//
// string values
//

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

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

//
// usage_pair
//

inline std::size_t hash_value(const usage_pair& value) {
return std::hash<usage_pair>{}(value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@

namespace pqrs {
namespace hid {

//
// number values
//

namespace country_code {
inline void to_json(nlohmann::json& j, const value_t& value) {
j = type_safe::get(value);
Expand Down Expand Up @@ -81,6 +86,34 @@ inline void from_json(const nlohmann::json& j, value_t& value) {
}
} // namespace vendor_id

//
// string values
//

namespace manufacturer_string {
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_string(j, "json");

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

namespace product_string {
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_string(j, "json");

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

//
// usage_pair
//
Expand Down
Loading

0 comments on commit b1264cf

Please sign in to comment.