• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KDECore

  • kdecore
  • date
kdatetimeformatter_p.h
Go to the documentation of this file.
1/*
2 Copyright 2010 John Layt <john@layt.net>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19
20#ifndef KDATETIMEFORMATTER_H
21#define KDATETIMEFORMATTER_H
22
23#include "klocale.h"
24#include "kglobal.h"
25
26class QChar;
27class QString;
28class QDate;
29class QTime;
30
31class KDateTime;
32class KCalendarSystem;
33
34class KDateTimeFormatter
35{
36public:
37 explicit KDateTimeFormatter();
38
39 virtual ~KDateTimeFormatter();
40
41 virtual QString formatDate(const QDate &fromDate,
42 const QString &toFormat,
43 const KCalendarSystem *calendar = KGlobal::locale()->calendar(),
44 const KLocale *locale = KGlobal::locale(),
45 KLocale::DigitSet digitSet = KGlobal::locale()->dateTimeDigitSet(),
46 KLocale::DateTimeFormatStandard standard = KLocale::KdeFormat) const;
47
48 virtual QString formatTime(const QTime &fromTime,
49 const QString &toFormat,
50 KLocale::TimeFormatOptions timeOptions = 0,
51 const KCalendarSystem *calendar = KGlobal::locale()->calendar(),
52 const KLocale *locale = KGlobal::locale(),
53 KLocale::DigitSet digitSet = KGlobal::locale()->dateTimeDigitSet(),
54 KLocale::DateTimeFormatStandard standard = KLocale::KdeFormat) const;
55
56 virtual QString formatDateTime(const KDateTime &fromDateTime,
57 const QString &toFormat,
58 KLocale::TimeFormatOptions timeOptions = 0,
59 const KCalendarSystem *calendar = KGlobal::locale()->calendar(),
60 const KLocale *locale = KGlobal::locale(),
61 KLocale::DigitSet digitSet = KGlobal::locale()->dateTimeDigitSet(),
62 KLocale::DateTimeFormatStandard standard = KLocale::KdeFormat) const;
63
64private:
65 virtual QString formatDateTimePosix(const KDateTime &fromDateTime,
66 const QString &toFormat,
67 KLocale::TimeFormatOptions timeOptions,
68 const KCalendarSystem *calendar,
69 const KLocale *locale,
70 KLocale::DigitSet digitSet,
71 KLocale::DateTimeFormatStandard standard) const;
72
73 virtual void initEnglish(const KCalendarSystem *calendar, const KLocale *locale) const;
74
75 virtual QString formatDateTimeUnicode(const KDateTime &fromDateTime,
76 const QString &toFormat,
77 KLocale::TimeFormatOptions timeOptions,
78 const KCalendarSystem *calendar,
79 const KLocale *locale,
80 KLocale::DigitSet digitSet) const;
81
82 virtual QString getUnicodeString(const KDateTime &fromDateTime,
83 const QString &toFormat,
84 KLocale::TimeFormatOptions timeOptions,
85 const KCalendarSystem *calendar,
86 const KLocale *locale,
87 KLocale::DigitSet digitSet) const;
88
89 virtual QString stringFromInteger(int number, int padWidth, QChar padChar, QChar signChar,
90 KLocale::DigitSet digitSet, const KLocale *locale) const;
91
92 // Is private class, but if ever made public need to move these into a d->
93 // Some format modifiers force English names to be returned
94 mutable KLocale *m_englishLocale;
95 mutable KCalendarSystem *m_englishCalendar;
96};
97
98#endif // KDATETIMEFORMATTER_H
KCalendarSystem
KCalendarSystem abstract base class, provides support for local Calendar Systems in KDE.
Definition: kcalendarsystem.h:41
KDateTimeFormatter
Definition: kdatetimeformatter_p.h:35
KDateTimeFormatter::formatDate
virtual QString formatDate(const QDate &fromDate, const QString &toFormat, const KCalendarSystem *calendar=KGlobal::locale() ->calendar(), const KLocale *locale=KGlobal::locale(), KLocale::DigitSet digitSet=KGlobal::locale() ->dateTimeDigitSet(), KLocale::DateTimeFormatStandard standard=KLocale::KdeFormat) const
Definition: kdatetimeformatter.cpp:47
KDateTimeFormatter::~KDateTimeFormatter
virtual ~KDateTimeFormatter()
Definition: kdatetimeformatter.cpp:41
KDateTimeFormatter::KDateTimeFormatter
KDateTimeFormatter()
Definition: kdatetimeformatter.cpp:35
KDateTimeFormatter::formatTime
virtual QString formatTime(const QTime &fromTime, const QString &toFormat, KLocale::TimeFormatOptions timeOptions=0, const KCalendarSystem *calendar=KGlobal::locale() ->calendar(), const KLocale *locale=KGlobal::locale(), KLocale::DigitSet digitSet=KGlobal::locale() ->dateTimeDigitSet(), KLocale::DateTimeFormatStandard standard=KLocale::KdeFormat) const
Definition: kdatetimeformatter.cpp:62
KDateTimeFormatter::formatDateTime
virtual QString formatDateTime(const KDateTime &fromDateTime, const QString &toFormat, KLocale::TimeFormatOptions timeOptions=0, const KCalendarSystem *calendar=KGlobal::locale() ->calendar(), const KLocale *locale=KGlobal::locale(), KLocale::DigitSet digitSet=KGlobal::locale() ->dateTimeDigitSet(), KLocale::DateTimeFormatStandard standard=KLocale::KdeFormat) const
Definition: kdatetimeformatter.cpp:79
KDateTime
A class representing a date and time with an associated time zone.
Definition: kdatetime.h:172
KLocale
KLocale provides support for country specific stuff like the national language.
Definition: klocale.h:70
KLocale::DigitSet
DigitSet
Definition: klocale.h:309
KLocale::DateTimeFormatStandard
DateTimeFormatStandard
Definition: klocale.h:829
KLocale::KdeFormat
@ KdeFormat
KDE Standard.
Definition: klocale.h:830
QString
kglobal.h
klocale.h
KGlobal::locale
KLocale * locale()
Returns the global locale object.
Definition: kglobal.cpp:170
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDECore

Skip menu "KDECore"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal