48 #include "private/qcore_unix_p.h" 56 #ifndef QT_NO_SYSTEMLOCALE 58 static const char ppsUomPath[] =
"/pps/services/locale/uom";
68 , measurementNotifier(0)
75 fprintf(stderr,
"Failed to open uom pps, errno=%d\n",
errno);
78 fprintf(stderr,
"Failed to open region pps, errno=%d\n",
errno);
81 fprintf(stderr,
"Failed to open language pps, errno=%d\n",
errno);
84 fprintf(stderr,
"Failed to open hour format pps, errno=%d\n",
errno);
186 if (!ppsObject || ppsFd == -1)
202 if (!bufferIsTooSmall)
213 fprintf(stderr,
"Failed to read pps object:%s, errno=%d\n", ppsObject,
errno);
217 buffer[bytes] =
'\0';
219 pps_decoder_t ppsDecoder;
220 pps_decoder_initialize(&ppsDecoder, 0);
221 if (pps_decoder_parse_pps_str(&ppsDecoder, buffer.
data()) == PPS_DECODER_OK) {
222 pps_decoder_push(&ppsDecoder, 0);
224 if (pps_decoder_get_string(&ppsDecoder, ppsObject, &ppsBuff) == PPS_DECODER_OK) {
228 if (pps_decoder_get_int(&ppsDecoder, ppsObject, &val) == PPS_DECODER_OK)
233 pps_decoder_cleanup(&ppsDecoder);
265 return bbSysLocaleData()->languageLocale();
288 case DateFormatShort:
292 case TimeFormatShort:
294 case DateTimeFormatLong:
296 case DateTimeFormatShort:
306 case StandaloneMonthNameLong:
308 case StandaloneMonthNameShort:
310 case DateToStringLong:
312 case DateToStringShort:
314 case TimeToStringLong:
316 case TimeToStringShort:
318 case DateTimeToStringShort:
320 case DateTimeToStringLong:
322 case MeasurementSystem:
331 return lc_language.
amText();
333 return lc_language.
pmText();
The QVariant class acts like a union for the most common Qt data types.
QBool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
QSocketNotifier * languageNotifier
QChar positiveSign() const
Returns the positive sign character of this locale.
static const char ppsHourFormatPath[]
Language language() const
Returns the language of this locale.
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
#define QT_END_NAMESPACE
This macro expands to.
QString monthName(int, FormatType format=LongFormat) const
Returns the localized name of month, in the format specified by type.
QString & replace(int i, int len, QChar after)
QString formatType(const NamePool::Ptr &np, const T &type)
Formats ItemType and SequenceType.
The QByteArray class provides an array of bytes.
QSocketNotifier * measurementNotifier
QString toString() const
Returns the variant as a QString if the variant has type() String , Bool , ByteArray ...
QDateTime toDateTime() const
Returns the variant as a QDateTime if the variant has type() DateTime , Date , or String ; otherwise ...
QChar zeroDigit() const
Returns the zero digit character of this locale.
QByteArray readPpsValue(const char *ppsObject, int ppsFd)
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
static int qt_safe_close(int fd)
The QString class provides a Unicode character string.
virtual ~QBBSystemLocaleData()
QString toString(qlonglong i) const
Returns a localized string representation of i.
The QSocketNotifier class provides support for monitoring activity on a file descriptor.
int toInt(bool *ok=0) const
Returns the variant as an int if the variant has type() Int , Bool , ByteArray , Char ...
#define QT_BEGIN_NAMESPACE
This macro expands to.
static int qt_safe_open(const char *pathname, int flags, mode_t mode=0777)
QChar decimalPoint() const
Returns the decimal point character of this locale.
static const int MAX_PPS_SIZE
QChar groupSeparator() const
Returns the group separator character of this locale.
QString pmText() const
Returns the localized name of the "PM" suffix for times specified using the conventions of the 12-hou...
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
#define Q_GLOBAL_STATIC(TYPE, NAME)
Declares a global static variable with the given type and name.
static const char ppsUomPath[]
QSocketNotifier * hourNotifier
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
The QReadLocker class is a convenience class that simplifies locking and unlocking read-write locks f...
QChar negativeSign() const
Returns the negative sign character of this locale.
QString amText() const
Returns the localized name of the "AM" suffix for times specified using the conventions of the 12-hou...
QDate toDate() const
Returns the variant as a QDate if the variant has type() Date , DateTime , or String ; otherwise retu...
static QLocale c()
Returns a QLocale object initialized to the "C" locale.
QString & append(QChar c)
QVariant timeFormat(QLocale::FormatType)
static QCoreApplication * instance()
Returns a pointer to the application's QCoreApplication (or QApplication) instance.
QString standaloneMonthName(int, FormatType format=LongFormat) const
Returns the localized name of month that is used as a standalone text, in the format specified by typ...
QString getCorrectFormat(const QString &baseFormat, QLocale::FormatType typeFormat)
virtual QVariant query(QueryType type, QVariant in) const
QVariant dateTimeFormat(QLocale::FormatType)
static const char ppsRegionLocalePath[]
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
QString dayName(int, FormatType format=LongFormat) const
Returns the localized name of the day (where 1 represents Monday, 2 represents Tuesday and so on)...
int qstrcmp(const QByteArray &str1, const char *str2)
QTime toTime() const
Returns the variant as a QTime if the variant has type() Time , DateTime , or String ; otherwise retu...
void installSocketNotifiers()
Country country() const
Returns the country of this locale.
QString dateFormat(FormatType format=LongFormat) const
Returns the date format used for the current locale.
static const char ppsLanguageLocalePath[]
static QByteArray number(int, int base=10)
Returns a byte array containing the string equivalent of the number n to base base (10 by default)...
void readMeasurementSystem()
QSocketNotifier * regionNotifier
static qint64 qt_safe_read(int fd, void *data, qint64 maxlen)