refs #619, utility functions simulator info

This commit is contained in:
Klaus Basan
2016-03-12 05:26:48 +01:00
parent a5ad8c245b
commit 7714f5db9f
2 changed files with 20 additions and 0 deletions

View File

@@ -66,6 +66,11 @@ namespace BlackMisc
return fsx() || fs9() || xplane() || p3d(); return fsx() || fs9() || xplane() || p3d();
} }
bool CSimulatorInfo::isSingleSimulator() const
{
return this->numberSimulators() == 1;
}
bool CSimulatorInfo::isNoSimulator() const bool CSimulatorInfo::isNoSimulator() const
{ {
return m_simulator == 0; return m_simulator == 0;
@@ -76,6 +81,15 @@ namespace BlackMisc
return fsx() && fs9() && xplane() && p3d(); return fsx() && fs9() && xplane() && p3d();
} }
int CSimulatorInfo::numberSimulators() const
{
int c = fs9() ? 1 : 0;
if (fsx()) { c++; }
if (xplane()) { c++; }
if (p3d()) { c++; }
return c;
}
bool CSimulatorInfo::matchesAll(const CSimulatorInfo &otherInfo) const bool CSimulatorInfo::matchesAll(const CSimulatorInfo &otherInfo) const
{ {
return (this->m_simulator & otherInfo.m_simulator) == otherInfo.m_simulator; return (this->m_simulator & otherInfo.m_simulator) == otherInfo.m_simulator;

View File

@@ -80,12 +80,18 @@ namespace BlackMisc
//! Any simulator? //! Any simulator?
bool isAnySimulator() const; bool isAnySimulator() const;
//! Single simulator selected
bool isSingleSimulator() const;
//! No simulator? //! No simulator?
bool isNoSimulator() const; bool isNoSimulator() const;
//! Is all simulators? //! Is all simulators?
bool isAllSimulators() const; bool isAllSimulators() const;
//! Number simulators selected
int numberSimulators() const;
//! Matches all simulators //! Matches all simulators
bool matchesAll(const CSimulatorInfo &otherInfo) const; bool matchesAll(const CSimulatorInfo &otherInfo) const;