KDECore
kdatetimeformatter_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 KDATETIMEFORMATTER_H 00021 #define KDATETIMEFORMATTER_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 class KDateTimeFormatter 00035 { 00036 public: 00037 explicit KDateTimeFormatter(); 00038 00039 virtual ~KDateTimeFormatter(); 00040 00041 virtual QString formatDate( const QDate &fromDate, 00042 const QString &toFormat, 00043 const KCalendarSystem *calendar = KGlobal::locale()->calendar(), 00044 const KLocale *locale = KGlobal::locale(), 00045 KLocale::DigitSet digitSet = KGlobal::locale()->dateTimeDigitSet(), 00046 KLocale::DateTimeFormatStandard standard = KLocale::KdeFormat ) const; 00047 00048 virtual QString formatTime( const QTime &fromTime, 00049 const QString &toFormat, 00050 KLocale::TimeFormatOptions timeOptions = 0, 00051 const KCalendarSystem *calendar = KGlobal::locale()->calendar(), 00052 const KLocale *locale = KGlobal::locale(), 00053 KLocale::DigitSet digitSet = KGlobal::locale()->dateTimeDigitSet(), 00054 KLocale::DateTimeFormatStandard standard = KLocale::KdeFormat ) const; 00055 00056 virtual QString formatDateTime( const KDateTime &fromDateTime, 00057 const QString &toFormat, 00058 KLocale::TimeFormatOptions timeOptions = 0, 00059 const KCalendarSystem *calendar = KGlobal::locale()->calendar(), 00060 const KLocale *locale = KGlobal::locale(), 00061 KLocale::DigitSet digitSet = KGlobal::locale()->dateTimeDigitSet(), 00062 KLocale::DateTimeFormatStandard standard = KLocale::KdeFormat ) const; 00063 00064 private: 00065 virtual QString formatDateTimePosix( const KDateTime &fromDateTime, 00066 const QString &toFormat, 00067 KLocale::TimeFormatOptions timeOptions, 00068 const KCalendarSystem *calendar, 00069 const KLocale *locale, 00070 KLocale::DigitSet digitSet, 00071 KLocale::DateTimeFormatStandard standard ) const; 00072 00073 virtual void initEnglish( const KCalendarSystem *calendar, const KLocale *locale ) const; 00074 00075 virtual QString formatDateTimeUnicode( const KDateTime &fromDateTime, 00076 const QString &toFormat, 00077 KLocale::TimeFormatOptions timeOptions, 00078 const KCalendarSystem *calendar, 00079 const KLocale *locale, 00080 KLocale::DigitSet digitSet ) const; 00081 00082 virtual QString getUnicodeString( const KDateTime &fromDateTime, 00083 const QString &toFormat, 00084 KLocale::TimeFormatOptions timeOptions, 00085 const KCalendarSystem *calendar, 00086 const KLocale *locale, 00087 KLocale::DigitSet digitSet ) const; 00088 00089 virtual QString stringFromInteger( int number, int padWidth, QChar padChar, QChar signChar, 00090 KLocale::DigitSet digitSet, const KLocale *locale ) const; 00091 00092 // Is private class, but if ever made public need to move these into a d-> 00093 // Some format modifiers force English names to be returned 00094 mutable KLocale *m_englishLocale; 00095 mutable KCalendarSystem *m_englishCalendar; 00096 }; 00097 00098 #endif // KDATETIMEFORMATTER_H
KDE 4.6 API Reference