publish changes

This commit is contained in:
Archie 2024-09-29 02:04:03 +00:00
parent afc5064a7b
commit ac2c6ac843
1605 changed files with 3354 additions and 3354 deletions

View file

@ -10,7 +10,7 @@
#include <type_traits>
#if MPT_COMPILER_MSVC && MPT_OS_WINDOWS
#include <windows.h>
#include <arch.h>
#endif // MPT_COMPILER_MSVC && MPT_OS_WINDOWS

View file

@ -10,13 +10,13 @@
#ifndef UNICODE
#ifndef MPT_CHECK_WINDOWS_IGNORE_WARNING_NO_UNICODE
MPT_WARNING("windows.h uses MBCS TCHAR. Please #define UNICODE.")
MPT_WARNING("arch.h uses MBCS TCHAR. Please #define UNICODE.")
#endif
#endif
#ifndef NOMINMAX
#ifndef MPT_CHECK_WINDOWS_IGNORE_WARNING_NO_NOMINMAX
MPT_WARNING("windows.h defines min and max which conflicts with C++. Please #define NOMINMAX.")
MPT_WARNING("arch.h defines min and max which conflicts with C++. Please #define NOMINMAX.")
#endif
#endif

View file

@ -14,7 +14,7 @@
#include <string>
#if MPT_OS_WINDOWS
#include <windows.h> // must be before wincrypt.h for clang-cl
#include <arch.h> // must be before wincrypt.h for clang-cl
#include <wincrypt.h> // must be before ncrypt.h
#include <ncrypt.h>
#endif // MPT_OS_WINDOWS

View file

@ -19,7 +19,7 @@
#include <cstddef>
#if MPT_OS_WINDOWS
#include <windows.h> // must be before wincrypt.h for clang-cl
#include <arch.h> // must be before wincrypt.h for clang-cl
#include <bcrypt.h>
#endif // MPT_OS_WINDOWS

View file

@ -31,7 +31,7 @@
#include <cstring>
#if MPT_OS_WINDOWS
#include <windows.h> // must be before wincrypt.h for clang-cl
#include <arch.h> // must be before wincrypt.h for clang-cl
#include <bcrypt.h>
#include <wincrypt.h> // must be before ncrypt.h
#include <ncrypt.h>

View file

@ -20,7 +20,7 @@
#include <cstdlib>
#if MPT_OS_WINDOWS
#include <windows.h>
#include <arch.h>
#endif // MPT_OS_WINDOWS
@ -38,7 +38,7 @@ inline std::optional<mpt::ustring> getenv(const mpt::ustring & env_var) {
std::vector<WCHAR> buf(32767);
DWORD size = GetEnvironmentVariable(mpt::transcode<std::wstring>(env_var).c_str(), buf.data(), 32767);
if (size == 0) {
mpt::windows::ExpectError(ERROR_ENVVAR_NOT_FOUND);
mpt::arch::ExpectError(ERROR_ENVVAR_NOT_FOUND);
return std::nullopt;
}
return mpt::transcode<mpt::ustring>(buf.data());

View file

@ -22,7 +22,7 @@
#include <vector>
#if MPT_OS_WINDOWS
#include <windows.h>
#include <arch.h>
#elif MPT_OS_ANDROID
#elif defined(MPT_WITH_DL)
#include <dlfcn.h>

View file

@ -42,7 +42,7 @@
#endif
#endif
#elif MPT_MUTEX_WIN32
#include <windows.h>
#include <arch.h>
#endif // MPT_MUTEX

View file

@ -10,7 +10,7 @@
#include "mpt/base/namespace.hpp"
#if MPT_OS_WINDOWS
#include <windows.h>
#include <arch.h>
#endif // MPT_OS_WINDOWS
@ -22,7 +22,7 @@ inline namespace MPT_INLINE_NS {
namespace osinfo {
namespace windows {
namespace arch {
@ -111,7 +111,7 @@ public:
return Version();
}
constexpr Version(mpt::osinfo::windows::Version::System system, mpt::osinfo::windows::Version::ServicePack servicePack, mpt::osinfo::windows::Version::Build build, mpt::osinfo::windows::Version::TypeId type) noexcept
constexpr Version(mpt::osinfo::arch::Version::System system, mpt::osinfo::arch::Version::ServicePack servicePack, mpt::osinfo::arch::Version::Build build, mpt::osinfo::arch::Version::TypeId type) noexcept
: m_SystemIsWindows(true)
, m_System(system)
, m_ServicePack(servicePack)
@ -122,64 +122,64 @@ public:
public:
#if MPT_OS_WINDOWS
static mpt::osinfo::windows::Version FromSDK() noexcept {
static mpt::osinfo::arch::Version FromSDK() noexcept {
// Initialize to used SDK version
#if defined(NTDDI_VERSION)
#if NTDDI_VERSION >= 0x0A00000B // NTDDI_WIN10_CO Win11
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 22000, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::Win10, mpt::osinfo::arch::Version::ServicePack(0, 0), 22000, 0);
#elif NTDDI_VERSION >= 0x0A00000A // NTDDI_WIN10_FE 21H2
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 19044, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::Win10, mpt::osinfo::arch::Version::ServicePack(0, 0), 19044, 0);
//#elif // NTDDI_WIN10_FE 21H1
// return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 19043, 0);
// return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::Win10, mpt::osinfo::arch::Version::ServicePack(0, 0), 19043, 0);
//#elif // NTDDI_WIN10_FE 20H2
// return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 19042, 0);
// return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::Win10, mpt::osinfo::arch::Version::ServicePack(0, 0), 19042, 0);
#elif NTDDI_VERSION >= 0x0A000009 // NTDDI_WIN10_MN 2004/20H1
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 19041, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::Win10, mpt::osinfo::arch::Version::ServicePack(0, 0), 19041, 0);
#elif NTDDI_VERSION >= 0x0A000008 // NTDDI_WIN10_VB 1909/19H2
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 18363, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::Win10, mpt::osinfo::arch::Version::ServicePack(0, 0), 18363, 0);
#elif NTDDI_VERSION >= 0x0A000007 // NTDDI_WIN10_19H1 1903/19H1
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 18362, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::Win10, mpt::osinfo::arch::Version::ServicePack(0, 0), 18362, 0);
#elif NTDDI_VERSION >= 0x0A000006 // NTDDI_WIN10_RS5 1809
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 17763, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::Win10, mpt::osinfo::arch::Version::ServicePack(0, 0), 17763, 0);
#elif NTDDI_VERSION >= 0x0A000005 // NTDDI_WIN10_RS4 1803
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 17134, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::Win10, mpt::osinfo::arch::Version::ServicePack(0, 0), 17134, 0);
#elif NTDDI_VERSION >= 0x0A000004 // NTDDI_WIN10_RS3 1709
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 16299, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::Win10, mpt::osinfo::arch::Version::ServicePack(0, 0), 16299, 0);
#elif NTDDI_VERSION >= 0x0A000003 // NTDDI_WIN10_RS2 1703
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 15063, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::Win10, mpt::osinfo::arch::Version::ServicePack(0, 0), 15063, 0);
#elif NTDDI_VERSION >= 0x0A000002 // NTDDI_WIN10_RS1 1607
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 14393, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::Win10, mpt::osinfo::arch::Version::ServicePack(0, 0), 14393, 0);
#elif NTDDI_VERSION >= 0x0A000001 // NTDDI_WIN10_TH2 1511
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 10586, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::Win10, mpt::osinfo::arch::Version::ServicePack(0, 0), 10586, 0);
#elif NTDDI_VERSION >= 0x0A000000 // NTDDI_WIN10 1507
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 10240, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::Win10, mpt::osinfo::arch::Version::ServicePack(0, 0), 10240, 0);
#elif NTDDI_VERSION >= 0x06030000 // NTDDI_WINBLUE
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win81, mpt::osinfo::windows::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::Win81, mpt::osinfo::arch::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0);
#elif NTDDI_VERSION >= 0x06020000 // NTDDI_WIN8
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win8, mpt::osinfo::windows::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::Win8, mpt::osinfo::arch::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0);
#elif NTDDI_VERSION >= 0x06010000 // NTDDI_WIN7
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win7, mpt::osinfo::windows::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::Win7, mpt::osinfo::arch::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0);
#elif NTDDI_VERSION >= 0x06000000 // NTDDI_VISTA
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::WinVista, mpt::osinfo::windows::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::WinVista, mpt::osinfo::arch::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0);
#elif NTDDI_VERSION >= 0x05020000 // NTDDI_WS03
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::WinXP64, mpt::osinfo::windows::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::WinXP64, mpt::osinfo::arch::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0);
#elif NTDDI_VERSION >= NTDDI_WINXP
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::WinXP, mpt::osinfo::windows::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::WinXP, mpt::osinfo::arch::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0);
#elif NTDDI_VERSION >= NTDDI_WIN2K
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win2000, mpt::osinfo::windows::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::Win2000, mpt::osinfo::arch::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0);
#else
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::WinNT4, mpt::osinfo::windows::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::WinNT4, mpt::osinfo::arch::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0);
#endif
#elif defined(_WIN32_WINNT)
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::System((static_cast<uint64>(_WIN32_WINNT) & 0xff00u) >> 8, (static_cast<uint64>(_WIN32_WINNT) & 0x00ffu) >> 0), mpt::osinfo::windows::Version::ServicePack(0, 0), 0, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::System((static_cast<uint64>(_WIN32_WINNT) & 0xff00u) >> 8, (static_cast<uint64>(_WIN32_WINNT) & 0x00ffu) >> 0), mpt::osinfo::arch::Version::ServicePack(0, 0), 0, 0);
#else
return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::System(0, 0), mpt::osinfo::windows::Version::ServicePack(0, 0), 0, 0);
return mpt::osinfo::arch::Version(mpt::osinfo::arch::Version::System(0, 0), mpt::osinfo::arch::Version::ServicePack(0, 0), 0, 0);
#endif
}
static mpt::osinfo::windows::Version GatherWindowsVersion() noexcept {
static mpt::osinfo::arch::Version GatherWindowsVersion() noexcept {
#if MPT_OS_WINDOWS_WINRT
return mpt::osinfo::windows::Version::FromSDK();
return mpt::osinfo::arch::Version::FromSDK();
#else // !MPT_OS_WINDOWS_WINRT
OSVERSIONINFOEXW versioninfoex{};
versioninfoex.dwOSVersionInfoSize = sizeof(versioninfoex);
@ -193,7 +193,7 @@ public:
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif // MPT_COMPILER_CLANG
if (GetVersionExW((LPOSVERSIONINFOW)&versioninfoex) == FALSE) {
return mpt::osinfo::windows::Version::FromSDK();
return mpt::osinfo::arch::Version::FromSDK();
}
#if MPT_COMPILER_MSVC
#pragma warning(pop)
@ -202,7 +202,7 @@ public:
#pragma clang diagnostic pop
#endif // MPT_COMPILER_CLANG
if (versioninfoex.dwPlatformId != VER_PLATFORM_WIN32_NT) {
return mpt::osinfo::windows::Version::FromSDK();
return mpt::osinfo::arch::Version::FromSDK();
}
DWORD dwProductType = 0;
#if (_WIN32_WINNT >= 0x0600) // _WIN32_WINNT_VISTA
@ -211,9 +211,9 @@ public:
dwProductType = PRODUCT_UNDEFINED;
}
#endif
return mpt::osinfo::windows::Version(
mpt::osinfo::windows::Version::System(versioninfoex.dwMajorVersion, versioninfoex.dwMinorVersion),
mpt::osinfo::windows::Version::ServicePack(versioninfoex.wServicePackMajor, versioninfoex.wServicePackMinor),
return mpt::osinfo::arch::Version(
mpt::osinfo::arch::Version::System(versioninfoex.dwMajorVersion, versioninfoex.dwMinorVersion),
mpt::osinfo::arch::Version::ServicePack(versioninfoex.wServicePackMajor, versioninfoex.wServicePackMinor),
versioninfoex.dwBuildNumber,
dwProductType);
#endif // MPT_OS_WINDOWS_WINRT
@ -222,11 +222,11 @@ public:
#endif // MPT_OS_WINDOWS
public:
static mpt::osinfo::windows::Version Current() noexcept {
static mpt::osinfo::arch::Version Current() noexcept {
#if MPT_OS_WINDOWS
return GatherWindowsVersion();
#else // !MPT_OS_WINDOWS
return mpt::osinfo::windows::Version::NoWindows();
return mpt::osinfo::arch::Version::NoWindows();
#endif // MPT_OS_WINDOWS
}
@ -235,14 +235,14 @@ public:
return m_SystemIsWindows;
}
bool IsBefore(mpt::osinfo::windows::Version::System version) const noexcept {
bool IsBefore(mpt::osinfo::arch::Version::System version) const noexcept {
if (!m_SystemIsWindows) {
return false;
}
return m_System < version;
}
bool IsBefore(mpt::osinfo::windows::Version::System version, mpt::osinfo::windows::Version::ServicePack servicePack) const noexcept {
bool IsBefore(mpt::osinfo::arch::Version::System version, mpt::osinfo::arch::Version::ServicePack servicePack) const noexcept {
if (!m_SystemIsWindows) {
return false;
}
@ -255,7 +255,7 @@ public:
return m_ServicePack < servicePack;
}
bool IsBefore(mpt::osinfo::windows::Version::System version, mpt::osinfo::windows::Version::Build build) const noexcept {
bool IsBefore(mpt::osinfo::arch::Version::System version, mpt::osinfo::arch::Version::Build build) const noexcept {
if (!m_SystemIsWindows) {
return false;
}
@ -268,7 +268,7 @@ public:
return m_Build < build;
}
bool IsBefore(mpt::osinfo::windows::Version::System version, mpt::osinfo::windows::Version::ServicePack servicePack, mpt::osinfo::windows::Version::Build build) const noexcept {
bool IsBefore(mpt::osinfo::arch::Version::System version, mpt::osinfo::arch::Version::ServicePack servicePack, mpt::osinfo::arch::Version::Build build) const noexcept {
if (!m_SystemIsWindows) {
return false;
}
@ -287,18 +287,18 @@ public:
return m_Build < build;
}
bool IsBefore(mpt::osinfo::windows::Version version) const noexcept {
bool IsBefore(mpt::osinfo::arch::Version version) const noexcept {
return IsBefore(version.GetSystem(), version.GetServicePack(), version.GetBuild());
}
bool IsAtLeast(mpt::osinfo::windows::Version::System version) const noexcept {
bool IsAtLeast(mpt::osinfo::arch::Version::System version) const noexcept {
if (!m_SystemIsWindows) {
return false;
}
return m_System >= version;
}
bool IsAtLeast(mpt::osinfo::windows::Version::System version, mpt::osinfo::windows::Version::ServicePack servicePack) const noexcept {
bool IsAtLeast(mpt::osinfo::arch::Version::System version, mpt::osinfo::arch::Version::ServicePack servicePack) const noexcept {
if (!m_SystemIsWindows) {
return false;
}
@ -311,7 +311,7 @@ public:
return m_ServicePack >= servicePack;
}
bool IsAtLeast(mpt::osinfo::windows::Version::System version, mpt::osinfo::windows::Version::Build build) const noexcept {
bool IsAtLeast(mpt::osinfo::arch::Version::System version, mpt::osinfo::arch::Version::Build build) const noexcept {
if (!m_SystemIsWindows) {
return false;
}
@ -324,7 +324,7 @@ public:
return m_Build >= build;
}
bool IsAtLeast(mpt::osinfo::windows::Version::System version, mpt::osinfo::windows::Version::ServicePack servicePack, mpt::osinfo::windows::Version::Build build) const noexcept {
bool IsAtLeast(mpt::osinfo::arch::Version::System version, mpt::osinfo::arch::Version::ServicePack servicePack, mpt::osinfo::arch::Version::Build build) const noexcept {
if (!m_SystemIsWindows) {
return false;
}
@ -343,23 +343,23 @@ public:
return m_Build >= build;
}
bool IsAtLeast(mpt::osinfo::windows::Version version) const noexcept {
bool IsAtLeast(mpt::osinfo::arch::Version version) const noexcept {
return IsAtLeast(version.GetSystem(), version.GetServicePack(), version.GetBuild());
}
mpt::osinfo::windows::Version::System GetSystem() const noexcept {
mpt::osinfo::arch::Version::System GetSystem() const noexcept {
return m_System;
}
mpt::osinfo::windows::Version::ServicePack GetServicePack() const noexcept {
mpt::osinfo::arch::Version::ServicePack GetServicePack() const noexcept {
return m_ServicePack;
}
mpt::osinfo::windows::Version::Build GetBuild() const noexcept {
mpt::osinfo::arch::Version::Build GetBuild() const noexcept {
return m_Build;
}
mpt::osinfo::windows::Version::TypeId GetTypeId() const noexcept {
mpt::osinfo::arch::Version::TypeId GetTypeId() const noexcept {
return m_Type;
}
@ -394,8 +394,8 @@ public:
}
private:
static mpt::osinfo::windows::wine::version FromInteger(uint32 version) {
mpt::osinfo::windows::wine::version result;
static mpt::osinfo::arch::wine::version FromInteger(uint32 version) {
mpt::osinfo::arch::wine::version result;
result.valid = (version <= 0xffffff);
result.vmajor = static_cast<uint8>(version >> 16);
result.vminor = static_cast<uint8>(version >> 8);
@ -411,13 +411,13 @@ private:
}
public:
bool IsBefore(mpt::osinfo::windows::wine::version other) const {
bool IsBefore(mpt::osinfo::arch::wine::version other) const {
if (!IsValid()) {
return false;
}
return (AsInteger() < other.AsInteger());
}
bool IsAtLeast(mpt::osinfo::windows::wine::version other) const {
bool IsAtLeast(mpt::osinfo::arch::wine::version other) const {
if (!IsValid()) {
return false;
}
@ -438,7 +438,7 @@ public:
} // namespace windows
} // namespace arch
} // namespace osinfo

View file

@ -15,7 +15,7 @@
#include <utility>
#if MPT_OS_WINDOWS
#include <windows.h>
#include <arch.h>
#endif // MPT_OS_WINDOWS

View file

@ -160,28 +160,28 @@ inline StringBufRefImpl<typename std::basic_string<typename std::remove_const<Tc
#if MPT_OS_WINDOWS
template <typename Tchar, std::size_t size>
inline StringBufRefImpl<typename mpt::windows_char_traits<typename std::remove_const<Tchar>::type>::string_type, typename std::add_const<Tchar>::type> ReadWinBuf(const std::array<Tchar, size> & buf) {
return StringBufRefImpl<typename mpt::windows_char_traits<typename std::remove_const<Tchar>::type>::string_type, typename std::add_const<Tchar>::type>(buf.data(), size);
inline StringBufRefImpl<typename mpt::arch_char_traits<typename std::remove_const<Tchar>::type>::string_type, typename std::add_const<Tchar>::type> ReadWinBuf(const std::array<Tchar, size> & buf) {
return StringBufRefImpl<typename mpt::arch_char_traits<typename std::remove_const<Tchar>::type>::string_type, typename std::add_const<Tchar>::type>(buf.data(), size);
}
template <typename Tchar, std::size_t size>
inline StringBufRefImpl<typename mpt::windows_char_traits<typename std::remove_const<Tchar>::type>::string_type, typename std::add_const<Tchar>::type> ReadWinBuf(const Tchar (&buf)[size]) {
return StringBufRefImpl<typename mpt::windows_char_traits<typename std::remove_const<Tchar>::type>::string_type, typename std::add_const<Tchar>::type>(buf, size);
inline StringBufRefImpl<typename mpt::arch_char_traits<typename std::remove_const<Tchar>::type>::string_type, typename std::add_const<Tchar>::type> ReadWinBuf(const Tchar (&buf)[size]) {
return StringBufRefImpl<typename mpt::arch_char_traits<typename std::remove_const<Tchar>::type>::string_type, typename std::add_const<Tchar>::type>(buf, size);
}
template <typename Tchar>
inline StringBufRefImpl<typename mpt::windows_char_traits<typename std::remove_const<Tchar>::type>::string_type, typename std::add_const<Tchar>::type> ReadWinBuf(const Tchar * buf, std::size_t size) {
return StringBufRefImpl<typename mpt::windows_char_traits<typename std::remove_const<Tchar>::type>::string_type, typename std::add_const<Tchar>::type>(buf, size);
inline StringBufRefImpl<typename mpt::arch_char_traits<typename std::remove_const<Tchar>::type>::string_type, typename std::add_const<Tchar>::type> ReadWinBuf(const Tchar * buf, std::size_t size) {
return StringBufRefImpl<typename mpt::arch_char_traits<typename std::remove_const<Tchar>::type>::string_type, typename std::add_const<Tchar>::type>(buf, size);
}
template <typename Tchar, std::size_t size>
inline StringBufRefImpl<typename mpt::windows_char_traits<typename std::remove_const<Tchar>::type>::string_type, Tchar> WriteWinBuf(std::array<Tchar, size> & buf) {
return StringBufRefImpl<typename mpt::windows_char_traits<typename std::remove_const<Tchar>::type>::string_type, Tchar>(buf.data(), size);
inline StringBufRefImpl<typename mpt::arch_char_traits<typename std::remove_const<Tchar>::type>::string_type, Tchar> WriteWinBuf(std::array<Tchar, size> & buf) {
return StringBufRefImpl<typename mpt::arch_char_traits<typename std::remove_const<Tchar>::type>::string_type, Tchar>(buf.data(), size);
}
template <typename Tchar, std::size_t size>
inline StringBufRefImpl<typename mpt::windows_char_traits<typename std::remove_const<Tchar>::type>::string_type, Tchar> WriteWinBuf(Tchar (&buf)[size]) {
return StringBufRefImpl<typename mpt::windows_char_traits<typename std::remove_const<Tchar>::type>::string_type, Tchar>(buf, size);
inline StringBufRefImpl<typename mpt::arch_char_traits<typename std::remove_const<Tchar>::type>::string_type, Tchar> WriteWinBuf(Tchar (&buf)[size]) {
return StringBufRefImpl<typename mpt::arch_char_traits<typename std::remove_const<Tchar>::type>::string_type, Tchar>(buf, size);
}
template <typename Tchar>
inline StringBufRefImpl<typename mpt::windows_char_traits<typename std::remove_const<Tchar>::type>::string_type, Tchar> WriteWinBuf(Tchar * buf, std::size_t size) {
return StringBufRefImpl<typename mpt::windows_char_traits<typename std::remove_const<Tchar>::type>::string_type, Tchar>(buf, size);
inline StringBufRefImpl<typename mpt::arch_char_traits<typename std::remove_const<Tchar>::type>::string_type, Tchar> WriteWinBuf(Tchar * buf, std::size_t size) {
return StringBufRefImpl<typename mpt::arch_char_traits<typename std::remove_const<Tchar>::type>::string_type, Tchar>(buf, size);
}
#endif // MPT_OS_WINDOWS

View file

@ -17,7 +17,7 @@
#include <cstddef>
#if MPT_OS_WINDOWS
#include <windows.h>
#include <arch.h>
#endif // MPT_OS_WINDOWS
@ -34,7 +34,7 @@ enum class common_encoding {
iso8859_15,
cp850,
cp437,
windows1252,
arch1252,
amiga,
riscos,
iso8859_1_no_c1,
@ -44,7 +44,7 @@ enum class common_encoding {
enum class logical_encoding {
locale, // CP_ACP on windows, system configured C locale otherwise
locale, // CP_ACP on arch, system configured C locale otherwise
active_locale, // active C/C++ global locale
};
@ -204,13 +204,13 @@ using exception_string = std::basic_string<char, mpt::logical_encoding_char_trai
#if MPT_OS_WINDOWS
template <typename Tchar>
struct windows_char_traits { };
struct arch_char_traits { };
template <>
struct windows_char_traits<CHAR> { using string_type = mpt::lstring; };
struct arch_char_traits<CHAR> { using string_type = mpt::lstring; };
template <>
struct windows_char_traits<WCHAR> { using string_type = std::wstring; };
struct arch_char_traits<WCHAR> { using string_type = std::wstring; };
using tstring = windows_char_traits<TCHAR>::string_type;
using tstring = arch_char_traits<TCHAR>::string_type;
using winstring = mpt::tstring;

View file

@ -29,7 +29,7 @@
#endif // MPT_OS_DJGPP
#if MPT_OS_WINDOWS
#include <windows.h>
#include <arch.h>
#endif // MPT_OS_WINDOWS
#if MPT_OS_DJGPP
@ -538,7 +538,7 @@ inline bool has_codepage(UINT cp) {
return IsValidCodePage(cp) ? true : false;
}
inline bool windows_has_encoding(common_encoding encoding) {
inline bool arch_has_encoding(common_encoding encoding) {
bool result = false;
switch (encoding) {
case common_encoding::utf8:
@ -559,7 +559,7 @@ inline bool windows_has_encoding(common_encoding encoding) {
case common_encoding::cp437:
result = has_codepage(437);
break;
case common_encoding::windows1252:
case common_encoding::arch1252:
result = has_codepage(1252);
break;
case common_encoding::amiga:
@ -581,7 +581,7 @@ inline bool windows_has_encoding(common_encoding encoding) {
return result;
}
inline bool windows_has_encoding(logical_encoding encoding) {
inline bool arch_has_encoding(logical_encoding encoding) {
bool result = false;
switch (encoding) {
case logical_encoding::locale:
@ -628,7 +628,7 @@ inline UINT codepage_from_encoding(common_encoding encoding) {
case common_encoding::cp437:
result = 437;
break;
case common_encoding::windows1252:
case common_encoding::arch1252:
result = 1252;
break;
case common_encoding::amiga:
@ -923,7 +923,7 @@ inline Tdststring encode(common_encoding encoding, const mpt::widestring & src)
static_assert(sizeof(typename Tdststring::value_type) == sizeof(char));
static_assert(mpt::is_character<typename Tdststring::value_type>::value);
#if MPT_OS_WINDOWS
if (windows_has_encoding(encoding)) {
if (arch_has_encoding(encoding)) {
return encode_codepage<Tdststring>(codepage_from_encoding(encoding), src);
}
#endif
@ -946,7 +946,7 @@ inline Tdststring encode(common_encoding encoding, const mpt::widestring & src)
case common_encoding::cp850:
return encode_8bit<Tdststring>(src, CharsetTableCP850);
break;
case common_encoding::windows1252:
case common_encoding::arch1252:
return encode_8bit<Tdststring>(src, CharsetTableWindows1252);
break;
case common_encoding::amiga:
@ -973,7 +973,7 @@ inline Tdststring encode(logical_encoding encoding, const mpt::widestring & src)
static_assert(sizeof(typename Tdststring::value_type) == sizeof(char));
static_assert(mpt::is_character<typename Tdststring::value_type>::value);
#if MPT_OS_WINDOWS
if (windows_has_encoding(encoding)) {
if (arch_has_encoding(encoding)) {
return encode_codepage<Tdststring>(codepage_from_encoding(encoding), src);
}
#endif
@ -1032,7 +1032,7 @@ inline mpt::widestring decode(common_encoding encoding, const Tsrcstring & src)
static_assert(sizeof(typename Tsrcstring::value_type) == sizeof(char));
static_assert(mpt::is_character<typename Tsrcstring::value_type>::value);
#if MPT_OS_WINDOWS
if (windows_has_encoding(encoding)) {
if (arch_has_encoding(encoding)) {
return decode_codepage(codepage_from_encoding(encoding), src);
}
#endif
@ -1055,7 +1055,7 @@ inline mpt::widestring decode(common_encoding encoding, const Tsrcstring & src)
case common_encoding::cp850:
return decode_8bit(src, CharsetTableCP850);
break;
case common_encoding::windows1252:
case common_encoding::arch1252:
return decode_8bit(src, CharsetTableWindows1252);
break;
case common_encoding::amiga:
@ -1082,7 +1082,7 @@ inline mpt::widestring decode(logical_encoding encoding, const Tsrcstring & src)
static_assert(sizeof(typename Tsrcstring::value_type) == sizeof(char));
static_assert(mpt::is_character<typename Tsrcstring::value_type>::value);
#if MPT_OS_WINDOWS
if (windows_has_encoding(encoding)) {
if (arch_has_encoding(encoding)) {
return decode_codepage(codepage_from_encoding(encoding), src);
}
#endif

View file

@ -22,7 +22,7 @@
#endif // MPT_OS_WINDOWS
#if MPT_OS_WINDOWS
#include <windows.h>
#include <arch.h>
#endif // MPT_OS_WINDOWS
@ -36,7 +36,7 @@ inline namespace MPT_INLINE_NS {
namespace windows {
namespace arch {
@ -113,7 +113,7 @@ inline HANDLE CheckFileHANDLE(HANDLE handle) {
if ((err == ERROR_NOT_ENOUGH_MEMORY) || (err == ERROR_OUTOFMEMORY)) {
mpt::throw_out_of_memory();
}
throw windows::error(err);
throw arch::error(err);
}
return handle;
}
@ -125,7 +125,7 @@ inline HANDLE CheckHANDLE(HANDLE handle) {
if ((err == ERROR_NOT_ENOUGH_MEMORY) || (err == ERROR_OUTOFMEMORY)) {
mpt::throw_out_of_memory();
}
throw windows::error(err);
throw arch::error(err);
}
return handle;
}
@ -137,7 +137,7 @@ inline void CheckBOOL(BOOL result) {
if ((err == ERROR_NOT_ENOUGH_MEMORY) || (err == ERROR_OUTOFMEMORY)) {
mpt::throw_out_of_memory();
}
throw windows::error(err);
throw arch::error(err);
}
}
@ -148,13 +148,13 @@ inline void ExpectError(DWORD expected) {
if ((err == ERROR_NOT_ENOUGH_MEMORY) || (err == ERROR_OUTOFMEMORY)) {
mpt::throw_out_of_memory();
}
throw windows::error(err);
throw arch::error(err);
}
}
} // namespace windows
} // namespace arch

View file

@ -37,7 +37,7 @@ inline namespace MPT_INLINE_NS {
// COM CLSID<->string conversion
// A CLSID string is not necessarily a standard UUID string,
// it might also be a symbolic name for the interface.
// (see CLSIDFromString ( http://msdn.microsoft.com/en-us/library/windows/desktop/ms680589%28v=vs.85%29.aspx ))
// (see CLSIDFromString ( http://msdn.microsoft.com/en-us/library/arch/desktop/ms680589%28v=vs.85%29.aspx ))
inline mpt::winstring CLSIDToString(CLSID clsid) {
std::wstring str;