summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qdatetimeparser_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools/qdatetimeparser_p.h')
-rw-r--r--src/corelib/tools/qdatetimeparser_p.h40
1 files changed, 21 insertions, 19 deletions
diff --git a/src/corelib/tools/qdatetimeparser_p.h b/src/corelib/tools/qdatetimeparser_p.h
index 64e73346f2..ad403f695b 100644
--- a/src/corelib/tools/qdatetimeparser_p.h
+++ b/src/corelib/tools/qdatetimeparser_p.h
@@ -103,7 +103,7 @@ public:
none.zeroesAdded = 0;
}
virtual ~QDateTimeParser() {}
- enum {
+ enum AmPmFinder {
Neither = -1,
AM = 0,
PM = 1,
@@ -113,25 +113,26 @@ public:
};
enum Section {
- NoSection = 0x00000,
- AmPmSection = 0x00001,
- MSecSection = 0x00002,
+ 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,
+ DaySection = 0x00100,
+ MonthSection = 0x00200,
+ YearSection = 0x00400,
YearSection2Digits = 0x00800,
DayOfWeekSectionShort = 0x01000,
- DayOfWeekSectionLong = 0x20000,
+ DayOfWeekSectionLong = 0x02000,
DateSectionMask = (DaySection|MonthSection|YearSection|YearSection2Digits|DayOfWeekSectionShort|DayOfWeekSectionLong),
- FirstSection = 0x02000|Internal,
- LastSection = 0x04000|Internal,
- CalendarPopupSection = 0x08000|Internal,
+
+ Internal = 0x10000,
+ FirstSection = 0x20000 | Internal,
+ LastSection = 0x40000 | Internal,
+ CalendarPopupSection = 0x80000 | Internal,
NoSectionIndex = -1,
FirstSectionIndex = -2,
@@ -140,11 +141,16 @@ public:
}; // duplicated from qdatetimeedit.h
Q_DECLARE_FLAGS(Sections, Section)
- struct SectionNode {
+ struct Q_CORE_EXPORT SectionNode {
Section type;
mutable int pos;
int count;
int zeroesAdded;
+
+ static QString name(Section s);
+ QString name() const { return name(type); }
+ QString format() const;
+ int maxChange() const;
};
enum State { // duplicated from QValidator
@@ -201,16 +207,12 @@ public:
int findDay(const QString &str1, int intDaystart, int sectionIndex,
QString *dayName = 0, int *used = 0) const;
#endif
- int findAmPm(QString &str1, int index, int *used = 0) const;
- int maxChange(int s) const;
+ AmPmFinder findAmPm(QString &str, int index, int *used = 0) const;
bool potentialValue(const QString &str, int min, int max, int index,
const QDateTime &currentValue, int insert) const;
bool skipToNextSection(int section, const QDateTime &current, const QString &sectionText) const;
- QString sectionName(int s) const;
- QString stateName(int s) const;
- QString sectionFormat(int index) const;
- QString sectionFormat(Section s, int count) const;
+ QString stateName(State s) const;
enum FieldInfoFlag {
Numeric = 0x01,