NumberFormatter.hx 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /*
  2. * Copyright (C)2005-2021 Haxe Foundation
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  20. * DEALINGS IN THE SOFTWARE.
  21. */
  22. package php;
  23. import haxe.extern.EitherType;
  24. /**
  25. @see https://www.php.net/manual/en/class.numberformatter.php
  26. **/
  27. @:native("NumberFormatter")
  28. extern class NumberFormatter {
  29. @:phpClassConst static final CURRENCY: Int;
  30. @:phpClassConst static final CURRENCY_ACCOUNTING: Int;
  31. @:phpClassConst static final CURRENCY_CODE: Int;
  32. @:phpClassConst static final CURRENCY_SYMBOL: Int;
  33. @:phpClassConst static final DECIMAL: Int;
  34. @:phpClassConst static final DECIMAL_ALWAYS_SHOWN: Int;
  35. @:phpClassConst static final DECIMAL_SEPARATOR_SYMBOL: Int;
  36. @:phpClassConst static final DEFAULT_RULESET: Int;
  37. @:phpClassConst static final DEFAULT_STYLE: Int;
  38. @:phpClassConst static final DIGIT_SYMBOL: Int;
  39. @:phpClassConst static final DURATION: Int;
  40. @:phpClassConst static final EXPONENTIAL_SYMBOL: Int;
  41. @:phpClassConst static final FORMAT_WIDTH: Int;
  42. @:phpClassConst static final FRACTION_DIGITS: Int;
  43. @:phpClassConst static final GROUPING_SEPARATOR_SYMBOL: Int;
  44. @:phpClassConst static final GROUPING_SIZE: Int;
  45. @:phpClassConst static final GROUPING_USED: Int;
  46. @:phpClassConst static final IGNORE: Int;
  47. @:phpClassConst static final INFINITY_SYMBOL: Int;
  48. @:phpClassConst static final INTEGER_DIGITS: Int;
  49. @:phpClassConst static final INTL_CURRENCY_SYMBOL: Int;
  50. @:phpClassConst static final LENIENT_PARSE: Int;
  51. @:phpClassConst static final MAX_FRACTION_DIGITS: Int;
  52. @:phpClassConst static final MAX_INTEGER_DIGITS: Int;
  53. @:phpClassConst static final MAX_SIGNIFICANT_DIGITS: Int;
  54. @:phpClassConst static final MIN_FRACTION_DIGITS: Int;
  55. @:phpClassConst static final MIN_INTEGER_DIGITS: Int;
  56. @:phpClassConst static final MIN_SIGNIFICANT_DIGITS: Int;
  57. @:phpClassConst static final MINUS_SIGN_SYMBOL: Int;
  58. @:phpClassConst static final MONETARY_GROUPING_SEPARATOR_SYMBOL: Int;
  59. @:phpClassConst static final MONETARY_SEPARATOR_SYMBOL: Int;
  60. @:phpClassConst static final MULTIPLIER: Int;
  61. @:phpClassConst static final NAN_SYMBOL: Int;
  62. @:phpClassConst static final NEGATIVE_PREFIX: Int;
  63. @:phpClassConst static final NEGATIVE_SUFFIX: Int;
  64. @:phpClassConst static final ORDINAL: Int;
  65. @:phpClassConst static final PAD_AFTER_PREFIX: Int;
  66. @:phpClassConst static final PAD_AFTER_SUFFIX: Int;
  67. @:phpClassConst static final PAD_BEFORE_PREFIX: Int;
  68. @:phpClassConst static final PAD_BEFORE_SUFFIX: Int;
  69. @:phpClassConst static final PAD_ESCAPE_SYMBOL: Int;
  70. @:phpClassConst static final PADDING_CHARACTER: Int;
  71. @:phpClassConst static final PADDING_POSITION: Int;
  72. @:phpClassConst static final PARSE_INT_ONLY: Int;
  73. @:phpClassConst static final PATTERN_DECIMAL: Int;
  74. @:phpClassConst static final PATTERN_RULEBASED: Int;
  75. @:phpClassConst static final PATTERN_SEPARATOR_SYMBOL: Int;
  76. @:phpClassConst static final PERCENT: Int;
  77. @:phpClassConst static final PERCENT_SYMBOL: Int;
  78. @:phpClassConst static final PERMILL_SYMBOL: Int;
  79. @:phpClassConst static final PLUS_SIGN_SYMBOL: Int;
  80. @:phpClassConst static final POSITIVE_PREFIX: Int;
  81. @:phpClassConst static final POSITIVE_SUFFIX: Int;
  82. @:phpClassConst static final PUBLIC_RULESETS: Int;
  83. @:phpClassConst static final ROUND_CEILING: Int;
  84. @:phpClassConst static final ROUND_DOWN: Int;
  85. @:phpClassConst static final ROUND_FLOOR: Int;
  86. @:phpClassConst static final ROUND_HALFDOWN: Int;
  87. @:phpClassConst static final ROUND_HALFEVEN: Int;
  88. @:phpClassConst static final ROUND_HALFUP: Int;
  89. @:phpClassConst static final ROUND_UP: Int;
  90. @:phpClassConst static final ROUNDING_INCREMENT: Int;
  91. @:phpClassConst static final ROUNDING_MODE: Int;
  92. @:phpClassConst static final SCIENTIFIC: Int;
  93. @:phpClassConst static final SECONDARY_GROUPING_SIZE: Int;
  94. @:phpClassConst static final SIGNIFICANT_DIGIT_SYMBOL: Int;
  95. @:phpClassConst static final SIGNIFICANT_DIGITS_USED: Int;
  96. @:phpClassConst static final SPELLOUT: Int;
  97. @:phpClassConst static final TYPE_CURRENCY: Int;
  98. @:phpClassConst static final TYPE_DEFAULT: Int;
  99. @:phpClassConst static final TYPE_DOUBLE: Int;
  100. @:phpClassConst static final TYPE_INT32: Int;
  101. @:phpClassConst static final TYPE_INT64: Int;
  102. @:phpClassConst static final ZERO_DIGIT_SYMBOL: Int;
  103. function new(locale: String, style: Int, ?pattern: String);
  104. static function create(locale: String, style: Int, ?pattern: String): EitherType<NumberFormatter, Bool>;
  105. function formatCurrency(value: Float, currency: String): EitherType<String, Bool>;
  106. function format(value: EitherType<Int, Float>, ?type: Int): EitherType<String, Bool>;
  107. function getAttribute(attr: Int): EitherType<Int, Bool>;
  108. function getErrorCode(): Int;
  109. function getErrorMessage(): String;
  110. function getLocale(?type: Int): String;
  111. function getPattern(): EitherType<String, Bool>;
  112. function getSymbol(attr: Int): EitherType<String, Bool>;
  113. function getTextAttribute(attr: Int): EitherType<String, Bool>;
  114. function parseCurrency(value: String, currency: Ref<String>, ?position: Ref<Int>): EitherType<Float, Bool>;
  115. function parse(value: String, ?type: Int, ?position: Ref<Int>): EitherType<Int, EitherType<Float, EitherType<String, Bool>>>;
  116. function setAttribute(attr: Int, value: Int): Bool;
  117. function setPattern(pattern: String): Bool;
  118. function setSymbol(attr: Int, value: String): Bool;
  119. function setTextAttribute(attr: Int, value: String): Bool;
  120. }