Moved private statics into unnamed namespace in cpp file to reduce coupling and uncessar in header

This commit is contained in:
Niall Cooling 2021-03-03 17:07:05 +00:00
parent a44260aab0
commit d34a510158
2 changed files with 39 additions and 39 deletions

View File

@ -15,6 +15,45 @@
using namespace Pinetime::Applications::Screens; using namespace Pinetime::Applications::Screens;
namespace {
char const *DaysString[] = {
"",
"MONDAY",
"TUESDAY",
"WEDNESDAY",
"THURSDAY",
"FRIDAY",
"SATURDAY",
"SUNDAY"
};
char const *MonthsString[] = {
"",
"JAN",
"FEB",
"MAR",
"APR",
"MAY",
"JUN",
"JUL",
"AUG",
"SEP",
"OCT",
"NOV",
"DEC"
};
const char *MonthToString(Pinetime::Controllers::DateTime::Months month) {
return MonthsString[static_cast<uint8_t>(month)];
}
const char *DayOfWeekToString(Pinetime::Controllers::DateTime::Days dayOfWeek) {
return DaysString[static_cast<uint8_t>(dayOfWeek)];
}
}
static void event_handler(lv_obj_t * obj, lv_event_t event) { static void event_handler(lv_obj_t * obj, lv_event_t event) {
Clock* screen = static_cast<Clock *>(obj->user_data); Clock* screen = static_cast<Clock *>(obj->user_data);
screen->OnObjectEvent(obj, event); screen->OnObjectEvent(obj, event);
@ -200,40 +239,6 @@ bool Clock::Refresh() {
return running; return running;
} }
const char *Clock::MonthToString(Pinetime::Controllers::DateTime::Months month) {
return Clock::MonthsString[static_cast<uint8_t>(month)];
}
const char *Clock::DayOfWeekToString(Pinetime::Controllers::DateTime::Days dayOfWeek) {
return Clock::DaysString[static_cast<uint8_t>(dayOfWeek)];
}
char const *Clock::DaysString[] = {
"",
"MONDAY",
"TUESDAY",
"WEDNESDAY",
"THURSDAY",
"FRIDAY",
"SATURDAY",
"SUNDAY"
};
char const *Clock::MonthsString[] = {
"",
"JAN",
"FEB",
"MAR",
"APR",
"MAY",
"JUN",
"JUL",
"AUG",
"SEP",
"OCT",
"NOV",
"DEC"
};
void Clock::OnObjectEvent(lv_obj_t *obj, lv_event_t event) { void Clock::OnObjectEvent(lv_obj_t *obj, lv_event_t event) {
if(obj == backgroundLabel) { if(obj == backgroundLabel) {

View File

@ -52,11 +52,6 @@ namespace Pinetime {
void OnObjectEvent(lv_obj_t *pObj, lv_event_t i); void OnObjectEvent(lv_obj_t *pObj, lv_event_t i);
private: private:
static const char* MonthToString(Pinetime::Controllers::DateTime::Months month);
static const char* DayOfWeekToString(Pinetime::Controllers::DateTime::Days dayOfWeek);
static char const *DaysString[];
static char const *MonthsString[];
char displayedChar[5]; char displayedChar[5];
uint16_t currentYear = 1970; uint16_t currentYear = 1970;