Ref T419, utility function if canRunOnCurrentPlatform"

This commit is contained in:
Klaus Basan
2019-03-05 02:22:24 +01:00
committed by Mat Sutcliffe
parent d1b4660b20
commit c60692605d
2 changed files with 13 additions and 1 deletions

View File

@@ -192,6 +192,15 @@ namespace BlackMisc
return platform == CPlatform::currentPlatform();
}
bool CPlatform::canRunOnCurrentPlatform(const CPlatform &platform)
{
if (platform == currentPlatform()) { return true; }
if (platform.isAnyWindows() && currentPlatform().isAnyWindows()) { return true; }
if (platform == CPlatform::allOs()) { return true; }
if (platform == CPlatform::independent()) { return true; }
return false;
}
const CPlatform &CPlatform::win32Platform()
{
static const CPlatform p(Win32);

View File

@@ -103,7 +103,7 @@ namespace BlackMisc
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant);
//! Compare for index
//! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex
int comparePropertyByIndex(const CPropertyIndex &index, const CPlatform &compareValue) const;
//! Convert to QString
@@ -124,6 +124,9 @@ namespace BlackMisc
//! Is this the current platform
static bool isCurrentPlatform(const CPlatform &platform);
//! Can run on this platform
static bool canRunOnCurrentPlatform(const CPlatform &platform);
//! Win32
static const CPlatform &win32Platform();