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

LCOV - code coverage report
Current view: top level - ext/intl/resourcebundle - resourcebundle.c (source / functions) Hit Total Coverage
Test: PHP Code Coverage Lines: 27 29 93.1 %
Date: 2014-09-02 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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: Hans-Peter Oeri (University of St.Gallen) <hp@oeri.ch>      |
      14             :    +----------------------------------------------------------------------+
      15             :  */
      16             : 
      17             : #include <unicode/ures.h>
      18             : 
      19             : #include <zend.h>
      20             : #include <zend_API.h>
      21             : 
      22             : #include "intl_convert.h"
      23             : #include "intl_data.h"
      24             : #include "resourcebundle/resourcebundle_class.h"
      25             : 
      26             : /* {{{ ResourceBundle_extract_value */
      27          42 : void resourcebundle_extract_value( zval *return_value, ResourceBundle_object *source TSRMLS_DC ) 
      28             : {
      29             :         UResType               restype;
      30             :         const UChar*           ufield;
      31             :         const uint8_t*         bfield;
      32             :         const int32_t*         vfield;
      33             :         int32_t                ilen;
      34             :         int                    i;
      35             :         long                   lfield;
      36             :         ResourceBundle_object* newrb;
      37             : 
      38          42 :         restype = ures_getType( source->child );
      39          42 :         switch (restype)
      40             :         {
      41             :                 case URES_STRING:
      42          17 :                         ufield = ures_getString( source->child, &ilen, &INTL_DATA_ERROR_CODE(source) );
      43          17 :                         INTL_METHOD_CHECK_STATUS(source, "Failed to retrieve string value");
      44          17 :                         INTL_METHOD_RETVAL_UTF8(source, (UChar *)ufield, ilen, 0);
      45          17 :                         break;
      46             : 
      47             :                 case URES_BINARY:
      48           4 :                         bfield = ures_getBinary( source->child, &ilen, &INTL_DATA_ERROR_CODE(source) );
      49           4 :                         INTL_METHOD_CHECK_STATUS(source, "Failed to retrieve binary value");
      50           4 :                         ZVAL_STRINGL( return_value, (char *) bfield, ilen, 1 );
      51           4 :                         break;
      52             : 
      53             :                 case URES_INT:
      54           7 :                         lfield = ures_getInt( source->child, &INTL_DATA_ERROR_CODE(source) );
      55           7 :                         INTL_METHOD_CHECK_STATUS(source, "Failed to retrieve integer value");
      56           7 :                         ZVAL_LONG( return_value, lfield );
      57           7 :                         break;
      58             : 
      59             :                 case URES_INT_VECTOR:
      60           4 :                         vfield = ures_getIntVector( source->child, &ilen, &INTL_DATA_ERROR_CODE(source) );
      61           4 :                         INTL_METHOD_CHECK_STATUS(source, "Failed to retrieve vector value");
      62           4 :                         array_init( return_value );
      63          44 :                         for (i=0; i<ilen; i++) {
      64          40 :                                 add_next_index_long( return_value, vfield[i] );
      65             :                         }
      66           4 :                         break;
      67             : 
      68             :                 case URES_ARRAY:
      69             :                 case URES_TABLE:
      70          10 :                         object_init_ex( return_value, ResourceBundle_ce_ptr );
      71          10 :                         newrb = (ResourceBundle_object *) zend_object_store_get_object( return_value TSRMLS_CC );
      72          10 :                         newrb->me = source->child;
      73          10 :                         source->child = NULL;
      74          10 :                         intl_errors_reset(INTL_DATA_ERROR_P(source) TSRMLS_CC);
      75          10 :                         break;
      76             : 
      77             :                 default:
      78           0 :                         intl_errors_set(INTL_DATA_ERROR_P(source), U_ILLEGAL_ARGUMENT_ERROR, "Unknown resource type", 0 TSRMLS_CC);
      79           0 :                         RETURN_FALSE;
      80             :                         break;
      81             :         }
      82             : }
      83             : /* }}} */
      84             : 
      85             : /*
      86             :  * Local variables:
      87             :  * tab-width: 4
      88             :  * c-basic-offset: 4
      89             :  * End:
      90             :  * vim600: noet sw=4 ts=4 fdm=marker
      91             :  * vim<600: noet sw=4 ts=4
      92             :  */

Generated by: LCOV version 1.10

Generated at Tue, 02 Sep 2014 09:42:57 +0000 (14 hours ago)

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