Back to index

php5  5.3.10
collator.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: Vadim Savchuk <vsavchuk@productengine.com>                  |
00014    |          Dmitry Lakhtyuk <dlakhtyuk@productengine.com>               |
00015    +----------------------------------------------------------------------+
00016  */
00017 
00018 #ifdef HAVE_CONFIG_H
00019 #include "config.h"
00020 #endif
00021 
00022 #include "collator_class.h"
00023 #include "collator.h"
00024 
00025 #include <unicode/utypes.h>
00026 #include <unicode/ucol.h>
00027 #include <unicode/ustring.h>
00028 
00029 /* {{{ collator_register_constants
00030  * Register constants common for the both (OO and procedural)
00031  * APIs.
00032  */
00033 void collator_register_constants( INIT_FUNC_ARGS )
00034 {
00035        if( !Collator_ce_ptr )
00036        {
00037               zend_error( E_ERROR, "Collator class not defined" );
00038               return;
00039        }
00040 
00041        #define COLLATOR_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_CS)
00042        #define COLLATOR_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long( Collator_ce_ptr, ZEND_STRS( #x ) - 1, UCOL_##x TSRMLS_CC );
00043        #define COLLATOR_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_long( Collator_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC );
00044 
00045        /* UColAttributeValue constants */
00046        COLLATOR_EXPOSE_CUSTOM_CLASS_CONST( "DEFAULT_VALUE", UCOL_DEFAULT );
00047 
00048        COLLATOR_EXPOSE_CLASS_CONST( PRIMARY );
00049        COLLATOR_EXPOSE_CLASS_CONST( SECONDARY );
00050        COLLATOR_EXPOSE_CLASS_CONST( TERTIARY );
00051        COLLATOR_EXPOSE_CLASS_CONST( DEFAULT_STRENGTH );
00052        COLLATOR_EXPOSE_CLASS_CONST( QUATERNARY );
00053        COLLATOR_EXPOSE_CLASS_CONST( IDENTICAL );
00054 
00055        COLLATOR_EXPOSE_CLASS_CONST( OFF );
00056        COLLATOR_EXPOSE_CLASS_CONST( ON );
00057 
00058        COLLATOR_EXPOSE_CLASS_CONST( SHIFTED );
00059        COLLATOR_EXPOSE_CLASS_CONST( NON_IGNORABLE );
00060 
00061        COLLATOR_EXPOSE_CLASS_CONST( LOWER_FIRST );
00062        COLLATOR_EXPOSE_CLASS_CONST( UPPER_FIRST );
00063 
00064        /* UColAttribute constants */
00065        COLLATOR_EXPOSE_CLASS_CONST( FRENCH_COLLATION );
00066        COLLATOR_EXPOSE_CLASS_CONST( ALTERNATE_HANDLING );
00067        COLLATOR_EXPOSE_CLASS_CONST( CASE_FIRST );
00068        COLLATOR_EXPOSE_CLASS_CONST( CASE_LEVEL );
00069        COLLATOR_EXPOSE_CLASS_CONST( NORMALIZATION_MODE );
00070        COLLATOR_EXPOSE_CLASS_CONST( STRENGTH );
00071        COLLATOR_EXPOSE_CLASS_CONST( HIRAGANA_QUATERNARY_MODE );
00072        COLLATOR_EXPOSE_CLASS_CONST( NUMERIC_COLLATION );
00073 
00074        /* ULocDataLocaleType constants */
00075        COLLATOR_EXPOSE_CONST( ULOC_ACTUAL_LOCALE );
00076        COLLATOR_EXPOSE_CONST( ULOC_VALID_LOCALE );
00077 
00078        /* sort flags */
00079        COLLATOR_EXPOSE_CUSTOM_CLASS_CONST( "SORT_REGULAR", COLLATOR_SORT_REGULAR );
00080        COLLATOR_EXPOSE_CUSTOM_CLASS_CONST( "SORT_STRING",  COLLATOR_SORT_STRING  );
00081        COLLATOR_EXPOSE_CUSTOM_CLASS_CONST( "SORT_NUMERIC", COLLATOR_SORT_NUMERIC );
00082 
00083        #undef COLLATOR_EXPOSE_CUSTOM_CLASS_CONST
00084        #undef COLLATOR_EXPOSE_CLASS_CONST
00085        #undef COLLATOR_EXPOSE_CONST
00086 }
00087 /* }}} */
00088 
00089 /*
00090  * Local variables:
00091  * tab-width: 4
00092  * c-basic-offset: 4
00093  * End:
00094  * vim600: noet sw=4 ts=4 fdm=marker
00095  * vim<600: noet sw=4 ts=4
00096  */