KDECore
kdatetimeparser_p.h
Go to the documentation of this file.
00001 /* 00002 Copyright 2010 John Layt <john@layt.net> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef KDATETIMEPARSER_H 00021 #define KDATETIMEPARSER_H 00022 00023 #include "klocale.h" 00024 #include "kglobal.h" 00025 00026 class QChar; 00027 class QString; 00028 class QDate; 00029 class QTime; 00030 00031 class KDateTime; 00032 class KCalendarSystem; 00033 00034 struct DateTimeComponents { 00035 int day; 00036 int month; 00037 int year; 00038 bool parsedYear; 00039 QString eraName; 00040 int yearInEra; 00041 int dayInYear; 00042 int isoWeekNumber; 00043 int dayOfIsoWeek; 00044 int inputPosition; 00045 int formatPosition; 00046 bool error; 00047 }; 00048 00049 class KDateTimeParser 00050 { 00051 public: 00052 explicit KDateTimeParser(); 00053 00054 virtual ~KDateTimeParser(); 00055 00056 virtual QDate parseDate(const QString &dateString, 00057 const QString &format, 00058 const KCalendarSystem *calendar = KGlobal::locale()->calendar(), 00059 const KLocale *locale = KGlobal::locale(), 00060 KLocale::DigitSet digitSet = KLocale::ArabicDigits, 00061 KLocale::DateTimeFormatStandard standard = KLocale::KdeFormat) const; 00062 00063 private: 00064 virtual DateTimeComponents parseDatePosix(const QString &dateString, 00065 const QString &format, 00066 const KCalendarSystem *calendar, 00067 const KLocale *locale, 00068 KLocale::DigitSet digitSet, 00069 KLocale::DateTimeFormatStandard standard) const; 00070 00071 virtual DateTimeComponents parseDateUnicode(const QString &inputString, 00072 const QString &format, 00073 const KCalendarSystem *calendar, 00074 const KLocale *locale, 00075 KLocale::DigitSet digitSet) const; 00076 00077 virtual int integerFromString(const QString &string, int maxLength, int &readLength) const; 00078 }; 00079 00080 #endif // KDATETIMEPARSER_H
KDE 4.7 API Reference