4#include "qplatformdefs.h"
5#include "private/qdatetimeparser_p.h"
14#include "private/qlocale_p.h"
16#include "private/qstringiterator_p.h"
17#include "private/qtenvironmentvariables_p.h"
20#if defined (QDATETIMEPARSER_DEBUG) && !defined(QT_NO_DEBUG_STREAM)
21# define QDTPDEBUG qDebug()
22# define QDTPDEBUGN qDebug
24# define QDTPDEBUG if (false) qDebug()
25# define QDTPDEBUGN if (false) qDebug
51 qWarning(
"QDateTimeParser::getDigit() Internal error (%ls %d)",
73 qWarning(
"QDateTimeParser::getDigit() Internal error 2 (%ls %d)",
89 const int diff = sought - held;
90 return diff < -3 ? diff + 7 : diff > 3 ? diff - 7 : diff;
97 for (
const auto &node : nodes) {
121 qWarning(
"QDateTimeParser::setDigit() Internal error (%ls %d %d)",
126 const QDate oldDate =
v.date();
131 enum { NoFix, MonthDay,
WeekDay } fixDay = NoFix;
161 if (newVal > 7 || newVal <= 0)
173 case AmPmSection: hour = (newVal == 0 ? hour % 12 : (hour % 12) + 12);
break;
175 qWarning(
"QDateTimeParser::setDigit() Internal error (%ls)",
189 if (newDoW > 0 && newDoW <= 7)
195 if (fixDay != NoFix) {
207 const QTime newTime(hour, minute, second, msec);
208 if (!newDate.isValid() || !newTime.isValid())
252 return int(UpperCase);
256 qWarning(
"QDateTimeParser::absoluteMax() Internal error (%ls)",
289 qWarning(
"QDateTimeParser::absoluteMin() Internal error (%ls, %0x)",
302 if (sectionIndex < 0) {
303 switch (sectionIndex) {
315 qWarning(
"QDateTimeParser::sectionNode() Internal error (%d)",
361 if (!QChar::isDigit(
it.next()))
384 for (
int i=0;
i<max; ++
i) {
388 else if (!
ret.isEmpty() &&
str.
at(
i - 1) == slash)
409 int from,
int size,
int lastQuote)
430 QDTPDEBUGN(
"parseFormat: %s", newFormat.toLatin1().constData());
432 QList<SectionNode> newSectionNodes;
438 const int max = newFormat.size();
440 for (
i = 0;
i<max; ++
i) {
441 if (newFormat.at(
i) ==
quote) {
446 else if (
i > 0 && newFormat.at(
i - 1) != slash)
448 }
else if (status !=
quote) {
449 const char sect = newFormat.at(
i).toLatin1();
456 newSectionNodes.append(sn);
466 newSectionNodes.append(sn);
476 newSectionNodes.append(sn);
488 newSectionNodes.append(sn);
499 Case caseOpt = sect ==
'A' ? UpperCase : LowerCase;
502 if (
i + 1 < newFormat.size()
505 if (newFormat.at(
i) !=
QLatin1Char(caseOpt == UpperCase ?
'P' :
'p'))
506 caseOpt = NativeCase;
509 newSectionNodes.append(sn);
518 i -
add, repeat == 4 ? 4 : 2, 0 };
519 newSectionNodes.append(sn);
523 newDisplay |= sn.
type;
530 newSectionNodes.append(sn);
531 newSeparators.append(
unquote(newFormat.first(
i).sliced(
index)));
543 newSectionNodes.append(sn);
547 newDisplay |= sn.
type;
554 newSectionNodes.append(sn);
570 const int count = newSectionNodes.size();
581 newSeparators.append(
QString());
607 if (sectionIndex < 0)
611 qWarning(
"QDateTimeParser::sectionSize Internal error (%d)", sectionIndex);
620 int sizeAdjustment = 0;
624 int preceedingZeroesAdded = 0;
627 const auto end =
begin + sectionIndex;
628 for (
auto sectionIt =
begin; sectionIt !=
end; ++sectionIt)
629 preceedingZeroesAdded += sectionIt->zeroesAdded;
631 sizeAdjustment = preceedingZeroesAdded;
642int QDateTimeParser::sectionMaxSize(Section
s,
int count)
const
644#if QT_CONFIG(textdate)
668#if QT_CONFIG(textdate)
673#if QT_CONFIG(textdate)
681 for (
int i=1;
i<=mcount; ++
i) {
700 return std::numeric_limits<int>::max();
710 qWarning(
"QDateTimeParser::sectionMaxSize: Invalid section %s",
725int QDateTimeParser::sectionMaxSize(
int index)
const
728 return sectionMaxSize(sn.
type, sn.
count);
739 const auto isSimpleSpace = [](
char32_t ch) {
741 return ch == u
' ' || (
ch > 127 && QChar::isSpace(
ch));
748 while (
sep.hasNext()) {
749 if (!given.hasNext())
751 char32_t s =
sep.next(),
g = given.next();
752 if (
s !=
g && !(isSimpleSpace(
s) && isSimpleSpace(
g)))
756 return given.index();
758 return separator.
size();
783QString QDateTimeParser::sectionText(
int sectionIndex)
const
789QDateTimeParser::ParsedSection
795 "QDateTimeParser::parseSection",
"Internal error");
797 const int sectionmaxsize = sectionMaxSize(sectionIndex);
800 const int negativeYearOffset = negate ? 1 : 0;
805 QDTPDEBUG <<
"sectionValue for" << sn.name()
807 <<
") st:" << sectionTextRef;
811 QString sectiontext = sectionTextRef.toString();
813 const int ampm = findAmPm(sectiontext, sectionIndex, &used);
827 QDTPDEBUG <<
"invalid because findAmPm(" << sectiontext <<
") returned -1";
830 QDTPDEBUGN(
"This should never happen (findAmPm returned %d)", ampm);
845 QString sectiontext = sectionTextRef.toString();
846 int num = 0, used = 0;
851 num = findMonth(sectiontext.toLower(), min, sectionIndex, year, §iontext, &used);
853 num = findDay(sectiontext.toLower(), 1, sectionIndex, §iontext, &used);
859 if (used == sectiontext.size())
875 negativeYearOffset, sectionIndex,
this]() {
886 int used = negativeYearOffset;
889 if (sectionTextRef.startsWith(u
'-')
890 || sectionTextRef.startsWith(u
'+')) {
898 if (digitsStr.isEmpty()) {
907 for (; digitsStr.size(); digitsStr.chop(1)) {
910 if (!
ok || (negate ? -value < absMin : value > absMax))
922 used += digitsStr.size();
927 if (!checkSeparator()) {
928 QDTPDEBUG <<
"invalid because" << sectionTextRef <<
"can't become a uint"
934 const FieldInfo fi =
fieldInfo(sectionIndex);
935 const bool unfilled = used - negativeYearOffset < sectionmaxsize;
936 if (unfilled && fi & Fraction) {
937 for (
int i = used;
i < sectionmaxsize; ++
i)
941 Q_ASSERT(negate ? lastVal >= absMin : lastVal <= absMax);
942 if (negate ? lastVal > absMax : lastVal < absMin) {
946 QDTPDEBUG <<
"invalid because" << lastVal <<
"is greater than absoluteMax"
949 QDTPDEBUG <<
"invalid because" << lastVal <<
"is less than absoluteMin"
955 const int missingZeroes = sectionmaxsize - digitsStr.size();
969 qWarning(
"QDateTimeParser::parseSection Internal error (%ls %d)",
990 const int maxDay =
calendar.daysInMonth(month, year);
991 day = maxDay > 1 ?
qBound(1, day, maxDay) :
qMax(1, day);
993 return day <= 0 ? day + 7 : maxDay > 0 && day > maxDay ? day - 7 : day;
1003 const int year = baseYear - baseYear % 100 + y2d;
1004 return year < baseYear ? year + 100 : year;
1016 int year,
int year2digits,
int month,
int day,
int dayofweek)
1019 if (actual.isValid() && year % 100 == year2digits &&
calendar.dayOfWeek(actual) == dayofweek)
1022 if (dayofweek < 1 || dayofweek > 7)
1026 if (year % 100 != year2digits) {
1032 year2digits = year % 100;
1035 Q_ASSERT(year % 100 == year2digits);
1040 }
else if (month > 12) {
1055 const int diff = (dayofweek -
calendar.dayOfWeek(
first) - last) % 7;
1068 }
else if (day >
calendar.maximumDaysInMonth()) {
1076 if (!actual.isValid()
1080 ||
calendar.dayOfWeek(actual) == dayofweek
1106 for (
int m = 1;
m < 12;
m++) {
1109 if (
calendar.dayOfWeek(actual) == dayofweek)
1112 if (
m + month <= 12) {
1114 if (
calendar.dayOfWeek(actual) == dayofweek)
1124 actual =
calendar.matchCenturyToWeekday({year, month, day}, dayofweek);
1125 if (actual.isValid()) {
1131 for (
int y = 1;
y < 12;
y++) {
1133 if (
calendar.dayOfWeek(actual) == dayofweek)
1136 if (
calendar.dayOfWeek(actual) == dayofweek)
1151 int hour,
int hour12,
int ampm,
1152 int minute,
int second,
int msec)
1155 QTime actual(hour, minute, second, msec);
1156 if (hour12 < 0 || hour12 > 12) {
1166 hour = hour12 + (hour > 12 ? 12 : 0);
1169 if (hour - hour12 == ampm * 12)
1174 hour = hour12 + ampm * 12;
1177 actual =
QTime(hour, minute, second, msec);
1189 for (
int i = 0;
i < 2; ++
i) {
1191 if (zone.size() > longest &&
name.startsWith(zone))
1192 longest = zone.size();
1196 if (
name.startsWith(zone)) {
1198 if (9 > longest && zone.size() == 6 && zone.startsWith(
"UTC"_L1)
1199 &&
name.sliced(6, 3) ==
":00"_L1) {
1201 }
else if (zone.size() > longest) {
1202 longest = zone.size();
1206#if QT_CONFIG(timezone)
1212 consider(localWhen.timeRepresentation().displayName(
1213 localWhen, QTimeZone::ShortName, locale));
1220 return int(longest);
1227QDateTimeParser::scanString(
const QDateTime &defaultValue,
bool fixup)
const
1230 bool conflicts =
false;
1234 int year, month, day;
1235 const QDate defaultDate = defaultValue.
date();
1236 const QTime defaultTime = defaultValue.
time();
1237 defaultDate.getDate(&year, &month, &day);
1238 int year2digits = year % 100;
1239 int hour = defaultTime.
hour();
1241 int minute = defaultTime.minute();
1242 int second = defaultTime.second();
1243 int msec = defaultTime.msec();
1256 <<
"does not start with" << separator
1262 int *current =
nullptr;
1267 year, year2digits, month, day, dayofweek);
1271 ParsedSection sect = parseSection(usedDateTime,
index,
pos);
1274 <<
"pos" <<
pos <<
"used" << sect.used <<
stateName(sect.state);
1276 padding += sect.zeroes;
1277 if (fixup && sect.state ==
Intermediate && sect.used < sn.count) {
1282 sect.used = sn.
count;
1293 current = &zoneOffset;
1294 if (sect.used > 0) {
1300 = zoneName.
startsWith(
"UTC"_L1) ? zoneName.sliced(3) : zoneName;
1301 const bool isUtcOffset = offsetStr.startsWith(u
'+') || offsetStr.startsWith(u
'-');
1302 const bool isUtc = zoneName ==
"Z"_L1 || zoneName ==
"UTC"_L1;
1304 if (isUtc || isUtcOffset) {
1306#if QT_CONFIG(timezone)
1310 timeZone = namedZone;
1327 case DaySection: current = &day; sect.value = qMax<int>(1, sect.value);
break;
1330 qWarning(
"QDateTimeParser::parse Internal error (%ls)",
1342 if (isSet & sn.type && *current != sect.value) {
1343 QDTPDEBUG <<
"CONFLICT " << sn.name() << *current << sect.value;
1348 *current = sect.value;
1364 year, year2digits, month, day, dayofweek);
1386 QDTPDEBUG << year << month << day << dayofweek
1391 bool needfixday =
false;
1412 for (
int i=0;
i<sectionNodesCount; ++
i) {
1435 ampm = !hasHour || hour < 12 ? 0 : 1;
1436 hour12 = hour12 % 12 + ampm * 12;
1439 else if (hour != hour12)
1441 }
else if (ampm != -1) {
1444 else if ((ampm == 0) != (hour < 12))
1449 QDTPDEBUG << year << month << day << hour << minute << second << msec;
1453 const QTime time(hour, minute, second, msec);
1464 case QMetaType::QDateTime: {
1473 return StateNode(replace,
state, padding, conflicts);
1476 case QMetaType::QDate:
1479 state, padding, conflicts);
1481 case QMetaType::QTime:
1484 state, padding, conflicts);
1486 Q_UNREACHABLE_RETURN(StateNode());
1493 return StateNode(when,
state, padding, conflicts);
1502 const QDateTime &defaultValue,
bool fixup)
const
1509 StateNode scan = scanString(defaultValue, fixup);
1511 scan.
value.toString(
"yyyy/MM/dd hh:mm:ss.zzz"_L1).toLatin1().constData(),
1517 if (scan.
value >= minimum)
1518 qWarning(
"QDateTimeParser::parse Internal error 3 (%ls %ls)",
1524 for (
int i=0;
i<sectionNodesCount && !
done; ++
i) {
1527 if ((
t.size() < sectionMaxSize(
i)
1529 ||
t.contains(space)) {
1532 switch (findAmPm(
t,
i)) {
1544 case PossibleBoth: {
1546 if (
copy >= minimum &&
copy <= maximum) {
1554 if (sn.
count >= 3) {
1557 int tmp = finalMonth;
1559 while ((tmp = findMonth(
t, tmp + 1,
i, when.
year(
calendar))) != -1) {
1561 if (
copy >= minimum &&
copy <= maximum)
1590 if (toMin > maxChange) {
1591 QDTPDEBUG <<
"invalid because toMin > maxChange" << toMin
1592 << maxChange <<
t << scan.
value << minimum;
1596 }
else if (toMax > maxChange) {
1602 qWarning(
"QDateTimeParser::parse Internal error 4 (%ls)",
1611 if (pos < 0 || pos >=
t.size())
1613 if (!potentialValue(
t.simplified(), min, max,
i, scan.
value,
pos)) {
1614 QDTPDEBUG <<
"invalid because potentialValue(" <<
t.simplified() << min << max
1615 << sn.
name() <<
"returned" << toMax << toMin <<
pos;
1629 Q_ASSERT(maximum.date().toJulianDay() == 5373484);
1632 }
else if (scan.
value > maximum) {
1636 QDTPDEBUG <<
"not checking intermediate because scanned value is" << scan.
value << minimum << maximum;
1664 for (
int n = 0;
n < entries.size(); ++
n)
1673 if (
i > bestCount || (
i == bestCount &&
i ==
name.size())) {
1680 if (usedText && bestMatch != -1)
1681 *usedText = entries.at(bestMatch);
1694int QDateTimeParser::findMonth(
QStringView str,
int startMonth,
int sectionIndex,
1695 int year,
QString *usedMonth,
int *used)
const
1697 const SectionNode &sn =
sectionNode(sectionIndex);
1699 qWarning(
"QDateTimeParser::findMonth Internal error");
1705 ShortVector<QString> monthNames;
1706 monthNames.reserve(13 - startMonth);
1707 for (
int month = startMonth; month <= 12; ++month)
1714int QDateTimeParser::findDay(
QStringView str,
int startDay,
int sectionIndex,
QString *usedDay,
int *used)
const
1716 const SectionNode &sn =
sectionNode(sectionIndex);
1718 qWarning(
"QDateTimeParser::findDay Internal error");
1724 ShortVector<QString> daysOfWeek;
1725 daysOfWeek.reserve(8 - startDay);
1726 for (
int day = startDay; day <= 7; ++day)
1741QDateTimeParser::ParsedSection QDateTimeParser::findUtcOffset(
QStringView str,
int mode)
const
1746 if (startsWithUtc) {
1748 return ParsedSection();
1757 return ParsedSection();
1762 bool hasColon = (colonPosition >= 0 && colonPosition < 3);
1765 const int digits = hasColon ? colonPosition + 3 : 4;
1768 if (
i != colonPosition && !
str.
at(
i).isDigit())
1771 const int hoursLength =
qMin(
i, hasColon ? colonPosition : 2);
1772 if (hoursLength < 1)
1773 return ParsedSection();
1777 if (!startsWithUtc && hoursLength != 2)
1778 return ParsedSection();
1782 if (
mode == (hasColon ? 2 : 3))
1789 return ParsedSection();
1791 const int minutes = minutesStr.
isEmpty() ? 0 : minutesStr.toInt(&isInt);
1793 return ParsedSection();
1798 const State status = (hours > 14 || minutes >= 60) ?
Invalid
1801 int offset = 3600 * hours + 60 * minutes;
1806 const int usedSymbols = (startsWithUtc ? 3 : 0) + 1 + hoursLength + (hasColon ? 1 : 0)
1807 + minutesStr.
size();
1809 return ParsedSection(status,
offset, usedSymbols);
1819QDateTimeParser::ParsedSection
1823#if QT_CONFIG(timezone)
1826 const auto invalidZoneNameCharacter = [] (
const QChar &
c) {
1827 const auto cu =
c.unicode();
1828 return cu >= 127u || !(memchr(
"+-./:_",
char(cu), 6) ||
c.isLetterOrNumber());
1839 while (lastSlash <
index) {
1840 int slash =
str.
indexOf(u
'/', lastSlash + 1);
1841 if (slash < 0 || slash >
index)
1843 else if (++
count > 5)
1845 if (slash - lastSlash > 20)
1846 index = lastSlash + 20;
1858 if (systemLength > 0)
1860 return ParsedSection();
1875QDateTimeParser::ParsedSection
1877 int maxVal,
int minVal,
int mode)
const
1884 ParsedSection section;
1886 section = findUtcOffset(
str,
mode);
1887 if (
mode != 2 &&
mode != 3 && section.used <= 0)
1888 section = findTimeZoneName(
str, when);
1890 if (section.state ==
Acceptable && (section.value < minVal || section.value > maxVal))
1892 if (section.used > 0)
1903 return ParsedSection();
1920QDateTimeParser::AmPmFinder QDateTimeParser::findAmPm(
QString &
str,
int sectionIndex,
int *used)
const
1924 qWarning(
"QDateTimeParser::findAmPm Internal error");
1930 return PossibleBoth;
1933 int size = sectionMaxSize(sectionIndex);
1940 ampm[amindex] = getAmPmText(
AmText, Case(
s.count));
1941 ampm[pmindex] = getAmPmText(
PmText, Case(
s.count));
1942 for (
int i = 0;
i < 2; ++
i)
1943 ampm[
i].truncate(
size);
1948 str = ampm[amindex];
1951 str = ampm[pmindex];
1958 bool broken[2] = {
false,
false};
1962 for (
int j=0;
j<2; ++
j) {
1966 <<
"in" << ampm[
j] <<
"and got" <<
index;
1968 if (
ch.category() == QChar::Letter_Uppercase) {
1969 index = ampm[
j].indexOf(
ch.toLower());
1971 <<
"in" << ampm[
j] <<
"and got" <<
index;
1972 }
else if (
ch.category() == QChar::Letter_Lowercase) {
1973 index = ampm[
j].indexOf(
ch.toUpper());
1975 <<
"in" << ampm[
j] <<
"and got" <<
index;
1979 if (broken[amindex] && broken[pmindex]) {
1988 ampm[
j].remove(
index, 1);
1993 if (!broken[pmindex] && !broken[amindex])
1994 return PossibleBoth;
1995 return (!broken[amindex] ? PossibleAM : PossiblePM);
2020 qWarning(
"QDateTimeParser::maxChange() Internal error (%ls)",
2074 qWarning(
"QDateTimeParser::fieldInfo Internal error 2 (%d %ls %d)",
2098 qWarning(
"QDateTimeParser::sectionFormat Internal error (%ls)",
2102 if (fillChar.isNull()) {
2103 qWarning(
"QDateTimeParser::sectionFormat Internal error 2");
2128 val += year - (year % 100);
2136 for (
int i=0;
i<
len; ++
i) {
2137 for (
int j=0;
j<10; ++
j) {
2140 }
else if (
insert >= 0) {
2164 Q_ASSERT(current >= minimum && current <= maximum);
2183 return !potentialValue(
text, min, max,
index, current,
pos);
2222 case Invalid:
return "Invalid"_L1;
2276 *datetime = tmp.
value;
2288 return localTimeMin;
2299 return localTimeMax;
2302QString QDateTimeParser::getAmPmText(
AmPm ap, Case cs)
const
2308 case UpperCase:
return std::move(raw).toUpper();
2309 case LowerCase:
return std::move(raw).toLower();
2310 case NativeCase:
return raw;
2312 Q_UNREACHABLE_RETURN(raw);
2321 return (
s1.type ==
s2.type) && (
s1.pos ==
s2.pos) && (
s1.count ==
s2.count);
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
The QCalendar class describes calendar systems.
QDate dateFromParts(int year, int month, int day) const
int minimumDaysInMonth() const
Returns the number of days in the shortest month in the calendar, in any year.
bool isDateValid(int year, int month, int day) const
Returns true precisely if the given year, month, and day specify a valid date in this calendar.
QString monthName(const QLocale &locale, int month, int year=Unspecified, QLocale::FormatType format=QLocale::LongFormat) const
Returns a suitably localised name for a month.
YearMonthDay partsFromDate(QDate date) const
Converts a QDate to a year, month, and day of the month.
int maximumMonthsInYear() const
Returns the largest number of months that any year may contain.
int maximumDaysInMonth() const
Returns the number of days in the longest month in the calendar, in any year.
int dayOfWeek(QDate date) const
Returns the day of the week number for the given date.
int daysInMonth(int month, int year=Unspecified) const
Returns the number of days in the given month of the given year.
virtual QLocale locale() const
int absoluteMin(int index) const
virtual QString displayText() const
int sectionSize(int index) const
int absoluteMax(int index, const QDateTime &value=QDateTime()) const
QString stateName(State s) const
virtual ~QDateTimeParser()
FieldInfo fieldInfo(int index) const
virtual QDateTime getMaximum() const
int getDigit(const QDateTime &dt, int index) const
StateNode parse(const QString &input, int position, const QDateTime &defaultValue, bool fixup) const
virtual int cursorPosition() const
virtual QDateTime getMinimum() const
bool skipToNextSection(int section, const QDateTime ¤t, QStringView sectionText) const
bool fromString(const QString &text, QDate *date, QTime *time, int baseYear=QLocale::DefaultTwoDigitBaseYear) const
QList< SectionNode > sectionNodes
Section sectionType(int index) const
const SectionNode & sectionNode(int index) const
bool setDigit(QDateTime &t, int index, int newval) const
QMetaType::Type parserType
int sectionPos(int index) const
void setCalendar(QCalendar calendar)
Sets cal as the calendar to use.
bool parseFormat(QStringView format)
\inmodule QtCore\reentrant
int offsetFromUtc() const
qint64 toMSecsSinceEpoch() const
static QDateTime fromMSecsSinceEpoch(qint64 msecs, const QTimeZone &timeZone)
QDateTime addMonths(int months) const
Returns a QDateTime object containing a datetime nmonths months later than the datetime of this objec...
QTime time() const
Returns the time part of the datetime.
QDateTime toLocalTime() const
Returns a copy of this datetime converted to local time.
QString timeZoneAbbreviation() const
QDateTime addSecs(qint64 secs) const
Returns a QDateTime object containing a datetime s seconds later than the datetime of this object (or...
Qt::TimeSpec timeSpec() const
Returns the time specification of the datetime.
bool isValid() const
Returns true if this datetime represents a definite moment, otherwise false.
qint64 daysTo(const QDateTime &) const
Returns the number of days from this datetime to the other datetime.
QTimeZone timeRepresentation() const
QDate date() const
Returns the date part of the datetime.
\inmodule QtCore \reentrant
constexpr bool isValid() const
Returns true if this date is valid; otherwise returns false.
constexpr qint64 toJulianDay() const
Converts the date to a Julian day.
int month() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
int day() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
int year() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
QDateTime startOfDay(const QTimeZone &zone) const
void append(parameter_type t)
uint toUInt(const QString &s, bool *ok=nullptr) const
Returns the unsigned int represented by the localized string s.
QString dayName(int, FormatType format=LongFormat) const
QString toString(qlonglong i) const
Returns a localized string representation of i.
bool startsWith(QStringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
constexpr qsizetype size() const noexcept
Returns the size of this string view, in UTF-16 code units (that is, surrogate pairs count as two for...
constexpr QStringView left(qsizetype n) const noexcept
QString toString() const
Returns a deep copy of this string view's data as a QString.
constexpr QStringView sliced(qsizetype pos) const noexcept
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString left(qsizetype n) const &
QByteArray toLatin1() const &
qsizetype indexOf(QLatin1StringView s, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
int toInt(bool *ok=nullptr, int base=10) const
Returns the string converted to an int using base base, which is 10 by default and must be between 2 ...
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
QString & replace(qsizetype i, qsizetype len, QChar after)
QString sliced(qsizetype pos) const &
void truncate(qsizetype pos)
Truncates the string at the given position index.
QString mid(qsizetype position, qsizetype n=-1) const &
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
const_iterator cbegin() const
qsizetype size() const noexcept
Returns the number of characters in this string.
const_iterator cend() const
QString first(qsizetype n) const &
const QChar at(qsizetype i) const
Returns the character at the given index position in the string.
QString & insert(qsizetype i, QChar c)
QString toLower() const &
qsizetype count(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
static QString static QString asprintf(const char *format,...) Q_ATTRIBUTE_FORMAT_PRINTF(1
static constexpr int MaxUtcOffsetSecs
static QTimeZone fromSecondsAheadOfUtc(int offset)
static constexpr int MinUtcOffsetSecs
\inmodule QtCore \reentrant
int hour() const
Returns the hour part (0 to 23) of the time.
int minute() const
Returns the minute part (0 to 59) of the time.
int msecsTo(QTime t) const
Returns the number of milliseconds from this time to t.
int msec() const
Returns the millisecond part (0 to 999) of the time.
int second() const
Returns the second part (0 to 59) of the time.
cache insert(employee->id(), employee)
QSet< QString >::iterator it
struct wl_display * display
Combined button and popup list for selecting options.
constexpr const T & min(const T &a, const T &b)
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION QByteArrayView trimmed(QByteArrayView s) noexcept
static jboolean copy(JNIEnv *, jobject)
static int dayOfWeekDiff(int sought, int held)
static void appendSeparator(QStringList *list, QStringView string, int from, int size, int lastQuote)
static int countRepeat(QStringView str, int index, int maxCount)
static int weekDayWithinMonth(QCalendar calendar, int year, int month, int day, int weekDay)
static QString unquote(QStringView str)
static int yearInCenturyFrom(int y2d, int baseYear)
static int startsWithLocalTimeZone(QStringView name, const QDateTime &when, const QLocale &locale)
static bool preferDayOfWeek(const QList< QDateTimeParser::SectionNode > &nodes)
static int matchesSeparator(QStringView text, QStringView separator)
static qsizetype digitCount(QStringView str)
static int findTextEntry(QStringView text, const ShortVector< QString > &entries, QString *usedText, int *used)
static QTime actualTime(QDateTimeParser::Sections known, int hour, int hour12, int ampm, int minute, int second, int msec)
static QDate actualDate(QDateTimeParser::Sections known, QCalendar calendar, int baseYear, int year, int year2digits, int month, int day, int dayofweek)
QVarLengthArray< T, 13 > ShortVector
#define QDATETIMEEDIT_DATE_MIN
#define QDATETIMEEDIT_DATE_MAX
Q_CORE_EXPORT bool operator==(QDateTimeParser::SectionNode s1, QDateTimeParser::SectionNode s2)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
qsizetype qt_repeatCount(QStringView s)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qBound(const T &min, const T &val, const T &max)
constexpr const T & qMax(const T &a, const T &b)
GLsizei const GLfloat * v
[13]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat s1
GLenum GLenum GLsizei count
GLenum GLuint GLintptr offset
GLint GLsizei GLsizei GLenum format
GLenum GLenum GLenum input
static void add(QPainterPath &path, const QWingedEdge &list, int edge, QPathEdge::Traversal traversal)
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
#define Q_ASSERT_X(cond, x, msg)
QtPrivate::QRegularExpressionMatchIteratorRangeBasedForIterator begin(const QRegularExpressionMatchIterator &iterator)
static constexpr QChar sep
#define qUtf16Printable(string)
QString qTzName(int dstIndex)
static double WeekDay(double t)
static QString quote(const QString &str)
static QString name(Section s)
\inmodule QtCore \reentrant