Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qdatetimeparser.cpp File Reference
#include "qplatformdefs.h"
#include "private/qdatetimeparser_p.h"
#include "qdatastream.h"
#include "qdatetime.h"
#include "qdebug.h"
#include "qlocale.h"
#include "qset.h"
#include "qtimezone.h"
#include "qvarlengtharray.h"
#include "private/qlocale_p.h"
#include "private/qstringiterator_p.h"
#include "private/qtenvironmentvariables_p.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 weekDayWithinMonth (QCalendar calendar, int year, int month, int day, int weekDay)
 
static QDate actualDate (QDateTimeParser::Sections known, const QCalendar &calendar, 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)
 
static int findTextEntry (const QString &text, const ShortVector< QString > &entries, QString *usedText, int *used)
 
bool operator== (const QDateTimeParser::SectionNode &s1, const QDateTimeParser::SectionNode &s2)
 

Macro Definition Documentation

◆ QDTPDEBUG

#define QDTPDEBUG   if (false) qDebug()

Definition at line 24 of file qdatetimeparser.cpp.

◆ QDTPDEBUGN

#define QDTPDEBUGN   if (false) qDebug

Definition at line 25 of file qdatetimeparser.cpp.

Typedef Documentation

◆ ShortVector

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

Definition at line 33 of file qdatetimeparser.cpp.

Function Documentation

◆ actualDate()

static QDate actualDate ( QDateTimeParser::Sections  known,
const QCalendar calendar,
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 967 of file qdatetimeparser.cpp.

References calendar, QDateTimeParser::DayOfWeekSectionMask, QDateTimeParser::DaySection, QDate::isValid(), QDateTimeParser::MonthSection, Q_ASSERT, weekDayWithinMonth(), QDateTimeParser::YearSection, and QDateTimeParser::YearSection2Digits.

+ Here is the call graph for this function:

◆ actualTime()

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

◆ appendSeparator()

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

Definition at line 408 of file qdatetimeparser.cpp.

References QList< T >::append(), list, Q_ASSERT, QStringView::sliced(), QStringView::toString(), and unquote().

Referenced by QDateTimeParser::parseFormat().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ countRepeat()

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

Definition at line 399 of file qdatetimeparser.cpp.

References QString::first(), qt_repeatCount(), QString::size(), QString::sliced(), and str.

Referenced by QDateTimeParser::parseFormat().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dayOfWeekDiff()

static 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 87 of file qdatetimeparser.cpp.

Referenced by QDateTimeParser::setDigit(), and weekDayWithinMonth().

+ Here is the caller graph for this function:

◆ digitCount()

static qsizetype digitCount ( QStringView  str)
static

Helper function for parseSection.

Definition at line 357 of file qdatetimeparser.cpp.

References digits(), QChar::isDigit(), it, and str.

Referenced by QLocaleData::doubleToString().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findTextEntry()

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

Definition at line 1588 of file qdatetimeparser.cpp.

References QString::at(), QVarLengthArray< T, Prealloc >::at(), i, QString::isEmpty(), qMin(), QString::size(), QVLABaseBase::size(), text, and QChar::toLower().

+ Here is the call graph for this function:

◆ operator==()

bool operator== ( const QDateTimeParser::SectionNode s1,
const QDateTimeParser::SectionNode s2 
)

Definition at line 2237 of file qdatetimeparser.cpp.

References s2.

◆ preferDayOfWeek()

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

Definition at line 93 of file qdatetimeparser.cpp.

References QDateTimeParser::DayOfWeekSectionMask, and QDateTimeParser::DaySection.

Referenced by QDateTimeParser::setDigit().

+ Here is the caller graph for this function:

◆ startsWithLocalTimeZone()

static int startsWithLocalTimeZone ( QStringView  name)
static

Definition at line 1145 of file qdatetimeparser.cpp.

References i, qTzName(), and QString::size().

+ Here is the call graph for this function:

◆ unquote()

static 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 375 of file qdatetimeparser.cpp.

References QString::at(), i, quote(), ret, QString::size(), str, and zero.

Referenced by appendSeparator(), and QDateTimeParser::parseFormat().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ weekDayWithinMonth()

static 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 949 of file qdatetimeparser.cpp.

References calendar, dayOfWeekDiff(), qBound(), and qMax().

Referenced by actualDate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: