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

KDECore

  • 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
26class QChar;
27class QString;
28class QDate;
29class QTime;
30
31class KDateTime;
32class KCalendarSystem;
33
34struct 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
49class KDateTimeParser
50{
51public:
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
63private:
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
KCalendarSystem
KCalendarSystem abstract base class, provides support for local Calendar Systems in KDE.
Definition: kcalendarsystem.h:41
KDateTimeParser
Definition: kdatetimeparser_p.h:50
KDateTimeParser::~KDateTimeParser
virtual ~KDateTimeParser()
Definition: kdatetimeparser.cpp:32
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
KDateTimeParser::KDateTimeParser
KDateTimeParser()
Definition: kdatetimeparser.cpp:28
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::ArabicDigits
@ ArabicDigits
0123456789 (European and some Asian languages and western Arabic dialects)
Definition: klocale.h:310
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
DateTimeComponents
Definition: kdatetimeparser_p.h:34
DateTimeComponents::month
int month
Definition: kdatetimeparser_p.h:36
DateTimeComponents::parsedYear
bool parsedYear
Definition: kdatetimeparser_p.h:38
DateTimeComponents::formatPosition
int formatPosition
Definition: kdatetimeparser_p.h:45
DateTimeComponents::error
bool error
Definition: kdatetimeparser_p.h:46
DateTimeComponents::day
int day
Definition: kdatetimeparser_p.h:35
DateTimeComponents::eraName
QString eraName
Definition: kdatetimeparser_p.h:39
DateTimeComponents::yearInEra
int yearInEra
Definition: kdatetimeparser_p.h:40
DateTimeComponents::year
int year
Definition: kdatetimeparser_p.h:37
DateTimeComponents::isoWeekNumber
int isoWeekNumber
Definition: kdatetimeparser_p.h:42
DateTimeComponents::dayInYear
int dayInYear
Definition: kdatetimeparser_p.h:41
DateTimeComponents::inputPosition
int inputPosition
Definition: kdatetimeparser_p.h:44
DateTimeComponents::dayOfIsoWeek
int dayOfIsoWeek
Definition: kdatetimeparser_p.h:43
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