File indexing completed on 2024-04-14 04:35:55

0001 /*
0002     SPDX-FileCopyrightText: 2020 Volker Krause <vkrause@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef KOPENINGHOURS_OPENINGHOURS_P_H
0008 #define KOPENINGHOURS_OPENINGHOURS_P_H
0009 
0010 #include "openinghours.h"
0011 #include "rule_p.h"
0012 
0013 #ifndef KOPENINGHOURS_VALIDATOR_ONLY
0014 #include <KHolidays/HolidayRegion>
0015 #endif
0016 
0017 #include <QSharedData>
0018 #include <QTimeZone>
0019 
0020 #include <cmath>
0021 #include <memory>
0022 #include <vector>
0023 
0024 namespace KOpeningHours {
0025 class OpeningHoursPrivate : public QSharedData {
0026 public:
0027     void finalizeRecovery();
0028     void autocorrect();
0029     void simplify();
0030     void validate();
0031     void addRule(Rule *parsedRule);
0032     void restartFrom(int pos, Rule::Type nextRuleType);
0033     bool isRecovering() const;
0034 
0035     std::vector<std::unique_ptr<Rule>> m_rules;
0036     OpeningHours::Modes m_modes = OpeningHours::IntervalMode;
0037     OpeningHours::Error m_error = OpeningHours::NoError;
0038 
0039     float m_latitude = NAN;
0040     float m_longitude = NAN;
0041     int m_restartPosition = 0;
0042     Rule::Type m_initialRuleType = Rule::NormalRule;
0043     Rule::Type m_recoveryRuleType = Rule::NormalRule;
0044     bool m_ruleSeparatorRecovery = false;
0045 #ifndef KOPENINGHOURS_VALIDATOR_ONLY
0046     KHolidays::HolidayRegion m_region;
0047 #endif
0048     QTimeZone m_timezone = QTimeZone::systemTimeZone();
0049 };
0050 
0051 }
0052 
0053 #endif