Back to index

php5  5.3.10
locale_class.c
Go to the documentation of this file.
00001 /*
00002    +----------------------------------------------------------------------+
00003    | PHP Version 5                                                        |
00004    +----------------------------------------------------------------------+
00005    | This source file is subject to version 3.01 of the PHP license,      |
00006    | that is bundled with this package in the file LICENSE, and is        |
00007    | available through the world-wide-web at the following url:           |
00008    | http://www.php.net/license/3_01.txt                                  |
00009    | If you did not receive a copy of the PHP license and are unable to   |
00010    | obtain it through the world-wide-web, please send a note to          |
00011    | license@php.net so we can mail you a copy immediately.               |
00012    +----------------------------------------------------------------------+
00013    | Authors: Kirti Velankar <kirtig@yahoo-inc.com>                       |
00014    +----------------------------------------------------------------------+
00015 */
00016 
00017 /* $Id: locale_class.c 314352 2011-08-06 01:22:27Z felipe $ */
00018 
00019 #include <unicode/uloc.h>
00020 #include "php_intl.h"
00021 #include "intl_error.h"
00022 #include "locale_class.h"
00023 #include "locale_methods.h"
00024 #include "locale.h"
00025 
00026 zend_class_entry *Locale_ce_ptr = NULL;
00027 
00028 /*
00029  * 'Locale' class registration structures & functions
00030  */
00031 
00032 /* {{{ Locale methods arguments info */
00033 /*
00034  *  NOTE: when modifying 'locale_XX_args' do not forget to modify
00035  *        approptiate 'locale_XX_args' for the procedural API!
00036  */
00037 
00038 ZEND_BEGIN_ARG_INFO_EX( locale_0_args, 0, 0, 0 )
00039 ZEND_END_ARG_INFO()
00040 
00041 ZEND_BEGIN_ARG_INFO_EX( locale_1_arg, 0, 0, 1 )
00042        ZEND_ARG_INFO( 0, arg1 )
00043 ZEND_END_ARG_INFO()
00044 
00045 ZEND_BEGIN_ARG_INFO_EX( locale_2_args, 0, 0, 2 )
00046        ZEND_ARG_INFO( 0, arg1 )
00047        ZEND_ARG_INFO( 0, arg2 )
00048 ZEND_END_ARG_INFO()
00049 
00050 ZEND_BEGIN_ARG_INFO_EX( locale_3_args, 0, 0, 3 )
00051         ZEND_ARG_INFO( 0, arg1 )
00052         ZEND_ARG_INFO( 0, arg2 )
00053         ZEND_ARG_INFO( 0, arg3 )
00054 ZEND_END_ARG_INFO()
00055 
00056 ZEND_BEGIN_ARG_INFO_EX( locale_4_args, 0, 0, 4 )
00057         ZEND_ARG_INFO( 0, arg1 )
00058         ZEND_ARG_INFO( 0, arg2 )
00059         ZEND_ARG_INFO( 0, arg3 )
00060         ZEND_ARG_INFO( 0, arg4 )
00061 ZEND_END_ARG_INFO()
00062 
00063 /* }}} */
00064 
00065 /* {{{ Locale_class_functions
00066  * Every 'Locale' class method has an entry in this table
00067  */
00068 
00069 function_entry Locale_class_functions[] = {
00070        ZEND_FENTRY( getDefault, zif_locale_get_default , locale_0_args , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC  )
00071        ZEND_FENTRY( setDefault, zif_locale_set_default , locale_1_arg , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
00072        ZEND_FENTRY( getPrimaryLanguage, ZEND_FN( locale_get_primary_language ), locale_1_arg , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
00073        ZEND_FENTRY( getScript, ZEND_FN( locale_get_script ), locale_1_arg , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
00074        ZEND_FENTRY( getRegion, ZEND_FN( locale_get_region ), locale_1_arg , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
00075        ZEND_FENTRY( getKeywords, ZEND_FN( locale_get_keywords ), locale_1_arg , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
00076        ZEND_FENTRY( getDisplayScript, ZEND_FN( locale_get_display_script ), locale_2_args , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
00077        ZEND_FENTRY( getDisplayRegion, ZEND_FN( locale_get_display_region ), locale_2_args , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
00078        ZEND_FENTRY( getDisplayName, ZEND_FN( locale_get_display_name ), locale_2_args , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
00079        ZEND_FENTRY( getDisplayLanguage, ZEND_FN( locale_get_display_language ), locale_2_args , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
00080        ZEND_FENTRY( getDisplayVariant, ZEND_FN( locale_get_display_variant ), locale_2_args , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
00081        ZEND_FENTRY( composeLocale, ZEND_FN( locale_compose ), locale_1_arg , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
00082        ZEND_FENTRY( parseLocale, ZEND_FN( locale_parse ), locale_1_arg , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
00083        ZEND_FENTRY( getAllVariants, ZEND_FN( locale_get_all_variants ), locale_1_arg , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
00084        ZEND_FENTRY( filterMatches, ZEND_FN( locale_filter_matches ), locale_3_args, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
00085        ZEND_FENTRY( lookup, ZEND_FN( locale_lookup ), locale_4_args, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
00086        ZEND_FENTRY( canonicalize, ZEND_FN( locale_canonicalize ), locale_1_arg , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
00087        ZEND_FENTRY( acceptFromHttp, ZEND_FN( locale_accept_from_http ), locale_1_arg , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
00088        PHP_FE_END
00089 };
00090 /* }}} */
00091 
00092 /* {{{ locale_register_Locale_class
00093  * Initialize 'Locale' class
00094  */
00095 void locale_register_Locale_class( TSRMLS_D )
00096 {
00097        zend_class_entry ce;
00098 
00099        /* Create and register 'Locale' class. */
00100        INIT_CLASS_ENTRY( ce, "Locale", Locale_class_functions );
00101        ce.create_object = NULL;
00102        Locale_ce_ptr = zend_register_internal_class( &ce TSRMLS_CC );
00103 
00104        /* Declare 'Locale' class properties. */
00105        if( !Locale_ce_ptr )
00106        {
00107               zend_error( E_ERROR,
00108                      "Locale: Failed to register Locale class.");
00109               return;
00110        }
00111 }
00112 /* }}} */
00113 
00114 /*
00115  * Local variables:
00116  * tab-width: 4
00117  * c-basic-offset: 4
00118  * End:
00119  * vim600: noet sw=4 ts=4 fdm=marker
00120  * vim<600: noet sw=4 ts=4
00121  */