| 1 | /****************************************************************************
|
|---|
| 2 | ** $Id: qlocale_p.h 2 2005-11-16 15:49:26Z dmik $
|
|---|
| 3 | **
|
|---|
| 4 | ** Declaration of the QLocalePrivate class
|
|---|
| 5 | **
|
|---|
| 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved.
|
|---|
| 7 | **
|
|---|
| 8 | ** This file is part of the widgets module of the Qt GUI Toolkit.
|
|---|
| 9 | **
|
|---|
| 10 | ** This file may be distributed under the terms of the Q Public License
|
|---|
| 11 | ** as defined by Trolltech AS of Norway and appearing in the file
|
|---|
| 12 | ** LICENSE.QPL included in the packaging of this file.
|
|---|
| 13 | **
|
|---|
| 14 | ** This file may be distributed and/or modified under the terms of the
|
|---|
| 15 | ** GNU General Public License version 2 as published by the Free Software
|
|---|
| 16 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
|---|
| 17 | ** packaging of this file.
|
|---|
| 18 | **
|
|---|
| 19 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
|
|---|
| 20 | ** licenses may use this file in accordance with the Qt Commercial License
|
|---|
| 21 | ** Agreement provided with the Software.
|
|---|
| 22 | **
|
|---|
| 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
|---|
| 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
|---|
| 25 | **
|
|---|
| 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
|---|
| 27 | ** information about Qt Commercial License Agreements.
|
|---|
| 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information.
|
|---|
| 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
|---|
| 30 | **
|
|---|
| 31 | ** Contact info@trolltech.com if any conditions of this licensing are
|
|---|
| 32 | ** not clear to you.
|
|---|
| 33 | **
|
|---|
| 34 | **********************************************************************/
|
|---|
| 35 |
|
|---|
| 36 | #ifndef QLOCALE_P_H
|
|---|
| 37 | #define QLOCALE_P_H
|
|---|
| 38 |
|
|---|
| 39 | //
|
|---|
| 40 | // W A R N I N G
|
|---|
| 41 | // -------------
|
|---|
| 42 | //
|
|---|
| 43 | // This file is not part of the Qt API. It exists for the convenience
|
|---|
| 44 | // of internal files. This header file may change from version to version
|
|---|
| 45 | // without notice, or even be removed.
|
|---|
| 46 | //
|
|---|
| 47 | // We mean it.
|
|---|
| 48 | //
|
|---|
| 49 | //
|
|---|
| 50 |
|
|---|
| 51 | #include <qstring.h>
|
|---|
| 52 |
|
|---|
| 53 | struct QLocalePrivate
|
|---|
| 54 | {
|
|---|
| 55 | public:
|
|---|
| 56 | const QChar &decimal() const { return (QChar&)m_decimal; }
|
|---|
| 57 | const QChar &group() const { return (QChar&)m_group; }
|
|---|
| 58 | const QChar &list() const { return (QChar&)m_list; }
|
|---|
| 59 | const QChar &percent() const { return (QChar&)m_percent; }
|
|---|
| 60 | const QChar &zero() const { return (QChar&)m_zero; }
|
|---|
| 61 | QChar plus() const { return QChar('+'); }
|
|---|
| 62 | const QChar &minus() const { return (QChar&)m_minus; }
|
|---|
| 63 | const QChar &exponential() const { return (QChar&)m_exponential; }
|
|---|
| 64 | QString infinity() const;
|
|---|
| 65 | QString nan() const;
|
|---|
| 66 |
|
|---|
| 67 | Q_UINT32 languageId() const { return m_language_id; }
|
|---|
| 68 | Q_UINT32 countryId() const { return m_country_id; }
|
|---|
| 69 |
|
|---|
| 70 | bool isDigit(QChar d) const;
|
|---|
| 71 |
|
|---|
| 72 | enum DoubleForm {
|
|---|
| 73 | DFExponent = 0,
|
|---|
| 74 | DFDecimal,
|
|---|
| 75 | DFSignificantDigits,
|
|---|
| 76 | _DFMax = DFSignificantDigits
|
|---|
| 77 | };
|
|---|
| 78 |
|
|---|
| 79 | enum Flags {
|
|---|
| 80 | NoFlags = 0,
|
|---|
| 81 | Alternate = 0x01,
|
|---|
| 82 | ZeroPadded = 0x02,
|
|---|
| 83 | LeftAdjusted = 0x04,
|
|---|
| 84 | BlankBeforePositive = 0x08,
|
|---|
| 85 | AlwaysShowSign = 0x10,
|
|---|
| 86 | ThousandsGroup = 0x20,
|
|---|
| 87 | CapitalEorX = 0x40
|
|---|
| 88 | };
|
|---|
| 89 |
|
|---|
| 90 | QString doubleToString(double d,
|
|---|
| 91 | int precision = -1,
|
|---|
| 92 | DoubleForm form = DFSignificantDigits,
|
|---|
| 93 | int width = -1,
|
|---|
| 94 | unsigned flags = NoFlags) const;
|
|---|
| 95 | QString longLongToString(Q_LLONG l, int precision = -1,
|
|---|
| 96 | int base = 10,
|
|---|
| 97 | int width = -1,
|
|---|
| 98 | unsigned flags = NoFlags) const;
|
|---|
| 99 | QString unsLongLongToString(Q_ULLONG l, int precision = -1,
|
|---|
| 100 | int base = 10,
|
|---|
| 101 | int width = -1,
|
|---|
| 102 | unsigned flags = NoFlags) const;
|
|---|
| 103 | double stringToDouble(QString num, bool *ok) const;
|
|---|
| 104 | Q_LLONG stringToLongLong(QString num, int base, bool *ok) const;
|
|---|
| 105 | Q_ULLONG stringToUnsLongLong(QString num, int base, bool *ok) const;
|
|---|
| 106 |
|
|---|
| 107 | QString &numberToCLocale(QString &locale_num) const;
|
|---|
| 108 |
|
|---|
| 109 | Q_UINT32 m_language_id, m_country_id;
|
|---|
| 110 |
|
|---|
| 111 | Q_UINT16 m_decimal, m_group, m_list, m_percent,
|
|---|
| 112 | m_zero, m_minus, m_exponential;
|
|---|
| 113 |
|
|---|
| 114 | static const QString m_infinity;
|
|---|
| 115 | static const QString m_nan;
|
|---|
| 116 | static const QChar m_plus;
|
|---|
| 117 |
|
|---|
| 118 | static const char *systemLocaleName();
|
|---|
| 119 | };
|
|---|
| 120 |
|
|---|
| 121 | #endif
|
|---|