Add in simulator info returns delta

This commit is contained in:
Klaus Basan
2018-11-27 02:29:14 +01:00
parent 2ad293fbad
commit 9c46cab133
2 changed files with 8 additions and 3 deletions

View File

@@ -181,10 +181,15 @@ namespace BlackMisc
return CValueObject::toIcon(); return CValueObject::toIcon();
} }
void CSimulatorInfo::add(const CSimulatorInfo &other) CSimulatorInfo CSimulatorInfo::add(const CSimulatorInfo &other)
{ {
if (other.isUnspecified()) { return; } // anything to add?
if (other.isUnspecified()) { return None; }
if (this->matchesAll(other)) { return None; }
this->setSimulator(this->getSimulator() | other.getSimulator()); this->setSimulator(this->getSimulator() | other.getSimulator());
const CSimulatorInfo delta(this->getSimulator() & other.getSimulator());
return delta;
} }
QSet<CSimulatorInfo> CSimulatorInfo::asSingleSimulatorSet() const QSet<CSimulatorInfo> CSimulatorInfo::asSingleSimulatorSet() const

View File

@@ -157,7 +157,7 @@ namespace BlackMisc
CIcon toIcon() const; CIcon toIcon() const;
//! Add simulator //! Add simulator
void add(const CSimulatorInfo &other); CSimulatorInfo add(const CSimulatorInfo &other);
//! As a set of single simulator info objects //! As a set of single simulator info objects
QSet<CSimulatorInfo> asSingleSimulatorSet() const; QSet<CSimulatorInfo> asSingleSimulatorSet() const;