PHP  
 PHP: Test and Code Coverage Analysis
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

LTP GCOV extension - code coverage report
Current view: directory - intl/dateformat - dateformat_class.c
Test: PHP Code Coverage
Date: 2009-11-21 Instrumented lines: 29
Code covered: 93.1 % Executed lines: 27
Legend: not executed executed

       1                 : /*
       2                 :    +----------------------------------------------------------------------+
       3                 :    | PHP Version 5                                                        |
       4                 :    +----------------------------------------------------------------------+
       5                 :    | This source file is subject to version 3.01 of the PHP license,      |
       6                 :    | that is bundled with this package in the file LICENSE, and is        |
       7                 :    | available through the world-wide-web at the following url:           |
       8                 :    | http://www.php.net/license/3_01.txt                                  |
       9                 :    | If you did not receive a copy of the PHP license and are unable to   |
      10                 :    | obtain it through the world-wide-web, please send a note to          |
      11                 :    | license@php.net so we can mail you a copy immediately.               |
      12                 :    +----------------------------------------------------------------------+
      13                 :    | Authors: Kirti Velankar <kirtig@yahoo-inc.com>                       |
      14                 :    +----------------------------------------------------------------------+
      15                 : */
      16                 : #include <unicode/unum.h>
      17                 : 
      18                 : #include "dateformat_class.h"
      19                 : #include "php_intl.h"
      20                 : #include "dateformat_data.h"
      21                 : #include "dateformat_format.h"
      22                 : #include "dateformat_parse.h"
      23                 : #include "dateformat.h"
      24                 : #include "dateformat_attr.h"
      25                 : 
      26                 : zend_class_entry *IntlDateFormatter_ce_ptr = NULL;
      27                 : 
      28                 : /*
      29                 :  * Auxiliary functions needed by objects of 'IntlDateFormatter' class
      30                 :  */
      31                 : 
      32                 : /* {{{ IntlDateFormatter_objects_dtor */
      33                 : static void IntlDateFormatter_object_dtor(void *object, zend_object_handle handle TSRMLS_DC )
      34             272 : {
      35             272 :         zend_objects_destroy_object( object, handle TSRMLS_CC );
      36             272 : }
      37                 : /* }}} */
      38                 : 
      39                 : /* {{{ IntlDateFormatter_objects_free */
      40                 : void IntlDateFormatter_object_free( zend_object *object TSRMLS_DC )
      41             272 : {
      42             272 :         IntlDateFormatter_object* dfo = (IntlDateFormatter_object*)object;
      43                 : 
      44             272 :         zend_object_std_dtor( &dfo->zo TSRMLS_CC );
      45                 : 
      46             272 :         dateformat_data_free( &dfo->datef_data TSRMLS_CC );
      47                 :         
      48             272 :         if( dfo->timezone_id ){
      49             218 :                 efree(dfo->timezone_id);
      50                 :         }
      51                 : 
      52             272 :         efree( dfo );
      53             272 : }
      54                 : /* }}} */
      55                 : 
      56                 : /* {{{ IntlDateFormatter_object_create */
      57                 : zend_object_value IntlDateFormatter_object_create(zend_class_entry *ce TSRMLS_DC)
      58             272 : {
      59                 :         zend_object_value    retval;
      60                 :         IntlDateFormatter_object*     intern;
      61                 : 
      62             272 :         intern = ecalloc( 1, sizeof(IntlDateFormatter_object) );
      63             272 :         dateformat_data_init( &intern->datef_data TSRMLS_CC );
      64             272 :         zend_object_std_init( &intern->zo, ce TSRMLS_CC );
      65             272 :         intern->date_type = 0;
      66             272 :         intern->time_type = 0;
      67             272 :         intern->calendar  = 1;               /* Gregorian calendar */
      68             272 :         intern->timezone_id =  NULL;
      69                 : 
      70             272 :         retval.handle = zend_objects_store_put(
      71                 :                 intern,
      72                 :                 IntlDateFormatter_object_dtor,
      73                 :                 (zend_objects_free_object_storage_t)IntlDateFormatter_object_free,
      74                 :                 NULL TSRMLS_CC );
      75                 : 
      76             272 :         retval.handlers = zend_get_std_object_handlers();
      77                 : 
      78             272 :         return retval;
      79                 : }
      80                 : /* }}} */
      81                 : 
      82                 : /* 
      83                 :  * 'IntlDateFormatter' class registration structures & functions
      84                 :  */
      85                 : 
      86                 : /* {{{ arginfo */
      87                 : ZEND_BEGIN_ARG_INFO_EX(datefmt_parse_args, 0, 0, 1)
      88                 :                 ZEND_ARG_INFO(0, string)
      89                 :                 ZEND_ARG_INFO(1, position)
      90                 : ZEND_END_ARG_INFO()
      91                 : 
      92                 : ZEND_BEGIN_ARG_INFO_EX(arginfo_intldateformatter_format, 0, 0, 0)
      93                 :         ZEND_ARG_INFO(0, args)
      94                 :         ZEND_ARG_INFO(0, array)
      95                 : ZEND_END_ARG_INFO()
      96                 : 
      97                 : ZEND_BEGIN_ARG_INFO(arginfo_intldateformatter_getdatetype, 0)
      98                 : ZEND_END_ARG_INFO()
      99                 : 
     100                 : ZEND_BEGIN_ARG_INFO_EX(arginfo_intldateformatter_settimezoneid, 0, 0, 1)
     101                 :         ZEND_ARG_INFO(0, zone)
     102                 : ZEND_END_ARG_INFO()
     103                 : 
     104                 : ZEND_BEGIN_ARG_INFO_EX(arginfo_intldateformatter_setpattern, 0, 0, 1)
     105                 :         ZEND_ARG_INFO(0, pattern)
     106                 : ZEND_END_ARG_INFO()
     107                 : 
     108                 : ZEND_BEGIN_ARG_INFO_EX(arginfo_intldateformatter_setlenient, 0, 0, 1)
     109                 :         ZEND_ARG_INFO(0, lenient)
     110                 : ZEND_END_ARG_INFO()
     111                 : 
     112                 : ZEND_BEGIN_ARG_INFO_EX(arginfo_intldateformatter_setcalendar, 0, 0, 1)
     113                 :         ZEND_ARG_INFO(0, which)
     114                 : ZEND_END_ARG_INFO()
     115                 : 
     116                 : ZEND_BEGIN_ARG_INFO_EX(arginfo_intldateformatter___construct, 0, 0, 3)
     117                 :         ZEND_ARG_INFO(0, locale)
     118                 :         ZEND_ARG_INFO(0, datetype)
     119                 :         ZEND_ARG_INFO(0, timetype)
     120                 :         ZEND_ARG_INFO(0, timezone)
     121                 :         ZEND_ARG_INFO(0, calendar)
     122                 :         ZEND_ARG_INFO(0, pattern)
     123                 : ZEND_END_ARG_INFO()
     124                 : /* }}} */
     125                 : 
     126                 : /* {{{ IntlDateFormatter_class_functions
     127                 :  * Every 'IntlDateFormatter' class method has an entry in this table
     128                 :  */
     129                 : static function_entry IntlDateFormatter_class_functions[] = {
     130                 :         PHP_ME( IntlDateFormatter, __construct, arginfo_intldateformatter___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR )
     131                 :         ZEND_FENTRY(  create, ZEND_FN( datefmt_create ), arginfo_intldateformatter___construct, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
     132                 :         PHP_NAMED_FE( getDateType, ZEND_FN( datefmt_get_datetype ), arginfo_intldateformatter_getdatetype )
     133                 :         PHP_NAMED_FE( getTimeType, ZEND_FN( datefmt_get_timetype ), arginfo_intldateformatter_getdatetype )
     134                 :         PHP_NAMED_FE( getCalendar, ZEND_FN( datefmt_get_calendar ), arginfo_intldateformatter_getdatetype )
     135                 :         PHP_NAMED_FE( setCalendar, ZEND_FN( datefmt_set_calendar ), arginfo_intldateformatter_setcalendar )
     136                 :         PHP_NAMED_FE( getTimeZoneId, ZEND_FN( datefmt_get_timezone_id ), arginfo_intldateformatter_getdatetype )
     137                 :         PHP_NAMED_FE( setTimeZoneId, ZEND_FN( datefmt_set_timezone_id ), arginfo_intldateformatter_settimezoneid )
     138                 :         PHP_NAMED_FE( setPattern, ZEND_FN( datefmt_set_pattern ), arginfo_intldateformatter_setpattern )
     139                 :         PHP_NAMED_FE( getPattern, ZEND_FN( datefmt_get_pattern ), arginfo_intldateformatter_getdatetype )
     140                 :         PHP_NAMED_FE( getLocale, ZEND_FN( datefmt_get_locale ), arginfo_intldateformatter_getdatetype )
     141                 :         PHP_NAMED_FE( setLenient, ZEND_FN( datefmt_set_lenient ), arginfo_intldateformatter_setlenient )
     142                 :         PHP_NAMED_FE( isLenient, ZEND_FN( datefmt_is_lenient ), arginfo_intldateformatter_getdatetype )
     143                 :         PHP_NAMED_FE( format, ZEND_FN( datefmt_format ), arginfo_intldateformatter_format )
     144                 :         PHP_NAMED_FE( parse, ZEND_FN( datefmt_parse), datefmt_parse_args )
     145                 :         PHP_NAMED_FE( localtime, ZEND_FN( datefmt_localtime ), datefmt_parse_args )
     146                 :         PHP_NAMED_FE( getErrorCode, ZEND_FN( datefmt_get_error_code ), arginfo_intldateformatter_getdatetype )
     147                 :         PHP_NAMED_FE( getErrorMessage, ZEND_FN( datefmt_get_error_message ), arginfo_intldateformatter_getdatetype )
     148                 :         { NULL, NULL, NULL }
     149                 : };
     150                 : /* }}} */
     151                 : 
     152                 : /* {{{ dateformat_register_class
     153                 :  * Initialize 'IntlDateFormatter' class
     154                 :  */
     155                 : void dateformat_register_IntlDateFormatter_class( TSRMLS_D )
     156           17633 : {
     157                 :         zend_class_entry ce;
     158                 : 
     159                 :         /* Create and register 'IntlDateFormatter' class. */
     160           17633 :         INIT_CLASS_ENTRY( ce, "IntlDateFormatter", IntlDateFormatter_class_functions );
     161           17633 :         ce.create_object = IntlDateFormatter_object_create;
     162           17633 :         IntlDateFormatter_ce_ptr = zend_register_internal_class( &ce TSRMLS_CC );
     163                 : 
     164                 :         /* Declare 'IntlDateFormatter' class properties. */
     165           17633 :         if( !IntlDateFormatter_ce_ptr )
     166                 :         {
     167               0 :                 zend_error(E_ERROR, "Failed to register IntlDateFormatter class");
     168               0 :                 return;
     169                 :         }
     170                 : }
     171                 : /* }}} */

Generated by: LTP GCOV extension version 1.5

Generated at Sat, 21 Nov 2009 12:27:01 +0000 (3 days ago)

Copyright © 2005-2009 The PHP Group
All rights reserved.