9 #include "../../objects/calendarevent/CalendarEvent.h"
10 #include "../../common/colour.h"
12 #ifndef __LIBRARIES_CALENDARDATASTORAGE_H__
13 #define __LIBRARIES_CALENDARDATASTORAGE_H__
15 /*enum CDSAddEntryResult{
16 CDSADDENTRY_UNITTESTFAIL = -1,
20 enum CDSAccountResult{
21 CDSACCOUNT_UNITTESTFAIL = -1,
28 enum CDSCalendarResult{
29 CDSCALENDAR_UNITTESTFAIL = -1,
33 CDSCALENDAR_NOCALENDAR
37 CDSENTRY_UNITTESTFAIL = -1,
45 CDSENTRY_CANNOTOPENFILE,
49 struct CDSGetAccountInfo{
51 std::string accountName = "";
52 CDSAccountResult accountInfoResult = CDSACCOUNT_NOACTION;
55 struct CDSGetCalendarInfo{
58 std::string accountName = "";
59 std::string calendarName = "";
60 std::string calendarTextID = "";
61 Colour calendarColour;
62 CDSAccountResult accountInfoResult = CDSACCOUNT_NOACTION;
63 CDSCalendarResult calendarInfoResult = CDSCALENDAR_NOACTION;
66 struct CDSAddEntryResult{
67 int calendarEntryID = 0;
68 CDSEntryResult addEventResult = CDSENTRY_NOACTION;
71 struct CDSGetCalendarEntryInfo{
74 int calendarEntryID = 0;
75 std::string entryName = "";
76 std::string entryDescription = "";
77 int entryStartYear = 0;
78 int entryStartMonth = 0;
79 int entryStartDay = 0;
80 int entryStartHour = 0;
81 int entryStartMinute = 0;
82 int entryStartSecond = 0;
84 int entryEndMonth = 0;
87 int entryEndMinute = 0;
88 int entryEndSecond = 0;
89 int entryDurationWeeks = 0;
90 int entryDurationDays = 0;
91 int entryDurationHours = 0;
92 int entryDurationMinutes = 0;
93 int entryDurationSeconds = 0;
94 CDSEntryResult getEventResult = CDSENTRY_NOACTION;
98 std::vector <int> entryList;
99 CDSEntryResult getEventListResult = CDSENTRY_NOACTION;
102 struct CDSCalendarList{
103 std::vector <int> calendarList;
104 std::vector <std::string> calendarListTextID;
105 CDSCalendarResult getCalendarListResult = CDSCALENDAR_NOACTION;
108 struct CDSAccountList{
109 std::vector<CDSGetAccountInfo> accountList;
110 CDSAccountResult getAccountListResult = CDSACCOUNT_NOACTION;
113 class CalendarDataStorage{
116 sqlite3 *db = nullptr;
118 bool DataStorageInitOK = false;
120 CalendarDataStorage();
121 ~CalendarDataStorage();
124 // Account functions.
126 CDSAccountResult AddAccount(std::string accountName);
127 CDSGetAccountInfo GetAccount(std::string accountName);
128 CDSAccountResult UpdateAccount(int accountID, std::string accountName);
129 CDSAccountResult DeleteAccount(int accountID);
130 CDSAccountList GetAccountList();
132 // Calendar functions.
134 CDSCalendarResult AddCalendar(int accountID, std::string calendarName, std::string calendarID, Colour calendarColour);
135 CDSGetCalendarInfo GetCalendar(std::string accountName, std::string calendarTextID);
136 CDSCalendarList GetCalendarList(int accountID);
137 CDSCalendarResult UpdateCalendar(int calendarID, std::string calendarName);
138 CDSCalendarResult DeleteCalendar(int calendarID);
142 CDSAddEntryResult AddEvent(int calendarID, std::string filename);
143 CDSGetCalendarEntryInfo GetEvent(int calendarEntryID);
144 CDSEntryList GetEventList(int calendarID);
145 CDSEntryResult DeleteEvent(int calendarEntryID);