Timer Console
Loading...
Searching...
No Matches
alarm.h
Go to the documentation of this file.
1/*
2MIT License
3
4Copyright (c) 2025 Ryan Large
5
6Permission is hereby granted, free of charge, to any person obtaining a copy
7of this software and associated documentation files (the "Software"), to deal
8in the Software without restriction, including without limitation the rights
9to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10copies of the Software, and to permit persons to whom the Software is
11furnished to do so, subject to the following conditions:
12
13The above copyright notice and this permission notice shall be included in all
14copies or substantial portions of the Software.
15
16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22SOFTWARE.
23*/
24
25#ifndef ALARM
26#define ALARM
27
28#include <vector>
29#include <string>
30#include <map>
31#include "./alarmData.h"
32
36class Alarm {
37 public:
38 Alarm();
39
40 protected:
41 private:
46 enum DaysOfWeek = {
47 MONDAY = 1,
48 TUESDAY = 2,
49 WEDNESDAY = 3,
50 THURSDAY = 4,
51 FRIDAY = 5,
52 SATURDAY = 6,
53 SUNDAY = 7
54 };
55
56 std::map < int code,
57 std::string day > daysOfTheWeek = {
58 1: "Mo",
59 2: "Tu",
60 3: "We",
61 4: "Th",
62 5: "Fr",
63 6: "Sa",
64 7: "Su"
65 };
66
70 std::vector < AlarmData > alarms;
71
72 void loadAlarms();
73
77 void printOptions();
78
83 void handleOption(const int& answer);
84
85
89 void handleAddAlarm();
90 void handleRemoveAlarm();
95 void handleQuit();
96
100
106
112 bool includes(const int& dayCode, const std::vector < int>& daysSelected);
113
119 void setAlarmMeridiem(AlarmData& alarmToUpdate);
120 void setAlarmTime(AlarmData& alarmToUpdate);
121 void setAlarmDays(AlarmData& alarmToUpdate);
122
123}
124
125#endif
AlarmData class handles the implementation of the actual alarm that is stored or in memory to be mani...
Definition alarmData.h:35
void handleToggleOnOffAlarm()
Definition alarm.cpp:290
void handleAddAlarm()
All alarm member methods branched from.
Definition alarm.cpp:275
void printOptions()
Print and prompt user for input to be handled.
Definition alarm.cpp:59
void setAlarmDays(AlarmData &alarmToUpdate)
Definition alarm.cpp:197
void setAlarmMeridiem(AlarmData &alarmToUpdate)
Alarm instance updating methods.
Definition alarm.cpp:160
void handleRemoveAlarm()
Definition alarm.cpp:254
void handleRemoveAllAlarms()
Definition alarm.cpp:329
void handleUpdateAlarmDay()
bool includes(const int &dayCode, const std::vector< int > &daysSelected)
Checks if an integer exists within a vector.
Definition alarm.cpp:182
void handleOption(const int &answer)
Run the input from user through switch statement to better handle many choices.
Definition alarm.cpp:79
void setAlarmTime(AlarmData &alarmToUpdate)
Definition alarm.cpp:124
Alarm()
Definition alarm.cpp:38
enum DaysOfWeek std::map< int code, std::string day > daysOfTheWeek std::vector< AlarmData > alarms void loadAlarms()
For easy interfacing between days of the week an alarm is triggered and the integer which represents ...
Definition alarm.cpp:43
void handleUpdateAlarmTime()
Definition alarm.cpp:237
AlarmData getAlarm()
Helper methods.
Definition alarm.cpp:305
void handleQuit()
Definition alarm.cpp:341