mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 01:45:38 +08:00
Moved FSX common functions to FsCommon as those can also be used with FS9
This commit is contained in:
34
src/plugins/simulator/fscommon/simulatorfscommonfunctions.h
Normal file
34
src/plugins/simulator/fscommon/simulatorfscommonfunctions.h
Normal file
@@ -0,0 +1,34 @@
|
||||
/* Copyright (C) 2018
|
||||
* swift Project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKSIMPLUGIN_FSCOMMON_SIMULATORFSCOMMONFUNCTIONS_H
|
||||
#define BLACKSIMPLUGIN_FSCOMMON_SIMULATORFSCOMMONFUNCTIONS_H
|
||||
|
||||
#include <Windows.h>
|
||||
#include <QtGlobal>
|
||||
|
||||
namespace BlackSimPlugin
|
||||
{
|
||||
namespace FsCommon
|
||||
{
|
||||
//! Correctly casted values/checks @{
|
||||
HRESULT inline s_ok() { return S_OK; }
|
||||
HRESULT inline s_false() { return S_FALSE; }
|
||||
static bool inline isOk(HRESULT result) { return result == s_ok(); }
|
||||
static bool inline isOk(HRESULT hr1, HRESULT hr2, HRESULT hr3 = s_ok(), HRESULT hr4 = s_ok()) { return isOk(hr1) && isOk(hr2) && isOk(hr3) && isOk(hr4); }
|
||||
bool inline isFailure(HRESULT result) { return !isOk(result); }
|
||||
bool inline isFailure(HRESULT hr1, HRESULT hr2, HRESULT hr3 = s_ok(), HRESULT hr4 = s_ok()) { return !isOk(hr1, hr2, hr3, hr4); }
|
||||
bool inline dtb(double doubleBool) { return static_cast<bool>(qRound(doubleBool)); }
|
||||
//! @}
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
#endif // guard
|
||||
Reference in New Issue
Block a user