add posibility to use a unit schema other then the system schema to represent a quantity
This commit is contained in:
@@ -213,6 +213,11 @@ QString Quantity::getUserString(double& factor, QString& unitString) const
|
||||
return Base::UnitsApi::schemaTranslate(*this, factor, unitString);
|
||||
}
|
||||
|
||||
QString Quantity::getUserString(UnitsSchema* schema, double &factor, QString &unitString) const
|
||||
{
|
||||
return schema->schemaTranslate(*this, factor, unitString);
|
||||
}
|
||||
|
||||
/// true if it has a number without a unit
|
||||
bool Quantity::isDimensionless(void)const
|
||||
{
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#endif
|
||||
|
||||
namespace Base {
|
||||
class UnitsSchema;
|
||||
|
||||
struct BaseExport QuantityFormat {
|
||||
enum NumberOption {
|
||||
@@ -143,12 +144,13 @@ public:
|
||||
_Format = f;
|
||||
}
|
||||
/// transfer to user preferred unit/potence
|
||||
QString getUserString(double &factor, QString &unitString)const;
|
||||
QString getUserString(double &factor, QString &unitString) const;
|
||||
QString getUserString(void) const { // to satisfy GCC
|
||||
double dummy1;
|
||||
QString dummy2;
|
||||
return getUserString(dummy1,dummy2);
|
||||
}
|
||||
QString getUserString(UnitsSchema* schema, double &factor, QString &unitString) const;
|
||||
|
||||
static Quantity parse(const QString &string);
|
||||
|
||||
|
||||
@@ -86,7 +86,6 @@ public:
|
||||
|
||||
static double defaultFactor;
|
||||
|
||||
protected:
|
||||
/// return an instance of the given enum value
|
||||
static UnitsSchemaPtr createSchema(UnitSystem s);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user