mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 17:35:34 +08:00
[PQ] added static "parsedFromString"
This commit is contained in:
committed by
Mat Sutcliffe
parent
1642502aae
commit
5bc09ed2c8
@@ -411,8 +411,7 @@ namespace BlackCore
|
|||||||
if (parser.matchesPart(1, "range") && parser.countParts() > 2)
|
if (parser.matchesPart(1, "range") && parser.countParts() > 2)
|
||||||
{
|
{
|
||||||
const QString r = parser.part(2);
|
const QString r = parser.part(2);
|
||||||
CLength d;
|
const CLength d = CLength::parsedFromString(r);
|
||||||
d.parseFromString(r);
|
|
||||||
this->setMaxRange(d);
|
this->setMaxRange(d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -455,6 +455,14 @@ namespace BlackMisc
|
|||||||
*this = CPqString::parse<PQ>(value, CPqString::SeparatorQtDefault);
|
*this = CPqString::parse<PQ>(value, CPqString::SeparatorQtDefault);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class MU, class PQ>
|
||||||
|
PQ CPhysicalQuantity<MU, PQ>::parsedFromString(const QString &value, CPqString::SeparatorMode mode)
|
||||||
|
{
|
||||||
|
PQ pq;
|
||||||
|
pq.parseFromString(value, mode);
|
||||||
|
return pq;
|
||||||
|
}
|
||||||
|
|
||||||
template <class MU, class PQ>
|
template <class MU, class PQ>
|
||||||
CVariant CPhysicalQuantity<MU, PQ>::propertyByIndex(const CPropertyIndex &index) const
|
CVariant CPhysicalQuantity<MU, PQ>::propertyByIndex(const CPropertyIndex &index) const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -276,6 +276,9 @@ namespace BlackMisc
|
|||||||
//! NULL PQ
|
//! NULL PQ
|
||||||
static const PQ &null();
|
static const PQ &null();
|
||||||
|
|
||||||
|
//! Parsed from given string
|
||||||
|
static PQ parsedFromString(const QString &value, CPqString::SeparatorMode mode = CPqString::SeparatorBestGuess);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! Constructor with double
|
//! Constructor with double
|
||||||
CPhysicalQuantity(double value, MU unit);
|
CPhysicalQuantity(double value, MU unit);
|
||||||
|
|||||||
Reference in New Issue
Block a user