Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qdatetimeparser.cpp File Reference

(d13e9a1ae53ee53c4929bc88d578a02eec4b2dc4)

#include "private/qdatetimeparser_p.h"
#include "qdatastream.h"
#include "qdatetime.h"
#include "qdebug.h"
#include "qlocale.h"
#include "private/qlocale_p.h"
#include "qset.h"
#include "private/qstringiterator_p.h"
#include "private/qtenvironmentvariables_p.h"
#include "qtimezone.h"
#include "qvarlengtharray.h"
Include dependency graph for qdatetimeparser.cpp:

Go to the source code of this file.

Macros

#define QDTPDEBUG   if (false) qDebug()
#define QDTPDEBUGN   if (false) qDebug

Typedefs

template<typename T>
using ShortVector = QVarLengthArray<T, 13>

Functions

static int dayOfWeekDiff (int sought, int held)
static bool preferDayOfWeek (const QList< QDateTimeParser::SectionNode > &nodes)
static qsizetype digitCount (QStringView str)
static QString unquote (QStringView str)
static int countRepeat (QStringView str, int index, int maxCount)
static void appendSeparator (QStringList *list, QStringView string, int from, int size, int lastQuote)
static int matchesSeparator (QStringView text, QStringView separator)
static int weekDayWithinMonth (QCalendar calendar, int year, int month, int day, int weekDay)
static int yearInCenturyFrom (int y2d, int baseYear)
static QDate actualDate (QDateTimeParser::Sections known, QCalendar calendar, int baseYear, int year, int year2digits, int month, int day, int dayofweek)
static QTime actualTime (QDateTimeParser::Sections known, int hour, int hour12, int ampm, int minute, int second, int msec)
static int startsWithLocalTimeZone (QStringView name, const QDateTime &when, const QLocale &locale)
static int findTextEntry (QStringView text, const ShortVector< QString > &entries, QString *usedText, int *used)
bool operator== (QDateTimeParser::SectionNode s1, QDateTimeParser::SectionNode s2)

Macro Definition Documentation

◆ QDTPDEBUG

#define QDTPDEBUG   if (false) qDebug()

Definition at line 27 of file qdatetimeparser.cpp.

◆ QDTPDEBUGN

#define QDTPDEBUGN   if (false) qDebug

Definition at line 28 of file qdatetimeparser.cpp.

Typedef Documentation

◆ ShortVector

template<typename T>
using ShortVector = QVarLengthArray<T, 13>

Definition at line 40 of file qdatetimeparser.cpp.

Function Documentation

◆ actualDate()

QDate actualDate ( QDateTimeParser::Sections known,
QCalendar calendar,
int baseYear,
int year,
int year2digits,
int month,
int day,
int dayofweek )
static

Returns a date consistent with the given data on parts specified by known, while staying as close to the given data as it can. Returns an invalid date when on valid date is consistent with the data.

Definition at line 1013 of file qdatetimeparser.cpp.

References yearInCenturyFrom().

Here is the call graph for this function:

◆ actualTime()

QTime actualTime ( QDateTimeParser::Sections known,
int hour,
int hour12,
int ampm,
int minute,
int second,
int msec )
static

Definition at line 1160 of file qdatetimeparser.cpp.

◆ appendSeparator()

void appendSeparator ( QStringList * list,
QStringView string,
int from,
int size,
int lastQuote )
inlinestatic

Definition at line 418 of file qdatetimeparser.cpp.

◆ countRepeat()

int countRepeat ( QStringView str,
int index,
int maxCount )
inlinestatic

Definition at line 409 of file qdatetimeparser.cpp.

◆ dayOfWeekDiff()

int dayOfWeekDiff ( int sought,
int held )
static

Difference between two days of the week.

Returns a difference in the range from -3 through +3, so that steps by small numbers of days move us through the month in the same direction as through the week.

Definition at line 94 of file qdatetimeparser.cpp.

◆ digitCount()

qsizetype digitCount ( QStringView str)
static

Helper function for parseSection.

Definition at line 367 of file qdatetimeparser.cpp.

◆ findTextEntry()

int findTextEntry ( QStringView text,
const ShortVector< QString > & entries,
QString * usedText,
int * used )
static

Definition at line 1696 of file qdatetimeparser.cpp.

◆ matchesSeparator()

int matchesSeparator ( QStringView text,
QStringView separator )
static

Definition at line 738 of file qdatetimeparser.cpp.

◆ operator==()

Definition at line 2386 of file qdatetimeparser.cpp.

◆ preferDayOfWeek()

bool preferDayOfWeek ( const QList< QDateTimeParser::SectionNode > & nodes)
static

Definition at line 100 of file qdatetimeparser.cpp.

◆ startsWithLocalTimeZone()

int startsWithLocalTimeZone ( QStringView name,
const QDateTime & when,
const QLocale & locale )
static

Definition at line 1194 of file qdatetimeparser.cpp.

◆ unquote()

QString unquote ( QStringView str)
static

helper function for parseFormat. removes quotes that are not escaped and removes the escaping on those that are escaped

Definition at line 385 of file qdatetimeparser.cpp.

◆ weekDayWithinMonth()

int weekDayWithinMonth ( QCalendar calendar,
int year,
int month,
int day,
int weekDay )
static

Returns the day-number of a day, as close as possible to the given day, in the specified month of year for the given calendar, that falls on the day of the week indicated by weekDay.

Definition at line 984 of file qdatetimeparser.cpp.

◆ yearInCenturyFrom()

int yearInCenturyFrom ( int y2d,
int baseYear )
static

Returns whichever of baseYear through baseYear + 99 has its % 100 == y2d.

Definition at line 998 of file qdatetimeparser.cpp.

Referenced by actualDate().

Here is the caller graph for this function: