Qt 4.8
|
#include <qdatetime_p.h>
Classes | |
struct | SectionNode |
struct | StateNode |
Public Types | |
enum | { Neither = -1, AM = 0, PM = 1, PossibleAM = 2, PossiblePM = 3, PossibleBoth = 4 } |
enum | AmPm { AmText, PmText } |
enum | Case { UpperCase, LowerCase } |
enum | Context { FromString, DateTimeEdit } |
enum | FieldInfoFlag { Numeric = 0x01, FixedWidth = 0x02, AllowPartial = 0x04, Fraction = 0x08 } |
enum | Section { NoSection = 0x00000, AmPmSection = 0x00001, MSecSection = 0x00002, SecondSection = 0x00004, MinuteSection = 0x00008, Hour12Section = 0x00010, Hour24Section = 0x00020, TimeSectionMask = (AmPmSection|MSecSection|SecondSection|MinuteSection|Hour12Section|Hour24Section), Internal = 0x10000, DaySection = 0x00100, MonthSection = 0x00200, YearSection = 0x00400, YearSection2Digits = 0x00800, DayOfWeekSection = 0x01000, DateSectionMask = (DaySection|MonthSection|YearSection|YearSection2Digits|DayOfWeekSection), FirstSection = 0x02000|Internal, LastSection = 0x04000|Internal, CalendarPopupSection = 0x08000|Internal, NoSectionIndex = -1, FirstSectionIndex = -2, LastSectionIndex = -3, CalendarPopupIndex = -4 } |
enum | State { Invalid, Intermediate, Acceptable } |
Public Functions | |
int | absoluteMax (int index, const QDateTime &value=QDateTime()) const |
\ More... | |
int | absoluteMin (int index) const |
virtual int | cursorPosition () const |
virtual QString | displayText () const |
FieldInfo | fieldInfo (int index) const |
int | findAmPm (QString &str1, int index, int *used=0) const |
int | findDay (const QString &str1, int intDaystart, int sectionIndex, QString *dayName=0, int *used=0) const |
int | findMonth (const QString &str1, int monthstart, int sectionIndex, QString *monthName=0, int *used=0) const |
bool | fromString (const QString &text, QDate *date, QTime *time) const |
virtual QString | getAmPmText (AmPm ap, Case cs) const |
int | getDigit (const QDateTime &dt, int index) const |
Gets the digit from a datetime. More... | |
virtual QDateTime | getMaximum () const |
virtual QDateTime | getMinimum () const |
virtual QLocale | locale () const |
int | maxChange (int s) const |
Max number of units that can be changed by this section. More... | |
StateNode | parse (QString &input, int &cursorPosition, const QDateTime ¤tValue, bool fixup) const |
bool | parseFormat (const QString &format) |
int | parseSection (const QDateTime ¤tValue, int sectionIndex, QString &txt, int &cursorPosition, int index, QDateTimeParser::State &state, int *used=0) const |
bool | potentialValue (const QString &str, int min, int max, int index, const QDateTime ¤tValue, int insert) const |
QDateTimeParser (QVariant::Type t, Context ctx) | |
QString | sectionFormat (int index) const |
QString | sectionFormat (Section s, int count) const |
int | sectionMaxSize (int index) const |
int | sectionMaxSize (Section s, int count) const |
QString | sectionName (int s) const |
For debugging. More... | |
const SectionNode & | sectionNode (int index) const |
Returns the sectionNode for the Section s. More... | |
int | sectionPos (int index) const |
Returns the starting position for section s. More... | |
int | sectionPos (const SectionNode &sn) const |
int | sectionSize (int index) const |
Returns the size of section s. More... | |
QString | sectionText (int sectionIndex) const |
QString | sectionText (const QString &text, int sectionIndex, int index) const |
Returns the text of section s. More... | |
Section | sectionType (int index) const |
bool | setDigit (QDateTime &t, int index, int newval) const |
Sets a digit in a datetime. More... | |
bool | skipToNextSection (int section, const QDateTime ¤t, const QString §ionText) const |
QString | stateName (int s) const |
For debugging. More... | |
virtual | ~QDateTimeParser () |
Public Variables | |
int | cachedDay |
Context | context |
int | currentSectionIndex |
QLocale | defaultLocale |
Sections | display |
QString | displayFormat |
SectionNode | first |
bool | fixday |
SectionNode | last |
SectionNode | none |
QVariant::Type | parserType |
SectionNode | popup |
QVector< SectionNode > | sectionNodes |
QStringList | separators |
Qt::TimeSpec | spec |
QString | text |
Definition at line 112 of file qdatetime_p.h.
anonymous enum |
Enumerator | |
---|---|
Neither | |
AM | |
PM | |
PossibleAM | |
PossiblePM | |
PossibleBoth |
Definition at line 135 of file qdatetime_p.h.
Enumerator | |
---|---|
AmText | |
PmText |
Definition at line 191 of file qdatetime_p.h.
Enumerator | |
---|---|
UpperCase | |
LowerCase |
Definition at line 196 of file qdatetime_p.h.
Enumerator | |
---|---|
FromString | |
DateTimeEdit |
Definition at line 115 of file qdatetime_p.h.
Enumerator | |
---|---|
Numeric | |
FixedWidth | |
AllowPartial | |
Fraction |
Definition at line 242 of file qdatetime_p.h.
Definition at line 144 of file qdatetime_p.h.
Enumerator | |
---|---|
Invalid | |
Intermediate | |
Acceptable |
Definition at line 177 of file qdatetime_p.h.
|
inline |
Definition at line 119 of file qdatetime_p.h.
|
inlinevirtual |
Definition at line 134 of file qdatetime_p.h.
\
Returns the absolute maximum for a section
Definition at line 4590 of file qdatetime.cpp.
Referenced by QDateTimeEditPrivate::stepBy().
int QDateTimeParser::absoluteMin | ( | int | s | ) | const |
Returns the absolute minimum for a section
Definition at line 4623 of file qdatetime.cpp.
Referenced by QDateTimeEditPrivate::stepBy().
|
inlinevirtual |
Reimplemented in QDateTimeEditPrivate.
Definition at line 254 of file qdatetime_p.h.
|
inlinevirtual |
QDateTimeParser::FieldInfo QDateTimeParser::fieldInfo | ( | int | index | ) | const |
Definition at line 5868 of file qdatetime.cpp.
Referenced by QDateTimeEditPrivate::interpret(), and QDateTimeEditPrivate::isSeparatorKey().
int QDateTimeParser::findAmPm | ( | QString & | str, |
int | index, | ||
int * | used = 0 |
||
) | const |
returns 0 if str == QDateTimeEdit::tr("AM") 1 if str == QDateTimeEdit::tr("PM") 2 if str can become QDateTimeEdit::tr("AM") 3 if str can become QDateTimeEdit::tr("PM") 4 if str can become QDateTimeEdit::tr("PM") and can become QDateTimeEdit::tr("AM") -1 can't become anything sensible
Definition at line 5759 of file qdatetime.cpp.
int QDateTimeParser::findDay | ( | const QString & | str1, |
int | intDaystart, | ||
int | sectionIndex, | ||
QString * | dayName = 0 , |
||
int * | used = 0 |
||
) | const |
Definition at line 5688 of file qdatetime.cpp.
int QDateTimeParser::findMonth | ( | const QString & | str1, |
int | startMonth, | ||
int | sectionIndex, | ||
QString * | usedMonth = 0 , |
||
int * | used = 0 |
||
) | const |
Definition at line 5625 of file qdatetime.cpp.
Definition at line 6084 of file qdatetime.cpp.
Referenced by QDate::fromString(), QTime::fromString(), QDateTime::fromString(), QLocale::toDate(), QLocale::toDateTime(), and QLocale::toTime().
Reimplemented in QDateTimeEditPrivate.
Definition at line 6122 of file qdatetime.cpp.
int QDateTimeParser::getDigit | ( | const QDateTime & | t, |
int | index | ||
) | const |
Gets the digit from a datetime.
QDateTime var(QDate(2004, 02, 02)); int digit = getDigit(var, Year); digit = 2004
Definition at line 4469 of file qdatetime.cpp.
Referenced by QDateTimeEditPrivate::stepBy().
|
virtual |
|
virtual |
|
inlinevirtual |
int QDateTimeParser::maxChange | ( | int | index | ) | const |
Max number of units that can be changed by this section.
Definition at line 5844 of file qdatetime.cpp.
Referenced by parse().
QDateTimeParser::StateNode QDateTimeParser::parse | ( | QString & | input, |
int & | cursorPosition, | ||
const QDateTime & | currentValue, | ||
bool | fixup | ||
) | const |
Definition at line 5271 of file qdatetime.cpp.
Referenced by QDateTimeEditPrivate::validateAndInterpret().
bool QDateTimeParser::parseFormat | ( | const QString & | format | ) |
Definition at line 4769 of file qdatetime.cpp.
Referenced by QDate::fromString(), QTime::fromString(), QDateTime::fromString(), QLocale::toDate(), QLocale::toDateTime(), and QLocale::toTime().
int QDateTimeParser::parseSection | ( | const QDateTime & | currentValue, |
int | sectionIndex, | ||
QString & | txt, | ||
int & | cursorPosition, | ||
int | index, | ||
QDateTimeParser::State & | state, | ||
int * | used = 0 |
||
) | const |
Parses the part of text that corresponds to s and returns the value of that field. Sets *stateptr to the right state if stateptr != 0.
Definition at line 5088 of file qdatetime.cpp.
bool QDateTimeParser::potentialValue | ( | const QString & | str, |
int | min, | ||
int | max, | ||
int | index, | ||
const QDateTime & | currentValue, | ||
int | insert | ||
) | const |
Definition at line 5964 of file qdatetime.cpp.
QString QDateTimeParser::sectionFormat | ( | int | index | ) | const |
Definition at line 5923 of file qdatetime.cpp.
Definition at line 5929 of file qdatetime.cpp.
int QDateTimeParser::sectionMaxSize | ( | int | index | ) | const |
Definition at line 5033 of file qdatetime.cpp.
int QDateTimeParser::sectionMaxSize | ( | Section | s, |
int | count | ||
) | const |
Definition at line 4961 of file qdatetime.cpp.
QString QDateTimeParser::sectionName | ( | int | s | ) | const |
For debugging.
Definition at line 6044 of file qdatetime.cpp.
Referenced by QDateTimeEditPrivate::_q_editorCursorPositionChanged().
const QDateTimeParser::SectionNode & QDateTimeParser::sectionNode | ( | int | sectionIndex | ) | const |
Returns the sectionNode for the Section s.
Definition at line 4654 of file qdatetime.cpp.
Referenced by QDateTimeEditPrivate::setSelected(), and QDateTimeEditPrivate::stepBy().
int QDateTimeParser::sectionPos | ( | int | sectionIndex | ) | const |
Returns the starting position for section s.
Definition at line 4689 of file qdatetime.cpp.
Referenced by QDateTimeEditPrivate::_q_editorCursorPositionChanged(), QDateTimeEditPrivate::clearSection(), QDateTimeEditPrivate::closestSection(), QDateTimeEditPrivate::sectionAt(), QDateTimeEditPrivate::setSelected(), and QDateTimeEditPrivate::updateEdit().
int QDateTimeParser::sectionPos | ( | const SectionNode & | sn | ) | const |
Definition at line 4694 of file qdatetime.cpp.
int QDateTimeParser::sectionSize | ( | int | sectionIndex | ) | const |
Returns the size of section s.
Definition at line 4943 of file qdatetime.cpp.
Referenced by QDateTimeEditPrivate::_q_editorCursorPositionChanged(), QDateTimeEditPrivate::clearSection(), QDateTimeEditPrivate::closestSection(), QDateTimeEditPrivate::sectionAt(), and QDateTimeEditPrivate::setSelected().
QString QDateTimeParser::sectionText | ( | int | sectionIndex | ) | const |
Definition at line 5064 of file qdatetime.cpp.
Returns the text of section s.
This function operates on the arg text rather than edit->text().
Definition at line 5050 of file qdatetime.cpp.
QDateTimeParser::Section QDateTimeParser::sectionType | ( | int | index | ) | const |
Definition at line 4674 of file qdatetime.cpp.
Referenced by QDateTimeEditPrivate::_q_editorCursorPositionChanged().
bool QDateTimeParser::setDigit | ( | QDateTime & | v, |
int | index, | ||
int | newVal | ||
) | const |
Sets a digit in a datetime.
QDateTime var(QDate(2004, 02, 02)); int digit = getDigit(var, Year); digit = 2004 setDigit(&var, Year, 2005); digit = getDigit(var, Year); digit = 2005
Definition at line 4520 of file qdatetime.cpp.
Referenced by QDateTimeEditPrivate::stepBy().
bool QDateTimeParser::skipToNextSection | ( | int | section, |
const QDateTime & | current, | ||
const QString & | sectionText | ||
) | const |
Definition at line 6001 of file qdatetime.cpp.
QString QDateTimeParser::stateName | ( | int | s | ) | const |
For debugging.
Definition at line 6073 of file qdatetime.cpp.
|
mutable |
Definition at line 261 of file qdatetime_p.h.
Referenced by QDateTimeEditPrivate::clearCache(), QDateTimeEditPrivate::QDateTimeEditPrivate(), and QDateTimeEditPrivate::stepBy().
Context QDateTimeParser::context |
Definition at line 273 of file qdatetime_p.h.
|
mutable |
Definition at line 259 of file qdatetime_p.h.
Referenced by QDateTimeEditPrivate::_q_editorCursorPositionChanged(), QDateTimeEditPrivate::interpret(), QDateTimeEditPrivate::isSeparatorKey(), QDateTimeEditPrivate::QDateTimeEditPrivate(), and QDateTimeEditPrivate::updateEdit().
QLocale QDateTimeParser::defaultLocale |
Definition at line 267 of file qdatetime_p.h.
Referenced by QLocale::toDate(), QLocale::toDateTime(), and QLocale::toTime().
Sections QDateTimeParser::display |
Definition at line 260 of file qdatetime_p.h.
QString QDateTimeParser::displayFormat |
Definition at line 266 of file qdatetime_p.h.
SectionNode QDateTimeParser::first |
Definition at line 264 of file qdatetime_p.h.
Referenced by QDateTimeEditPrivate::QDateTimeEditPrivate().
bool QDateTimeParser::fixday |
Definition at line 270 of file qdatetime_p.h.
Referenced by QDateTimeEditPrivate::QDateTimeEditPrivate().
SectionNode QDateTimeParser::last |
Definition at line 264 of file qdatetime_p.h.
Referenced by QDateTimeEditPrivate::QDateTimeEditPrivate().
SectionNode QDateTimeParser::none |
Definition at line 264 of file qdatetime_p.h.
Referenced by QDateTimeEditPrivate::QDateTimeEditPrivate().
QVariant::Type QDateTimeParser::parserType |
Definition at line 268 of file qdatetime_p.h.
SectionNode QDateTimeParser::popup |
Definition at line 264 of file qdatetime_p.h.
QVector<SectionNode> QDateTimeParser::sectionNodes |
Definition at line 263 of file qdatetime_p.h.
Referenced by QDateTimeEditPrivate::_q_editorCursorPositionChanged(), QDateTimeEditPrivate::absoluteIndex(), QDateTimeEditPrivate::closestSection(), QDateTimeEditPrivate::init(), QDateTimeEditPrivate::isSeparatorKey(), QDateTimeEditPrivate::nextPrevSection(), QDateTimeEditPrivate::sectionAt(), and QDateTimeEditPrivate::validateAndInterpret().
QStringList QDateTimeParser::separators |
Definition at line 265 of file qdatetime_p.h.
Referenced by QDateTimeEditPrivate::closestSection(), QDateTimeEditPrivate::isSeparatorKey(), and QDateTimeEditPrivate::sectionAt().
Qt::TimeSpec QDateTimeParser::spec |
Definition at line 272 of file qdatetime_p.h.
Referenced by QDateTimeEditPrivate::getZeroVariant(), QDateTimeEditPrivate::stepBy(), QDateTimeEditPrivate::updateTimeSpec(), and QDateTimeEditPrivate::valueFromText().
|
mutable |
Definition at line 262 of file qdatetime_p.h.