diff options
| author | Gustavo André dos Santos Lopes <cataphract@php.net> | 2012-04-01 15:37:07 +0200 |
|---|---|---|
| committer | Gustavo André dos Santos Lopes <cataphract@php.net> | 2012-04-01 23:28:00 +0100 |
| commit | d3a29c108bf146440645d8b1a3b2e0f22a34ac59 (patch) | |
| tree | 971a81f5136b3facb6d9a8c76d619df1e28b4609 /ext/intl/calendar/calendar_methods.cpp | |
| parent | 7460741f991aa646e54456ef022676ca184b54fe (diff) | |
| download | php-git-d3a29c108bf146440645d8b1a3b2e0f22a34ac59.tar.gz | |
Supported Calendar methods new to ICU 49.
Diffstat (limited to 'ext/intl/calendar/calendar_methods.cpp')
| -rw-r--r-- | ext/intl/calendar/calendar_methods.cpp | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/ext/intl/calendar/calendar_methods.cpp b/ext/intl/calendar/calendar_methods.cpp index 5eb0c13a50..d84ad65eeb 100644 --- a/ext/intl/calendar/calendar_methods.cpp +++ b/ext/intl/calendar/calendar_methods.cpp @@ -1019,6 +1019,93 @@ U_CFUNC PHP_FUNCTION(intlcal_equals) RETURN_BOOL((int)result); } +#if U_ICU_VERSION_MAJOR_NUM >= 49 + +U_CFUNC PHP_FUNCTION(intlcal_get_repeated_wall_time_option) +{ + CALENDAR_METHOD_INIT_VARS; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), + "O", &object, Calendar_ce_ptr) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "intlcal_get_repeated_wall_time_option: bad arguments", 0 TSRMLS_CC); + RETURN_FALSE; + } + + CALENDAR_METHOD_FETCH_OBJECT; + + RETURN_LONG(co->ucal->getRepeatedWallTimeOption()); +} + +U_CFUNC PHP_FUNCTION(intlcal_get_skipped_wall_time_option) +{ + CALENDAR_METHOD_INIT_VARS; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), + "O", &object, Calendar_ce_ptr) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "intlcal_get_skipped_wall_time_option: bad arguments", 0 TSRMLS_CC); + RETURN_FALSE; + } + + CALENDAR_METHOD_FETCH_OBJECT; + + RETURN_LONG(co->ucal->getSkippedWallTimeOption()); +} + +U_CFUNC PHP_FUNCTION(intlcal_set_repeated_wall_time_option) +{ + long option; + CALENDAR_METHOD_INIT_VARS; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), + "Ol", &object, Calendar_ce_ptr, &option) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "intlcal_set_repeated_wall_time_option: bad arguments", 0 TSRMLS_CC); + RETURN_FALSE; + } + + if (option != UCAL_WALLTIME_FIRST && option != UCAL_WALLTIME_LAST) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "intlcal_set_repeated_wall_time_option: invalid option", 0 TSRMLS_CC); + RETURN_FALSE; + } + + CALENDAR_METHOD_FETCH_OBJECT; + + co->ucal->setRepeatedWallTimeOption((UCalendarWallTimeOption)option); + + RETURN_TRUE; +} + +U_CFUNC PHP_FUNCTION(intlcal_set_skipped_wall_time_option) +{ + long option; + CALENDAR_METHOD_INIT_VARS; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), + "Ol", &object, Calendar_ce_ptr, &option) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "intlcal_set_skipped_wall_time_option: bad arguments", 0 TSRMLS_CC); + RETURN_FALSE; + } + + if (option != UCAL_WALLTIME_FIRST && option != UCAL_WALLTIME_LAST + && option != UCAL_WALLTIME_NEXT_VALID) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "intlcal_set_skipped_wall_time_option: invalid option", 0 TSRMLS_CC); + RETURN_FALSE; + } + + CALENDAR_METHOD_FETCH_OBJECT; + + co->ucal->setSkippedWallTimeOption((UCalendarWallTimeOption)option); + + RETURN_TRUE; +} + +#endif + U_CFUNC PHP_FUNCTION(intlcal_get_error_code) { CALENDAR_METHOD_INIT_VARS; |
