00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef QLOCALE_P_H
00037 #define QLOCALE_P_H
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 #include <qstring.h>
00052
00053 struct QLocalePrivate
00054 {
00055 public:
00056 const QChar &decimal() const { return (QChar&)m_decimal; }
00057 const QChar &group() const { return (QChar&)m_group; }
00058 const QChar &list() const { return (QChar&)m_list; }
00059 const QChar &percent() const { return (QChar&)m_percent; }
00060 const QChar &zero() const { return (QChar&)m_zero; }
00061 QChar plus() const { return QChar('+'); }
00062 const QChar &minus() const { return (QChar&)m_minus; }
00063 const QChar &exponential() const { return (QChar&)m_exponential; }
00064 QString infinity() const;
00065 QString nan() const;
00066
00067 Q_UINT32 languageId() const { return m_language_id; }
00068 Q_UINT32 countryId() const { return m_country_id; }
00069
00070 bool isDigit(QChar d) const;
00071
00072 enum GroupSeparatorMode {
00073 FailOnGroupSeparators,
00074 ParseGroupSeparators
00075 };
00076
00077 enum DoubleForm {
00078 DFExponent = 0,
00079 DFDecimal,
00080 DFSignificantDigits,
00081 _DFMax = DFSignificantDigits
00082 };
00083
00084 enum Flags {
00085 NoFlags = 0,
00086
00087
00088 Alternate = 0x01,
00089 ZeroPadded = 0x02,
00090 LeftAdjusted = 0x04,
00091 BlankBeforePositive = 0x08,
00092 AlwaysShowSign = 0x10,
00093 ThousandsGroup = 0x20,
00094 CapitalEorX = 0x40
00095 };
00096
00097 QString doubleToString(double d,
00098 int precision = -1,
00099 DoubleForm form = DFSignificantDigits,
00100 int width = -1,
00101 unsigned flags = NoFlags) const;
00102 QString longLongToString(Q_LLONG l, int precision = -1,
00103 int base = 10,
00104 int width = -1,
00105 unsigned flags = NoFlags) const;
00106 QString unsLongLongToString(Q_ULLONG l, int precision = -1,
00107 int base = 10,
00108 int width = -1,
00109 unsigned flags = NoFlags) const;
00110 double stringToDouble(QString num, bool *ok, GroupSeparatorMode group_sep_mode) const;
00111 Q_LLONG stringToLongLong(QString num, int base, bool *ok, GroupSeparatorMode group_sep_mode) const;
00112 Q_ULLONG stringToUnsLongLong(QString num, int base, bool *ok, GroupSeparatorMode group_sep_mode) const;
00113 bool removeGroupSeparators(QString &num_str) const;
00114 bool numberToCLocale(QString &locale_num, GroupSeparatorMode group_sep_mode) const;
00115
00116 Q_UINT32 m_language_id, m_country_id;
00117
00118 Q_UINT16 m_decimal, m_group, m_list, m_percent,
00119 m_zero, m_minus, m_exponential;
00120
00121 static const QString m_infinity;
00122 static const QString m_nan;
00123 static const QChar m_plus;
00124
00125 static const char *systemLocaleName();
00126 };
00127
00128 #endif