ISO8601d: Added :dayName methods and tests

This commit is contained in:
Paul Beckingham 2015-09-26 14:32:14 -04:00
parent 7164215146
commit f26cff9a4a
3 changed files with 45 additions and 1 deletions

View file

@ -850,6 +850,40 @@ std::string ISO8601d::monthName (int month)
return ucFirst (months[month - 1]);
}
////////////////////////////////////////////////////////////////////////////////
void ISO8601d::dayName (int dow, std::string& name)
{
static const char* days[7] =
{
STRING_DATE_SUNDAY,
STRING_DATE_MONDAY,
STRING_DATE_TUESDAY,
STRING_DATE_WEDNESDAY,
STRING_DATE_THURSDAY,
STRING_DATE_FRIDAY,
STRING_DATE_SATURDAY,
};
name = ucFirst (days[dow]);
}
////////////////////////////////////////////////////////////////////////////////
std::string ISO8601d::dayName (int dow)
{
static const char* days[7] =
{
STRING_DATE_SUNDAY,
STRING_DATE_MONDAY,
STRING_DATE_TUESDAY,
STRING_DATE_WEDNESDAY,
STRING_DATE_THURSDAY,
STRING_DATE_FRIDAY,
STRING_DATE_SATURDAY,
};
return ucFirst (days[dow]);
}
////////////////////////////////////////////////////////////////////////////////
// Static
int ISO8601d::dayOfWeek (const std::string& input)

View file

@ -48,6 +48,8 @@ public:
static int daysInMonth (int, int);
static int daysInYear (int);
static std::string monthName (int);
static void dayName (int, std::string&);
static std::string dayName (int);
static int dayOfWeek (const std::string&);