15 #ifndef QGSFRACTIONNUMERICFORMAT_H
16 #define QGSFRACTIONNUMERICFORMAT_H
18 #include "qgis_core.h"
39 QString
id()
const override;
54 bool useDedicatedUnicodeCharacters()
const;
62 void setUseDedicatedUnicodeCharacters(
bool enabled );
69 bool useUnicodeSuperSubscript()
const;
76 void setUseUnicodeSuperSubscript(
bool enabled );
82 bool showThousandsSeparator()
const;
88 void setShowThousandsSeparator(
bool show );
94 bool showPlusSign()
const;
100 void setShowPlusSign(
bool show );
108 QChar thousandsSeparator()
const;
116 void setThousandsSeparator( QChar character );
133 sign = value < 0 ? -1 : 1;
134 double g = std::fabs( value );
135 unsigned long long a = 0;
136 unsigned long long b = 1;
137 unsigned long long c = 1;
138 unsigned long long d = 0;
139 unsigned long long s;
140 unsigned int iteration = 0;
144 numerator = a + s *
c;
145 denominator = b + s * d;
151 if (
qgsDoubleNear(
static_cast< double >( sign )*
static_cast< double >( numerator ) / denominator, value, tolerance ) )
156 while ( iteration++ < 100 );
164 static QString toUnicodeSuperscript(
const QString &input );
170 static QString toUnicodeSubscript(
const QString &input );
177 virtual void setConfiguration(
const QVariantMap &configuration,
const QgsReadWriteContext &context );
181 bool mUseDedicatedUnicode =
false;
182 bool mUseUnicodeSuperSubscript =
true;
183 bool mShowThousandsSeparator =
true;
184 bool mShowPlusSign =
false;
185 QChar mThousandsSeparator;
A context for numeric formats.
The class is used as a container of context for various read/write operations on other objects.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)