MOBILISIS-Calculator/library/include/mobilisis/configuration.h
Gerhard Hoffmann 0af858daea Added multimap for Customer.
Using std::optional.

Added member functions:
  QVector<ATBPaymentOption> &getAllPaymentOptions()
  QVector<ATBPaymentOption> const &getAllPaymentOptions() const
  std::optional<QVector<ATBPaymentRate>> getPaymentRateForAllKeys() const
  std::optional<QVector<ATBPaymentRate>> getPaymentRateForKey(int key) const
  std::optional<QVector<ATBDailyTicket>> getDailyTicketsForAllKeys() const
  std::optional<QVector<ATBDailyTicket>> getDailyTicketsForKey(int key) const
  std::optional<ATBCustomer> getCustomerForType(ATBCustomer::CustomerType customerType)
  std::optional<ATBWeekDaysWorktime> getWeekDayWorkTime(QTime const &time, Qt::DayOfWeek dayOfWeek)

Removed: QVector<ATBDailyTicket> const &getDailyTickets() const;
2024-01-30 10:20:42 +01:00

85 lines
2.7 KiB
C++

#pragma once
#include <map>
#include <variant>
#include <cstddef>
#include <stdio.h>
#include <algorithm>
#include <rapidjson/rapidjson.h>
#include <rapidjson/document.h>
#include <rapidjson/error/en.h>
#include "member_type.h"
#include "currency.h"
#include "duration.h"
#include "payment_mtd.h"
#include "payment_opt.h"
#include "spec_days.h"
#include "payment_opt.h"
#include "weekdays.h"
#include "weekdays_worktime.h"
#include "spec_days_worktime.h"
#include "member_type.h"
#include "period_year.h"
#include "payment_rate.h"
#include "atb_project.h"
#include "tariff_daily_ticket.h"
#include "time_range_header.h"
#include "tariff_timestep_config.h"
#include <QVector>
#include <optional>
using namespace std;
using namespace rapidjson;
class Calculator;
class Configuration
{
public:
ATBProject project;
ATBCurrency Currency;
ATBDuration duration;
multimap<int, ATBDuration> Duration;
multimap<int, ATBPaymentMethod> PaymentMethod;
multimap<int, ATBPaymentRate> PaymentRate;
multimap<int, ATBSpecialDaysWorktime> SpecialDaysWorktime;
multimap<int, ATBSpecialDays> SpecialDays;
multimap<int, ATBWeekDays> WeekDays;
multimap<int, ATBPeriodYear> YearPeriod;
multimap<int, ATBWeekDaysWorktime> WeekDaysWorktime;
multimap<int, ATBPaymentOption> PaymentOption;
multimap<int, ATBDailyTicket> DailyTicket;
multimap<int, ATBTimeRange> TimeRange;
multimap<int, ATBTimeStepConfig> TimeStepConfig;
multimap<int, ATBTimeBase> TimeBase;
multimap<int, ATBCustomer> Customer;
/// <summary>
/// Parse JSON string
/// </summary>
/// <param name="json"></param>
/// <returns>Returns operation status bool (OK | FAIL) </returns>
bool ParseJson(Configuration* cfg, const char* json);
ATBPaymentOption &getPaymentOptions();
ATBPaymentOption const &getPaymentOptions() const;
QVector<ATBPaymentOption> &getAllPaymentOptions();
QVector<ATBPaymentOption> const &getAllPaymentOptions() const;
std::optional<QVector<ATBPaymentRate>> getPaymentRateForAllKeys() const;
std::optional<QVector<ATBPaymentRate>> getPaymentRateForKey(int key) const;
std::optional<QVector<ATBDailyTicket>> getDailyTicketsForAllKeys() const;
std::optional<QVector<ATBDailyTicket>> getDailyTicketsForKey(int key) const;
std::optional<ATBCustomer> getCustomerForType(ATBCustomer::CustomerType customerType);
std::optional<ATBWeekDaysWorktime> getWeekDayWorkTime(QTime const &time, Qt::DayOfWeek dayOfWeek);
private:
/// <summary>
/// Identify type of JSON member
/// </summary>
/// <param name="member_name"></param>
/// <returns></returns>
MemberType IdentifyJsonMember(const char* member_name);
QVector<ATBPaymentOption> currentPaymentOptions;
};