• 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
kdatetimeparser_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 KDATETIMEPARSER_H
21 #define KDATETIMEPARSER_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 struct DateTimeComponents {
35  int day;
36  int month;
37  int year;
38  bool parsedYear;
39  QString eraName;
40  int yearInEra;
41  int dayInYear;
42  int isoWeekNumber;
43  int dayOfIsoWeek;
44  int inputPosition;
45  int formatPosition;
46  bool error;
47 };
48 
49 class KDateTimeParser
50 {
51 public:
52  explicit KDateTimeParser();
53 
54  virtual ~KDateTimeParser();
55 
56  virtual QDate parseDate(const QString &dateString,
57  const QString &format,
58  const KCalendarSystem *calendar = KGlobal::locale()->calendar(),
59  const KLocale *locale = KGlobal::locale(),
60  KLocale::DigitSet digitSet = KLocale::ArabicDigits,
61  KLocale::DateTimeFormatStandard standard = KLocale::KdeFormat) const;
62 
63 private:
64  virtual DateTimeComponents parseDatePosix(const QString &dateString,
65  const QString &format,
66  const KCalendarSystem *calendar,
67  const KLocale *locale,
68  KLocale::DigitSet digitSet,
69  KLocale::DateTimeFormatStandard standard) const;
70 
71  virtual DateTimeComponents parseDateUnicode(const QString &inputString,
72  const QString &format,
73  const KCalendarSystem *calendar,
74  const KLocale *locale,
75  KLocale::DigitSet digitSet) const;
76 
77  virtual int integerFromString(const QString &string, int maxLength, int &readLength) const;
78 };
79 
80 #endif // KDATETIMEPARSER_H
DateTimeComponents::formatPosition
int formatPosition
Definition: kdatetimeparser_p.h:45
KDateTimeParser::~KDateTimeParser
virtual ~KDateTimeParser()
Definition: kdatetimeparser.cpp:32
DateTimeComponents::isoWeekNumber
int isoWeekNumber
Definition: kdatetimeparser_p.h:42
DateTimeComponents::year
int year
Definition: kdatetimeparser_p.h:37
QChar
DateTimeComponents::dayOfIsoWeek
int dayOfIsoWeek
Definition: kdatetimeparser_p.h:43
DateTimeComponents::inputPosition
int inputPosition
Definition: kdatetimeparser_p.h:44
klocale.h
QTime
KDateTimeParser
Definition: kdatetimeparser_p.h:49
KCalendarSystem
KCalendarSystem abstract base class, provides support for local Calendar Systems in KDE...
Definition: kcalendarsystem.h:40
DateTimeComponents::error
bool error
Definition: kdatetimeparser_p.h:46
DateTimeComponents::day
int day
Definition: kdatetimeparser_p.h:35
kglobal.h
KDateTimeParser::parseDate
virtual QDate parseDate(const QString &dateString, const QString &format, const KCalendarSystem *calendar=KGlobal::locale() ->calendar(), const KLocale *locale=KGlobal::locale(), KLocale::DigitSet digitSet=KLocale::ArabicDigits, KLocale::DateTimeFormatStandard standard=KLocale::KdeFormat) const
Definition: kdatetimeparser.cpp:37
QDate
QString
KLocale::KdeFormat
KDE Standard.
Definition: klocale.h:830
DateTimeComponents::yearInEra
int yearInEra
Definition: kdatetimeparser_p.h:40
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
DateTimeComponents::parsedYear
bool parsedYear
Definition: kdatetimeparser_p.h:38
KLocale
KLocale provides support for country specific stuff like the national language.
Definition: klocale.h:69
KLocale::DateTimeFormatStandard
DateTimeFormatStandard
Definition: klocale.h:829
DateTimeComponents::dayInYear
int dayInYear
Definition: kdatetimeparser_p.h:41
DateTimeComponents::eraName
QString eraName
Definition: kdatetimeparser_p.h:39
DateTimeComponents
Definition: kdatetimeparser_p.h:34
KLocale::DigitSet
DigitSet
Definition: klocale.h:309
DateTimeComponents::month
int month
Definition: kdatetimeparser_p.h:36
KLocale::ArabicDigits
0123456789 (European and some Asian languages and western Arabic dialects)
Definition: klocale.h:310
KDateTimeParser::KDateTimeParser
KDateTimeParser()
Definition: kdatetimeparser.cpp:28
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