Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/mymoney/mymoneyschedule_p.h
Show All 32 Lines | |||||
33 | // Project Includes | 33 | // Project Includes | ||
34 | 34 | | |||
35 | #include "mymoneyobject_p.h" | 35 | #include "mymoneyobject_p.h" | ||
36 | #include "mymoneytransaction.h" | 36 | #include "mymoneytransaction.h" | ||
37 | #include "mymoneyenums.h" | 37 | #include "mymoneyenums.h" | ||
38 | 38 | | |||
39 | using namespace eMyMoney; | 39 | using namespace eMyMoney; | ||
40 | 40 | | |||
41 | namespace eMyMoney | | |||
42 | { | | |||
43 | namespace Schedule | | |||
44 | { | | |||
45 | enum class Element { Payment, | | |||
46 | Payments | | |||
47 | }; | | |||
48 | | ||||
49 | enum class Attribute { Name = 0, | | |||
50 | Type, | | |||
51 | Occurrence, | | |||
52 | OccurrenceMultiplier, | | |||
53 | PaymentType, | | |||
54 | Fixed, | | |||
55 | AutoEnter, | | |||
56 | LastPayment, | | |||
57 | WeekendOption, | | |||
58 | Date, | | |||
59 | StartDate, | | |||
60 | EndDate, | | |||
61 | LastDayInMonth, | | |||
62 | // insert new entries above this line | | |||
63 | LastAttribute | | |||
64 | }; | | |||
65 | uint qHash(const Attribute key, uint seed) { return ::qHash(static_cast<uint>(key), seed); } | | |||
66 | } | | |||
67 | } | | |||
68 | | ||||
69 | class MyMoneySchedulePrivate : public MyMoneyObjectPrivate | 41 | class MyMoneySchedulePrivate : public MyMoneyObjectPrivate | ||
70 | { | 42 | { | ||
71 | public: | 43 | public: | ||
72 | MyMoneySchedulePrivate() | 44 | MyMoneySchedulePrivate() | ||
73 | : m_occurrence(Schedule::Occurrence::Any) | 45 | : m_occurrence(Schedule::Occurrence::Any) | ||
74 | , m_occurrenceMultiplier(1) | 46 | , m_occurrenceMultiplier(1) | ||
75 | , m_type(Schedule::Type::Any) | 47 | , m_type(Schedule::Type::Any) | ||
76 | , m_paymentType(Schedule::PaymentType::Any) | 48 | , m_paymentType(Schedule::PaymentType::Any) | ||
77 | , m_fixed(false) | 49 | , m_fixed(false) | ||
78 | , m_lastDayInMonth(false) | 50 | , m_lastDayInMonth(false) | ||
79 | , m_autoEnter(false) | 51 | , m_autoEnter(false) | ||
80 | , m_weekendOption(Schedule::WeekendOption::MoveNothing) | 52 | , m_weekendOption(Schedule::WeekendOption::MoveNothing) | ||
81 | {} | 53 | {} | ||
82 | 54 | | |||
83 | static QString getElName(const Schedule::Element el) | | |||
84 | { | | |||
85 | static const QMap<Schedule::Element, QString> elNames { | | |||
86 | {Schedule::Element::Payment, QStringLiteral("PAYMENT")}, | | |||
87 | {Schedule::Element::Payments, QStringLiteral("PAYMENTS")} | | |||
88 | }; | | |||
89 | return elNames[el]; | | |||
90 | } | | |||
91 | | ||||
92 | static QString getAttrName(const Schedule::Attribute attr) | | |||
93 | { | | |||
94 | static const QHash<Schedule::Attribute, QString> attrNames { | | |||
95 | {Schedule::Attribute::Name, QStringLiteral("name")}, | | |||
96 | {Schedule::Attribute::Type, QStringLiteral("type")}, | | |||
97 | {Schedule::Attribute::Occurrence, QStringLiteral("occurence")}, // krazy:exclude=spelling | | |||
98 | {Schedule::Attribute::OccurrenceMultiplier, QStringLiteral("occurenceMultiplier")}, // krazy:exclude=spelling | | |||
99 | {Schedule::Attribute::PaymentType, QStringLiteral("paymentType")}, | | |||
100 | {Schedule::Attribute::Fixed, QStringLiteral("fixed")}, | | |||
101 | {Schedule::Attribute::AutoEnter, QStringLiteral("autoEnter")}, | | |||
102 | {Schedule::Attribute::LastPayment, QStringLiteral("lastPayment")}, | | |||
103 | {Schedule::Attribute::WeekendOption, QStringLiteral("weekendOption")}, | | |||
104 | {Schedule::Attribute::Date, QStringLiteral("date")}, | | |||
105 | {Schedule::Attribute::StartDate, QStringLiteral("startDate")}, | | |||
106 | {Schedule::Attribute::EndDate, QStringLiteral("endDate")}, | | |||
107 | {Schedule::Attribute::LastDayInMonth, QStringLiteral("lastDayInMonth")} | | |||
108 | }; | | |||
109 | return attrNames[attr]; | | |||
110 | } | | |||
111 | | ||||
112 | | ||||
113 | /// Its occurrence | 55 | /// Its occurrence | ||
114 | eMyMoney::Schedule::Occurrence m_occurrence; | 56 | eMyMoney::Schedule::Occurrence m_occurrence; | ||
115 | 57 | | |||
116 | /// Its occurrence multiplier | 58 | /// Its occurrence multiplier | ||
117 | int m_occurrenceMultiplier; | 59 | int m_occurrenceMultiplier; | ||
118 | 60 | | |||
119 | /// Its type | 61 | /// Its type | ||
120 | eMyMoney::Schedule::Type m_type; | 62 | eMyMoney::Schedule::Type m_type; | ||
Show All 36 Lines |