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

KDECore

  • sources
  • kde-4.14
  • kdelibs
  • 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 
26 class QChar;
27 class QString;
28 class QDate;
29 class QTime;
30 
31 class KDateTime;
32 class KCalendarSystem;
33 
34 class KDateTimeFormatter
35 {
36 public:
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 
64 private:
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
KDateTimeFormatter::~KDateTimeFormatter
virtual ~KDateTimeFormatter()
Definition: kdatetimeformatter.cpp:41
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
QChar
klocale.h
QTime
KCalendarSystem
KCalendarSystem abstract base class, provides support for local Calendar Systems in KDE...
Definition: kcalendarsystem.h:40
KDateTimeFormatter
Definition: kdatetimeformatter_p.h:34
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
kglobal.h
QDate
QString
KLocale::KdeFormat
KDE Standard.
Definition: klocale.h:830
KDateTime
A class representing a date and time with an associated time zone.
Definition: kdatetime.h:171
KGlobal::locale
KLocale * locale()
Returns the global locale object.
Definition: kglobal.cpp:170
KLocale
KLocale provides support for country specific stuff like the national language.
Definition: klocale.h:69
KLocale::DateTimeFormatStandard
DateTimeFormatStandard
Definition: klocale.h:829
KDateTimeFormatter::KDateTimeFormatter
KDateTimeFormatter()
Definition: kdatetimeformatter.cpp:35
KLocale::DigitSet
DigitSet
Definition: klocale.h:309
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
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:22:11 by doxygen 1.8.7 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 API Reference

Skip menu "kdelibs 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

Search



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