Ejemplo n.º 1
0
			inline TYPE & getOptions() {
				if( options == nullptr ) {
					options = AvailableOptions();
					assert( options != nullptr );
				}
				return *dynamic_cast<TYPE *>( options );
			}
Ejemplo n.º 2
0
			inline ComponentOptions & getOptions() {
				if( this->options == nullptr ) {
					this->options = AvailableOptions();
					assert( this->options != nullptr );
				}
				return * this->options;
			}
string
HinduLunisolarCalendarService::Respond( CalendarService::Action action,
                                        string calendarName,
                                        CalendarService::Format format )
{
    CGIInput & cgiInput = CGIInput::Instance();
    string versionName = cgiInput[ "version" ];
    HinduLunisolarCalendar::EVersion version = HinduLunisolarCalendar::Modern;
    for ( int i = 0; i < HinduLunisolarCalendar::NumVersions; ++i )
        if ( s_versionNames[ i ] == versionName )
        {
            version = HinduLunisolarCalendar::EVersion( i );
            break;
        }
    HinduLunisolarCalendar::SetVersion( version );

    switch ( action )
    {
    case CalendarService::AvailableOptions:
        return AvailableOptions( calendarName, format );
    case CalendarService::Names:
        return Names( calendarName, format );
    case CalendarService::DateToJD:
        return DateToJD( calendarName, format );
    case CalendarService::JDToDate:
        return JDToDate( calendarName, format );
    case CalendarService::MonthData:
        return MonthData( calendarName, format );
    default:
        throw Exception( "Unexpected action for "
                         + calendarName + " calendar." );
    }
}
std::string
DMYWCalendarService< C, W, O >::Respond( CalendarService::Action action,
                                         std::string calendarName,
                                         CalendarService::Format format )
{
    O::Set( );
    switch ( action )
    {
    case CalendarService::AvailableOptions:
        return AvailableOptions( calendarName, format );
    case CalendarService::Names:
        return Names( calendarName, format );
    case CalendarService::DateToJD:
        return DateToJD( calendarName, format );
    case CalendarService::JDToDate:
        return JDToDate( calendarName, format );
    case CalendarService::MonthData:
        return MonthData( calendarName, format );
    default:
        throw Exception( "Unexpected action for "
                         + calendarName + " calendar." );
    }
}