Back to index

php5  5.3.10
Classes | Defines | Functions | Variables
resourcebundle_class.h File Reference
#include <unicode/ures.h>
#include <zend.h>
#include "php.h"
#include "intl_error.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ResourceBundle_object

Defines

#define RESOURCEBUNDLE_METHOD_INIT_VARS   INTL_METHOD_INIT_VARS(ResourceBundle, rb)
#define RESOURCEBUNDLE_METHOD_FETCH_OBJECT   INTL_METHOD_FETCH_OBJECT(ResourceBundle, rb)
#define RESOURCEBUNDLE_OBJECT(rb)   (rb)->me

Functions

void resourcebundle_register_class (TSRMLS_D)
 PHP_FUNCTION (resourcebundle_create)
 PHP_FUNCTION (resourcebundle_get)
 PHP_FUNCTION (resourcebundle_count)
 PHP_FUNCTION (resourcebundle_locales)
 PHP_FUNCTION (resourcebundle_get_error_code)
 PHP_FUNCTION (resourcebundle_get_error_message)

Variables

zend_class_entry * ResourceBundle_ce_ptr

Class Documentation

struct ResourceBundle_object

Definition at line 27 of file resourcebundle_class.h.

Collaboration diagram for ResourceBundle_object:
Class Members
UResourceBundle * child
intl_error error
UResourceBundle * me
zend_object zend

Define Documentation

Definition at line 36 of file resourcebundle_class.h.

#define RESOURCEBUNDLE_METHOD_INIT_VARS   INTL_METHOD_INIT_VARS(ResourceBundle, rb)

Definition at line 35 of file resourcebundle_class.h.

#define RESOURCEBUNDLE_OBJECT (   rb)    (rb)->me

Definition at line 37 of file resourcebundle_class.h.


Function Documentation

PHP_FUNCTION ( resourcebundle_create  )

Definition at line 146 of file resourcebundle_class.c.

Here is the call graph for this function:

PHP_FUNCTION ( resourcebundle_get  )

Definition at line 236 of file resourcebundle_class.c.

{
       zend_bool   fallback = 1;
       zval *        offset;
       zval *      object;

       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oz|b",      &object, ResourceBundle_ce_ptr, &offset, &fallback ) == FAILURE) {
              intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,   
                     "resourcebundle_get: unable to parse input params", 0 TSRMLS_CC);
              RETURN_FALSE;
       }

       resourcebundle_array_fetch(object, offset, return_value, fallback TSRMLS_CC);
}

Here is the call graph for this function:

PHP_FUNCTION ( resourcebundle_count  )

Definition at line 272 of file resourcebundle_class.c.

{
       int32_t                len;
       RESOURCEBUNDLE_METHOD_INIT_VARS;

       if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, ResourceBundle_ce_ptr ) == FAILURE ) {
              intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,   
                     "resourcebundle_count: unable to parse input params", 0 TSRMLS_CC);
              RETURN_FALSE;
       }

       RESOURCEBUNDLE_METHOD_FETCH_OBJECT;

       len = ures_getSize( rb->me );
       RETURN_LONG( len );
}

Here is the call graph for this function:

PHP_FUNCTION ( resourcebundle_locales  )

Definition at line 299 of file resourcebundle_class.c.

{
       char * bundlename;
       int    bundlename_len = 0;
       const char * entry;
       int entry_len;
       UEnumeration *icuenum;
       UErrorCode   icuerror = U_ZERO_ERROR;

       intl_errors_reset( NULL TSRMLS_CC );

       if( zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &bundlename, &bundlename_len ) == FAILURE )
       {
              intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,   
                     "resourcebundle_locales: unable to parse input params", 0 TSRMLS_CC);
              RETURN_FALSE;
       }

       if(bundlename_len == 0) {
              // fetch default locales list
              bundlename = NULL;
       }

       icuenum = ures_openAvailableLocales( bundlename, &icuerror );
       INTL_CHECK_STATUS(icuerror, "Cannot fetch locales list");             

       uenum_reset( icuenum, &icuerror );
       INTL_CHECK_STATUS(icuerror, "Cannot iterate locales list");           

       array_init( return_value );
       while ((entry = uenum_next( icuenum, &entry_len, &icuerror ))) {
              add_next_index_stringl( return_value, (char *) entry, entry_len, 1 );
       }
       uenum_close( icuenum );
}

Here is the call graph for this function:

PHP_FUNCTION ( resourcebundle_get_error_code  )

Definition at line 345 of file resourcebundle_class.c.

{
       RESOURCEBUNDLE_METHOD_INIT_VARS;

       if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O",
              &object, ResourceBundle_ce_ptr ) == FAILURE )
       {
              intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
                     "resourcebundle_get_error_code: unable to parse input params", 0 TSRMLS_CC );
              RETURN_FALSE;
       }

       rb = (ResourceBundle_object *) zend_object_store_get_object( object TSRMLS_CC );

       RETURN_LONG(INTL_DATA_ERROR_CODE(rb));
}

Here is the call graph for this function:

PHP_FUNCTION ( resourcebundle_get_error_message  )

Definition at line 372 of file resourcebundle_class.c.

{
       char* message = NULL;
       RESOURCEBUNDLE_METHOD_INIT_VARS;

       if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O",
              &object, ResourceBundle_ce_ptr ) == FAILURE )
       {
              intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
                     "resourcebundle_get_error_message: unable to parse input params", 0 TSRMLS_CC );
              RETURN_FALSE;
       }

       rb = (ResourceBundle_object *) zend_object_store_get_object( object TSRMLS_CC );
       message = (char *)intl_error_get_message(INTL_DATA_ERROR_P(rb) TSRMLS_CC);
       RETURN_STRING(message, 0);
}

Here is the call graph for this function:

Definition at line 409 of file resourcebundle_class.c.

{
       zend_class_entry ce;

       INIT_CLASS_ENTRY( ce, "ResourceBundle", ResourceBundle_class_functions );

       ce.create_object = ResourceBundle_object_create;
       ce.get_iterator = resourcebundle_get_iterator;

       ResourceBundle_ce_ptr = zend_register_internal_class( &ce TSRMLS_CC );

       if( !ResourceBundle_ce_ptr )
       {
              zend_error(E_ERROR, "Failed to register ResourceBundle class");
              return;
       }

       ResourceBundle_object_handlers = std_object_handlers;
       ResourceBundle_object_handlers.clone_obj    = NULL; /* ICU ResourceBundle has no clone implementation */
       ResourceBundle_object_handlers.read_dimension = resourcebundle_array_get;
       ResourceBundle_object_handlers.count_elements = resourcebundle_array_count;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

zend_class_entry* ResourceBundle_ce_ptr

Definition at line 33 of file resourcebundle_class.c.