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
QtTemporalPattern Namespace Reference

Supporting types and functions for temporal patterns. More...

Namespaces

namespace  FieldGroup
 Masks identifying mutually-exclusive families of options.

Classes

class  TemporalField
 Describes one field in a temporal pattern. More...
struct  ParseResult

Enumerations

enum class  TemporalFieldCategory : quint8 {
  Literal = 0 , TimeZone = 4 , Second = 20 , SecondFraction = 21 ,
  Minute = 24 , PeriodInDay = 30 , HourMod12 = 31 , Hour = 32 ,
  DayOfWeek = 64 , DayOfMonth = 65 , Month = 80 , YearWithinCentury = 92 ,
  Year = 93
}
enum class  TemporalFieldFlag : quint32 {
  Numeric = 1 , Verbal = 2 , Standalone = 4 , Narrow = 0x10 ,
  Abbreviated = 0x20 , Short = 0x40 , Wide = 0x80 , ZeroPad = 0x0100 ,
  SpacePad = 0x0200 , FlexSpace = 0x0400 , LowerCase = 0x1000 , UpperCase = 0x2000 ,
  IgnoreCase = 0x4000 , YearSignIso8601 = 0x8000 , LocalizedZone = 0x01'0000 , Iso8601 = 0x02'0000 ,
  AcceptUtcPrefix = 0x04'0000 , NeedNoUtcPrefix = 0x08'0000 , AllowZSuffix = 0x10'0000 , GenericTime = 0x20'0000 ,
  StandardTime = 0x40'0000 , DaylightSavingTime = 0x80'0000 , LocalTimeName = 0x8000'0000
}
enum class  DateTimePart { None , Date = 1 , Time = 2 , Zone = 4 }
enum class  SupportType { Partial = -1 , None = 0 , Clear = 1 , HasStrays }

Functions

SupportType supports (DateTimeParts wanted, QSpan< const TemporalField > range, bool hasBaseYear) noexcept
constexpr bool matchesFlagWithin (QtTemporalPattern::TemporalFieldFlags flags, QtTemporalPattern::TemporalFieldFlag sought, QtTemporalPattern::TemporalFieldFlags group)
 Tests flags for a sought flag within a group.
constexpr bool matchesFlagsWithin (QtTemporalPattern::TemporalFieldFlags flags, QtTemporalPattern::TemporalFieldFlags sought, QtTemporalPattern::TemporalFieldFlags group)
 Similar to \l matchesFlagWithin(), but if any of those sought is found in flags, or if none of group are, it's counted as a match.
DateTimePart classify (TemporalFieldCategory category) noexcept
 Classify a field category according to the part of a datetime it contributes to.
DateTimeParts hasFieldsFor (QSpan< const TemporalField > range)
 Identify the parts to which the given fields contribute data.

Detailed Description

Supporting types and functions for temporal patterns.

Since
6.12

Temporal patterns describe how a date, time or datetime may be serialized as text or parsed from text. This namespace provides the common tools used by the classes describing such patterns: \l QDateTimePattern, \l QTimePattern and \l QDatePattern.

Enumeration Type Documentation

◆ DateTimePart

Enumerator
None 
Date 
Time 
Zone 

Definition at line 120 of file qttemporalpattern_p.h.

◆ SupportType

enum class QtTemporalPattern::SupportType
strong
Enumerator
Partial 
None 
Clear 
HasStrays 

Definition at line 165 of file qttemporalpattern_p.h.

◆ TemporalFieldCategory

Enumerator
Literal 
TimeZone 
Second 
SecondFraction 
Minute 
PeriodInDay 
HourMod12 
Hour 
DayOfWeek 
DayOfMonth 
Month 
YearWithinCentury 
Year 

Definition at line 37 of file qttemporalpattern_p.h.

◆ TemporalFieldFlag

Enumerator
Numeric 
Verbal 
Standalone 
Narrow 
Abbreviated 
Short 
Wide 
ZeroPad 
SpacePad 
FlexSpace 
LowerCase 
UpperCase 
IgnoreCase 
YearSignIso8601 
LocalizedZone 
Iso8601 
AcceptUtcPrefix 
NeedNoUtcPrefix 
AllowZSuffix 
GenericTime 
StandardTime 
DaylightSavingTime 
LocalTimeName 

Definition at line 61 of file qttemporalpattern_p.h.

Function Documentation

◆ classify()

DateTimePart QtTemporalPattern::classify ( QtTemporalPattern::TemporalFieldCategory category)
inlinenoexcept

Classify a field category according to the part of a datetime it contributes to.

This maps a \l {QtTemporalPattern::}{TemporalFieldCategory} to the \l {QtTemporalPattern::}{DateTimePart} for which it supplies data.

Definition at line 129 of file qttemporalpattern_p.h.

◆ hasFieldsFor()

DateTimeParts QtTemporalPattern::hasFieldsFor ( QSpan< const TemporalField > range)
inline

Identify the parts to which the given fields contribute data.

Takes a range of TemporalField instances and returns a \l {QtTemporalPattern::}{DateTimeParts} indicating which parts \l classify() says any of the fields contribute to. Note that this only tessts for contribution to a part, not for full coverage of the part. See \l supports() for that.

See also
classify(), supports()

Definition at line 157 of file qttemporalpattern_p.h.

◆ matchesFlagsWithin()

bool QtTemporalPattern::matchesFlagsWithin ( QtTemporalPattern::TemporalFieldFlags flags,
QtTemporalPattern::TemporalFieldFlags sought,
QtTemporalPattern::TemporalFieldFlags group )
inlineconstexpr

Similar to \l matchesFlagWithin(), but if any of those sought is found in flags, or if none of group are, it's counted as a match.

In some contexts, some flags are treated as equivalent, so to check for what they represent pass the equivalent flags |-joined as sought.

Definition at line 111 of file qttemporalpattern_p.h.

◆ matchesFlagWithin()

bool QtTemporalPattern::matchesFlagWithin ( QtTemporalPattern::TemporalFieldFlags flags,
QtTemporalPattern::TemporalFieldFlag sought,
QtTemporalPattern::TemporalFieldFlags group )
inlineconstexpr

Tests flags for a sought flag within a group.

Implements the per-flag check for a single TemporalFieldFlag with respect to its FieldGroup entry. If no flag in a group is given in flags, then all flags in the group are allowed; otherwise, only the given flags in the group match.

Definition at line 102 of file qttemporalpattern_p.h.

◆ supports()

Q_CORE_EXPORT SupportType QtTemporalPattern::supports ( DateTimeParts wanted,
QSpan< const TemporalField > range,
bool hasBaseYear )
noexcept

Definition at line 657 of file qttemporalpattern.cpp.