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 { 00036 int day; 00037 int month; 00038 int year; 00039 bool parsedYear; 00040 QString eraName; 00041 int yearInEra; 00042 int dayInYear; 00043 int isoWeekNumber; 00044 int dayOfIsoWeek; 00045 int inputPosition; 00046 int formatPosition; 00047 bool error; 00048 }; 00049 00050 class KDateTimeParser 00051 { 00052 public: 00053 explicit KDateTimeParser(); 00054 00055 virtual ~KDateTimeParser(); 00056 00057 virtual QDate parseDate( const QString &dateString, 00058 const QString &format, 00059 const KCalendarSystem *calendar = KGlobal::locale()->calendar(), 00060 const KLocale *locale = KGlobal::locale(), 00061 KLocale::DigitSet digitSet = KLocale::ArabicDigits, 00062 KLocale::DateTimeFormatStandard standard = KLocale::KdeFormat ) const; 00063 00064 private: 00065 virtual DateTimeComponents parseDatePosix( const QString &dateString, 00066 const QString &format, 00067 const KCalendarSystem *calendar, 00068 const KLocale *locale, 00069 KLocale::DigitSet digitSet, 00070 KLocale::DateTimeFormatStandard standard ) const; 00071 00072 virtual DateTimeComponents parseDateUnicode( const QString &inputString, 00073 const QString &format, 00074 const KCalendarSystem *calendar, 00075 const KLocale *locale, 00076 KLocale::DigitSet digitSet ) const; 00077 00078 virtual int integerFromString( const QString &string, int maxLength, int &readLength ) const; 00079 }; 00080 00081 #endif // KDATETIMEPARSER_H
KDE 4.6 API Reference