theme date/time strings

This commit is contained in:
Chris Danford
2005-12-27 17:10:08 +00:00
parent e30f456383
commit 6681ad9dd4
3 changed files with 15 additions and 15 deletions
+9 -11
View File
@@ -1,6 +1,8 @@
#include "global.h" #include "global.h"
#include "DateTime.h" #include "DateTime.h"
#include "RageUtil.h" #include "RageUtil.h"
#include "EnumHelper.h"
#include "ThemeMetric.h"
DateTime::DateTime() DateTime::DateTime()
@@ -177,7 +179,8 @@ CString HourInDayToString( int iHourInDayIndex )
return ssprintf("Hour%02d", iHourInDayIndex); return ssprintf("Hour%02d", iHourInDayIndex);
} }
static const CString MONTH_TO_NAME[MONTHS_IN_YEAR] = enum Month {};
static const CString MonthNames[] =
{ {
"January", "January",
"February", "February",
@@ -192,13 +195,8 @@ static const CString MONTH_TO_NAME[MONTHS_IN_YEAR] =
"November", "November",
"December", "December",
}; };
XToString( Month, MONTHS_IN_YEAR );
CString MonthToString( int iMonthIndex ) XToThemedString( Month, MONTHS_IN_YEAR );
{
if( iMonthIndex < 0 || iMonthIndex >= (int) sizeof(MONTH_TO_NAME) )
return CString();
return MONTH_TO_NAME[iMonthIndex];
}
CString LastWeekToString( int iLastWeekIndex ) CString LastWeekToString( int iLastWeekIndex )
{ {
@@ -210,7 +208,7 @@ CString LastWeekToString( int iLastWeekIndex )
} }
} }
CString LastDayToDisplayString( int iLastDayIndex ) CString LastDayToThemedString( int iLastDayIndex )
{ {
CString s = LastDayToString( iLastDayIndex ); CString s = LastDayToString( iLastDayIndex );
s.Replace( "Day", "" ); s.Replace( "Day", "" );
@@ -218,7 +216,7 @@ CString LastDayToDisplayString( int iLastDayIndex )
return s; return s;
} }
CString LastWeekToDisplayString( int iLastWeekIndex ) CString LastWeekToThemedString( int iLastWeekIndex )
{ {
CString s = LastWeekToString( iLastWeekIndex ); CString s = LastWeekToString( iLastWeekIndex );
s.Replace( "Week", "" ); s.Replace( "Week", "" );
@@ -226,7 +224,7 @@ CString LastWeekToDisplayString( int iLastWeekIndex )
return s; return s;
} }
CString HourInDayToDisplayString( int iHourIndex ) CString HourInDayToThemedString( int iHourIndex )
{ {
int iBeginHour = iHourIndex; int iBeginHour = iHourIndex;
iBeginHour--; iBeginHour--;
+5 -4
View File
@@ -12,14 +12,15 @@ const int MONTHS_IN_YEAR = 12;
CString DayInYearToString( int iDayInYearIndex ); CString DayInYearToString( int iDayInYearIndex );
CString LastDayToString( int iLastDayIndex ); CString LastDayToString( int iLastDayIndex );
CString LastDayToThemedString( int iLastDayIndex );
CString DayOfWeekToString( int iDayOfWeekIndex ); CString DayOfWeekToString( int iDayOfWeekIndex );
CString DayOfWeekToThemedString( int iDayOfWeekIndex );
CString HourInDayToString( int iHourIndex ); CString HourInDayToString( int iHourIndex );
CString HourInDayToThemedString( int iHourIndex );
CString MonthToString( int iMonthIndex ); CString MonthToString( int iMonthIndex );
CString MonthToThemedString( int iMonthIndex );
CString LastWeekToString( int iLastWeekIndex ); CString LastWeekToString( int iLastWeekIndex );
CString LastWeekToThemedString( int iLastWeekIndex );
CString LastDayToDisplayString( int iLastDayIndex );
CString LastWeekToDisplayString( int iLastWeekIndex );
CString HourInDayToDisplayString( int iHourIndex );
tm AddDays( tm start, int iDaysToMove ); tm AddDays( tm start, int iDaysToMove );
tm GetYesterday( tm start ); tm GetYesterday( tm start );
+1
View File
@@ -4,6 +4,7 @@
#include "RageUtil.h" #include "RageUtil.h"
LuaFunction( MonthToString, MonthToString( IArg(1) ) ); LuaFunction( MonthToString, MonthToString( IArg(1) ) );
LuaFunction( MonthToThemedString, MonthToThemedString( IArg(1) ) );
LuaFunction( MonthOfYear, GetLocalTime().tm_mon ); LuaFunction( MonthOfYear, GetLocalTime().tm_mon );
LuaFunction( DayOfMonth, GetLocalTime().tm_mday ); LuaFunction( DayOfMonth, GetLocalTime().tm_mday );
LuaFunction( Hour, GetLocalTime().tm_hour ); LuaFunction( Hour, GetLocalTime().tm_hour );