summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qlocale_p.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2013-04-25 22:40:54 -0700
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-14 00:34:25 +0100
commit1b26ef0c0c894a720b163333396054a8571e2581 (patch)
treeaa53520ad0c4e3c39878bc77578be3f8d9d89303 /src/corelib/tools/qlocale_p.h
parent27ad3894e67a89439905321b388d75a278b4399a (diff)
QLocalePrivate: move the xxxToString functions to QLocaleData
Those functions do not need any of extra QLocale settings in QLocalePrivate, so we can move them easily, along with their flags. It's also very convenient that we can now bypass completely QLocale when formatting numbers to strings. Change-Id: I8cae64e8e2056a6b2d716758e4be79f746644732 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/corelib/tools/qlocale_p.h')
-rw-r--r--src/corelib/tools/qlocale_p.h103
1 files changed, 52 insertions, 51 deletions
diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h
index b544a55c31..0063990125 100644
--- a/src/corelib/tools/qlocale_p.h
+++ b/src/corelib/tools/qlocale_p.h
@@ -166,6 +166,58 @@ public:
QLocale::Country country);
static const QLocaleData *c();
+ enum DoubleForm {
+ DFExponent = 0,
+ DFDecimal,
+ DFSignificantDigits,
+ _DFMax = DFSignificantDigits
+ };
+
+ enum Flags {
+ NoFlags = 0,
+ Alternate = 0x01,
+ ZeroPadded = 0x02,
+ LeftAdjusted = 0x04,
+ BlankBeforePositive = 0x08,
+ AlwaysShowSign = 0x10,
+ ThousandsGroup = 0x20,
+ CapitalEorX = 0x40,
+
+ ShowBase = 0x80,
+ UppercaseBase = 0x100,
+ ForcePoint = Alternate
+ };
+
+ static QString doubleToString(const QChar zero, const QChar plus,
+ const QChar minus, const QChar exponent,
+ const QChar group, const QChar decimal,
+ double d, int precision,
+ DoubleForm form,
+ int width, unsigned flags);
+ static QString longLongToString(const QChar zero, const QChar group,
+ const QChar plus, const QChar minus,
+ qint64 l, int precision, int base,
+ int width, unsigned flags);
+ static QString unsLongLongToString(const QChar zero, const QChar group,
+ const QChar plus,
+ quint64 l, int precision,
+ int base, int width,
+ unsigned flags);
+
+ QString doubleToString(double d,
+ int precision = -1,
+ DoubleForm form = DFSignificantDigits,
+ int width = -1,
+ unsigned flags = NoFlags) const;
+ QString longLongToString(qint64 l, int precision = -1,
+ int base = 10,
+ int width = -1,
+ unsigned flags = NoFlags) const;
+ QString unsLongLongToString(quint64 l, int precision = -1,
+ int base = 10,
+ int width = -1,
+ unsigned flags = NoFlags) const;
+
quint16 m_language_id, m_script_id, m_country_id;
quint16 m_decimal, m_group, m_list, m_percent, m_zero, m_minus, m_plus, m_exponential;
@@ -250,62 +302,11 @@ public:
QLocale::MeasurementSystem measurementSystem() const;
- enum DoubleForm {
- DFExponent = 0,
- DFDecimal,
- DFSignificantDigits,
- _DFMax = DFSignificantDigits
- };
-
- enum Flags {
- NoFlags = 0,
- Alternate = 0x01,
- ZeroPadded = 0x02,
- LeftAdjusted = 0x04,
- BlankBeforePositive = 0x08,
- AlwaysShowSign = 0x10,
- ThousandsGroup = 0x20,
- CapitalEorX = 0x40,
-
- ShowBase = 0x80,
- UppercaseBase = 0x100,
- ForcePoint = Alternate
- };
-
enum GroupSeparatorMode {
FailOnGroupSeparators,
ParseGroupSeparators
};
- static QString doubleToString(const QChar zero, const QChar plus,
- const QChar minus, const QChar exponent,
- const QChar group, const QChar decimal,
- double d, int precision,
- DoubleForm form,
- int width, unsigned flags);
- static QString longLongToString(const QChar zero, const QChar group,
- const QChar plus, const QChar minus,
- qint64 l, int precision, int base,
- int width, unsigned flags);
- static QString unsLongLongToString(const QChar zero, const QChar group,
- const QChar plus,
- quint64 l, int precision,
- int base, int width,
- unsigned flags);
-
- QString doubleToString(double d,
- int precision = -1,
- DoubleForm form = DFSignificantDigits,
- int width = -1,
- unsigned flags = NoFlags) const;
- QString longLongToString(qint64 l, int precision = -1,
- int base = 10,
- int width = -1,
- unsigned flags = NoFlags) const;
- QString unsLongLongToString(quint64 l, int precision = -1,
- int base = 10,
- int width = -1,
- unsigned flags = NoFlags) const;
double stringToDouble(const QChar *begin, int len, bool *ok, GroupSeparatorMode group_sep_mode) const;
qint64 stringToLongLong(const QChar *begin, int len, int base, bool *ok, GroupSeparatorMode group_sep_mode) const;
quint64 stringToUnsLongLong(const QChar *begin, int len, int base, bool *ok, GroupSeparatorMode group_sep_mode) const;