Back to index

php5  5.3.10
Functions
collator_locale.c File Reference
#include "php_intl.h"
#include "collator_class.h"
#include "collator_locale.h"
#include "intl_convert.h"
#include <zend_API.h>

Go to the source code of this file.

Functions

 PHP_FUNCTION (collator_get_locale)

Function Documentation

Definition at line 34 of file collator_locale.c.

{
       long   type        = 0;
       char*  locale_name = NULL;

       COLLATOR_METHOD_INIT_VARS

       /* Parse parameters. */
       if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol",
              &object, Collator_ce_ptr, &type ) == FAILURE )
       {
              intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
                     "collator_get_locale: unable to parse input params", 0 TSRMLS_CC );

              RETURN_FALSE;
       }

       /* Fetch the object. */
       COLLATOR_METHOD_FETCH_OBJECT;

       if (!co || !co->ucoll) {
              intl_error_set_code( NULL, COLLATOR_ERROR_CODE( co ) TSRMLS_CC );
              intl_errors_set_custom_msg( COLLATOR_ERROR_P( co ),
                     "Object not initialized", 0 TSRMLS_CC );
              php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Object not initialized");

              RETURN_FALSE;
       }

       /* Get locale by specified type. */
       locale_name = (char*) ucol_getLocaleByType(
              co->ucoll, type, COLLATOR_ERROR_CODE_P( co ) );
       COLLATOR_CHECK_STATUS( co, "Error getting locale by type" );

       /* Return it. */
       RETVAL_STRINGL( locale_name, strlen(locale_name), TRUE );
}

Here is the call graph for this function: