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/formatter - formatter.c (source / functions) Hit Total Coverage
Test: PHP Code Coverage Lines: 76 77 98.7 %
Date: 2014-12-13 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :    +----------------------------------------------------------------------+
       3             :    | PHP Version 7                                                        |
       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: Stanislav Malyshev <stas@zend.com>                          |
      14             :    +----------------------------------------------------------------------+
      15             :  */
      16             : 
      17             : #ifdef HAVE_CONFIG_H
      18             : #include "config.h"
      19             : #endif
      20             : 
      21             : #include <unicode/utypes.h>
      22             : #include <unicode/unum.h>
      23             : #include <unicode/ustring.h>
      24             : 
      25             : #include "php_intl.h"
      26             : #include "formatter_class.h"
      27             : #include "formatter_format.h"
      28             : 
      29             : #if U_ICU_VERSION_MAJOR_NUM == 3 && U_ICU_VERSION_MINOR_NUM <= 4
      30             : #define UNUM_MONETARY_GROUPING_SEPARATOR_SYMBOL 17
      31             : #endif
      32             : 
      33             : /* {{{ formatter_register_constants
      34             :  * Register constants common for the both (OO and procedural)
      35             :  * APIs.
      36             :  */
      37       20622 : void formatter_register_constants( INIT_FUNC_ARGS )
      38             : {
      39       20622 :         if( NumberFormatter_ce_ptr == NULL) {
      40           0 :                 zend_error(E_ERROR, "NumberFormatter class not defined");
      41             :         }
      42             : 
      43             :         #define FORMATTER_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS)
      44             :         #define FORMATTER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long( NumberFormatter_ce_ptr, ZEND_STRS( #x ) - 1, UNUM_##x TSRMLS_CC );
      45             :         #define FORMATTER_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_long( NumberFormatter_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC );
      46             : 
      47             :         /* UNumberFormatStyle constants */
      48       20622 :         FORMATTER_EXPOSE_CLASS_CONST( PATTERN_DECIMAL );
      49       20622 :         FORMATTER_EXPOSE_CLASS_CONST( DECIMAL );
      50       20622 :         FORMATTER_EXPOSE_CLASS_CONST( CURRENCY );
      51       20622 :         FORMATTER_EXPOSE_CLASS_CONST( PERCENT );
      52       20622 :         FORMATTER_EXPOSE_CLASS_CONST( SCIENTIFIC );
      53       20622 :         FORMATTER_EXPOSE_CLASS_CONST( SPELLOUT );
      54       20622 :         FORMATTER_EXPOSE_CLASS_CONST( ORDINAL );
      55       20622 :         FORMATTER_EXPOSE_CLASS_CONST( DURATION );
      56       20622 :         FORMATTER_EXPOSE_CLASS_CONST( PATTERN_RULEBASED );
      57       20622 :         FORMATTER_EXPOSE_CLASS_CONST( IGNORE );
      58             : 
      59       20622 :         FORMATTER_EXPOSE_CUSTOM_CLASS_CONST( "DEFAULT_STYLE",  UNUM_DEFAULT );
      60             : 
      61             : /* workaround for ICU bug */
      62             : #if U_ICU_VERSION_MAJOR_NUM == 3 && U_ICU_VERSION_MINOR_NUM < 8
      63             : #define UNUM_ROUND_HALFEVEN UNUM_FOUND_HALFEVEN
      64             : #endif
      65             : 
      66             :         /* UNumberFormatRoundingMode */
      67       20622 :         FORMATTER_EXPOSE_CLASS_CONST( ROUND_CEILING );
      68       20622 :         FORMATTER_EXPOSE_CLASS_CONST( ROUND_FLOOR );
      69       20622 :         FORMATTER_EXPOSE_CLASS_CONST( ROUND_DOWN );
      70       20622 :         FORMATTER_EXPOSE_CLASS_CONST( ROUND_UP );
      71       20622 :         FORMATTER_EXPOSE_CLASS_CONST( ROUND_HALFEVEN );
      72       20622 :         FORMATTER_EXPOSE_CLASS_CONST( ROUND_HALFDOWN );
      73       20622 :         FORMATTER_EXPOSE_CLASS_CONST( ROUND_HALFUP );
      74             : 
      75             :         /* UNumberFormatPadPosition */
      76       20622 :         FORMATTER_EXPOSE_CLASS_CONST( PAD_BEFORE_PREFIX ); 
      77       20622 :         FORMATTER_EXPOSE_CLASS_CONST( PAD_AFTER_PREFIX ); 
      78       20622 :         FORMATTER_EXPOSE_CLASS_CONST( PAD_BEFORE_SUFFIX ); 
      79       20622 :         FORMATTER_EXPOSE_CLASS_CONST( PAD_AFTER_SUFFIX );
      80             : 
      81             :         /* UNumberFormatAttribute */
      82       20622 :         FORMATTER_EXPOSE_CLASS_CONST( PARSE_INT_ONLY ); 
      83       20622 :         FORMATTER_EXPOSE_CLASS_CONST( GROUPING_USED ); 
      84       20622 :         FORMATTER_EXPOSE_CLASS_CONST( DECIMAL_ALWAYS_SHOWN ); 
      85       20622 :         FORMATTER_EXPOSE_CLASS_CONST( MAX_INTEGER_DIGITS );
      86       20622 :         FORMATTER_EXPOSE_CLASS_CONST( MIN_INTEGER_DIGITS ); 
      87       20622 :         FORMATTER_EXPOSE_CLASS_CONST( INTEGER_DIGITS ); 
      88       20622 :         FORMATTER_EXPOSE_CLASS_CONST( MAX_FRACTION_DIGITS ); 
      89       20622 :         FORMATTER_EXPOSE_CLASS_CONST( MIN_FRACTION_DIGITS );
      90       20622 :         FORMATTER_EXPOSE_CLASS_CONST( FRACTION_DIGITS ); 
      91       20622 :         FORMATTER_EXPOSE_CLASS_CONST( MULTIPLIER ); 
      92       20622 :         FORMATTER_EXPOSE_CLASS_CONST( GROUPING_SIZE ); 
      93       20622 :         FORMATTER_EXPOSE_CLASS_CONST( ROUNDING_MODE );
      94       20622 :         FORMATTER_EXPOSE_CLASS_CONST( ROUNDING_INCREMENT ); 
      95       20622 :         FORMATTER_EXPOSE_CLASS_CONST( FORMAT_WIDTH ); 
      96       20622 :         FORMATTER_EXPOSE_CLASS_CONST( PADDING_POSITION ); 
      97       20622 :         FORMATTER_EXPOSE_CLASS_CONST( SECONDARY_GROUPING_SIZE );
      98       20622 :         FORMATTER_EXPOSE_CLASS_CONST( SIGNIFICANT_DIGITS_USED ); 
      99       20622 :         FORMATTER_EXPOSE_CLASS_CONST( MIN_SIGNIFICANT_DIGITS ); 
     100       20622 :         FORMATTER_EXPOSE_CLASS_CONST( MAX_SIGNIFICANT_DIGITS ); 
     101       20622 :         FORMATTER_EXPOSE_CLASS_CONST( LENIENT_PARSE ); 
     102             : 
     103             :         /* UNumberFormatTextAttribute */
     104       20622 :         FORMATTER_EXPOSE_CLASS_CONST( POSITIVE_PREFIX ); 
     105       20622 :         FORMATTER_EXPOSE_CLASS_CONST( POSITIVE_SUFFIX ); 
     106       20622 :         FORMATTER_EXPOSE_CLASS_CONST( NEGATIVE_PREFIX ); 
     107       20622 :         FORMATTER_EXPOSE_CLASS_CONST( NEGATIVE_SUFFIX );
     108       20622 :         FORMATTER_EXPOSE_CLASS_CONST( PADDING_CHARACTER ); 
     109       20622 :         FORMATTER_EXPOSE_CLASS_CONST( CURRENCY_CODE ); 
     110       20622 :         FORMATTER_EXPOSE_CLASS_CONST( DEFAULT_RULESET ); 
     111       20622 :         FORMATTER_EXPOSE_CLASS_CONST( PUBLIC_RULESETS );
     112             : 
     113             :         /* UNumberFormatSymbol */
     114       20622 :         FORMATTER_EXPOSE_CLASS_CONST( DECIMAL_SEPARATOR_SYMBOL ); 
     115       20622 :         FORMATTER_EXPOSE_CLASS_CONST( GROUPING_SEPARATOR_SYMBOL ); 
     116       20622 :         FORMATTER_EXPOSE_CLASS_CONST( PATTERN_SEPARATOR_SYMBOL ); 
     117       20622 :         FORMATTER_EXPOSE_CLASS_CONST( PERCENT_SYMBOL );
     118       20622 :         FORMATTER_EXPOSE_CLASS_CONST( ZERO_DIGIT_SYMBOL ); 
     119       20622 :         FORMATTER_EXPOSE_CLASS_CONST( DIGIT_SYMBOL ); 
     120       20622 :         FORMATTER_EXPOSE_CLASS_CONST( MINUS_SIGN_SYMBOL ); 
     121       20622 :         FORMATTER_EXPOSE_CLASS_CONST( PLUS_SIGN_SYMBOL );
     122       20622 :         FORMATTER_EXPOSE_CLASS_CONST( CURRENCY_SYMBOL ); 
     123       20622 :         FORMATTER_EXPOSE_CLASS_CONST( INTL_CURRENCY_SYMBOL );
     124       20622 :         FORMATTER_EXPOSE_CLASS_CONST( MONETARY_SEPARATOR_SYMBOL ); 
     125       20622 :         FORMATTER_EXPOSE_CLASS_CONST( EXPONENTIAL_SYMBOL );
     126       20622 :         FORMATTER_EXPOSE_CLASS_CONST( PERMILL_SYMBOL ); 
     127       20622 :         FORMATTER_EXPOSE_CLASS_CONST( PAD_ESCAPE_SYMBOL );
     128       20622 :         FORMATTER_EXPOSE_CLASS_CONST( INFINITY_SYMBOL );
     129       20622 :         FORMATTER_EXPOSE_CLASS_CONST( NAN_SYMBOL );
     130       20622 :         FORMATTER_EXPOSE_CLASS_CONST( SIGNIFICANT_DIGIT_SYMBOL );
     131       20622 :         FORMATTER_EXPOSE_CLASS_CONST( MONETARY_GROUPING_SEPARATOR_SYMBOL ); 
     132             : 
     133       20622 :         FORMATTER_EXPOSE_CUSTOM_CLASS_CONST( "TYPE_DEFAULT", FORMAT_TYPE_DEFAULT );
     134       20622 :         FORMATTER_EXPOSE_CUSTOM_CLASS_CONST( "TYPE_INT32", FORMAT_TYPE_INT32 );
     135       20622 :         FORMATTER_EXPOSE_CUSTOM_CLASS_CONST( "TYPE_INT64", FORMAT_TYPE_INT64 );
     136       20622 :         FORMATTER_EXPOSE_CUSTOM_CLASS_CONST( "TYPE_DOUBLE", FORMAT_TYPE_DOUBLE );
     137       20622 :         FORMATTER_EXPOSE_CUSTOM_CLASS_CONST( "TYPE_CURRENCY", FORMAT_TYPE_CURRENCY );
     138             : 
     139             :         #undef FORMATTER_EXPOSE_CUSTOM_CLASS_CONST
     140             :         #undef FORMATTER_EXPOSE_CLASS_CONST
     141             :         #undef FORMATTER_EXPOSE_CONST
     142       20622 : }
     143             : /* }}} */
     144             : 
     145             : /*
     146             :  * Local variables:
     147             :  * tab-width: 4
     148             :  * c-basic-offset: 4
     149             :  * End:
     150             :  * vim600: noet sw=4 ts=4 fdm=marker
     151             :  * vim<600: noet sw=4 ts=4
     152             :  */

Generated by: LCOV version 1.10

Generated at Sat, 13 Dec 2014 06:16:14 +0000 (6 days ago)

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