File indexing completed on 2024-04-14 14:20:09

0001 /*
0002    This file is part of the KDE libraries
0003    Copyright (c) 2008 Marc Mutz <mutz@kde.org>, Till Adam <adam@kde.org>
0004 
0005    This library is free software; you can redistribute it and/or
0006    modify it under the terms of the GNU Library General Public
0007    License as published by the Free Software Foundation; either
0008    version 2 of the License, or (at your option) any later version.
0009 
0010    This library is distributed in the hope that it will be useful,
0011    but WITHOUT ANY WARRANTY; without even the implied warranty of
0012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013    Library General Public License for more details.
0014 
0015    You should have received a copy of the GNU Library General Public License
0016    along with this library; see the file COPYING.LIB.  If not, write to
0017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0018    Boston, MA 02110-1301, USA.
0019 */
0020 
0021 #ifndef _KTIMEZONE_WINDOWS_H
0022 #define _KTIMEZONE_WINDOWS_H
0023 
0024 #include <kdelibs4support_export.h>
0025 
0026 #include <ktimezone.h>
0027 #include <ksystemtimezone.h>
0028 #include <windows.h>
0029 
0030 class KSystemTimeZoneSourceWindowsPrivate;
0031 
0032 /**
0033  * A class to read and parse the timezone information from the Windows registry.
0034  *
0035  * The registry is queried for the currently active and for all available timezones
0036  * on the system, and those are provided to the KystemTimeZone framework.
0037  *
0038  * @short Reads and parses the Windows registry timezone information
0039  * @see KSystemTimeZoneWindows, KSystemTimeZoneDataWindows
0040  * @ingroup timezones
0041  * @author Marc Mutz <mutz@kde.org>, Till Adam <adam@kde.org>.
0042  */
0043 class KDELIBS4SUPPORT_EXPORT KSystemTimeZoneSourceWindows : public KSystemTimeZoneSource
0044 {
0045 public:
0046     /**
0047       * Constructs a time zone source.
0048       */
0049     KSystemTimeZoneSourceWindows();
0050 
0051     /**
0052      * Retrieves and parses the Windows registry information to extract
0053      * detailed information for one time zone.
0054      *
0055      * @param zone the time zone for which data is to be extracted
0056      * @return a KSystemTimeZoneDataWindows instance containing the parsed data.
0057      *         The caller is responsible for deleting the KTimeZoneData instance.
0058      *         Null is returned on error.
0059      */
0060     KTimeZoneData *parse(const KTimeZone &zone) const;
0061 private:
0062     KSystemTimeZoneSourceWindowsPrivate *const d;
0063 };
0064 
0065 /**
0066  * The KSystemTimeZoneWindows class represents a time zone defined in the Windows registry.
0067  *
0068  * It works in partnership with the KSystemTimeZoneSourceWindows class which reads and parses the
0069  * time zone definitions from the Windows registry.
0070  *
0071  * @short Represents a time zone defined in the Windows registry
0072  * @see KSystemTimeZoneBackendWindows, KSystemTimeZoneSourceWindows, KSystemTimeZoneDataWindows
0073  * @ingroup timezones
0074  * @author Marc Mutz <mutz@kde.org>, Till Adam <adam@kde.org>.
0075  */
0076 class KDELIBS4SUPPORT_EXPORT KSystemTimeZoneWindows : public KTimeZone  //krazy:exclude=dpointer (no d-pointer for KTimeZone derived classes)
0077 {
0078 public:
0079     /**
0080      * Creates a time zone.
0081      *
0082      * @param source      Windows registry reader and parser
0083      * @param name        time zone's unique name, which must be the tzfile path relative
0084      *                    to the location specified for @p source
0085      */
0086     KSystemTimeZoneWindows(KTimeZoneSource *source, const QString &name);
0087 
0088     ~KSystemTimeZoneWindows() {}
0089 
0090     /**
0091      * Static helper method that lists all availalbe timezones on the system
0092      * as per the information in the Windows registry.
0093      */
0094     static QStringList listTimeZones();
0095 private:
0096     // d-pointer is in backend class.
0097     // This is a requirement for classes inherited from KTimeZone.
0098 };
0099 
0100 #endif // _KTIMEZONE_WINDOWS_H
0101