Collator.hx 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Copyright (C)2005-2020 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.collator.php
  26. **/
  27. @:native("Collator")
  28. extern class Collator {
  29. @:phpClassConst static final ALTERNATE_HANDLING: Int;
  30. @:phpClassConst static final CASE_FIRST: Int;
  31. @:phpClassConst static final CASE_LEVEL: Int;
  32. @:phpClassConst static final DEFAULT_STRENGTH: Int;
  33. @:phpClassConst static final DEFAULT_VALUE: Int;
  34. @:phpClassConst static final FRENCH_COLLATION: Int;
  35. @:phpClassConst static final HIRAGANA_QUATERNARY_MODE: Int;
  36. @:phpClassConst static final IDENTICAL: Int;
  37. @:phpClassConst static final LOWER_FIRST: Int;
  38. @:phpClassConst static final NON_IGNORABLE: Int;
  39. @:phpClassConst static final NORMALIZATION_MODE: Int;
  40. @:phpClassConst static final NUMERIC_COLLATION: Int;
  41. @:phpClassConst static final OFF: Int;
  42. @:phpClassConst static final ON: Int;
  43. @:phpClassConst static final PRIMARY: Int;
  44. @:phpClassConst static final QUATERNARY: Int;
  45. @:phpClassConst static final SECONDARY: Int;
  46. @:phpClassConst static final SHIFTED: Int;
  47. @:phpClassConst static final SORT_NUMERIC: Int;
  48. @:phpClassConst static final SORT_REGULAR: Int;
  49. @:phpClassConst static final SORT_STRING: Int;
  50. @:phpClassConst static final STRENGTH: Int;
  51. @:phpClassConst static final TERTIARY: Int;
  52. @:phpClassConst static final UPPER_FIRST: Int;
  53. function new(locale: String);
  54. function asort(arr: Ref<NativeAssocArray<String>>, ?sort_flag: Int): Bool;
  55. function compare(str1: String, str2: String): EitherType<Int, Bool>;
  56. static function create(locale: String): Null<Collator>;
  57. function getAttribute(attr: Int): EitherType<Int, Bool>;
  58. function getErrorCode(): Int;
  59. function getErrorMessage(): String;
  60. function getLocale(type: Int): EitherType<String, Bool>;
  61. function getSortKey(str: String): EitherType<String, Bool>;
  62. function getStrength(): EitherType<Int, Bool>;
  63. function setAttribute(attr: Int, val: Int): Bool;
  64. function setStrength(strength: Int): Bool;
  65. function sort(arr: Ref<NativeArray>, ?sort_flag: Int): Bool;
  66. function sortWithSortKeys(arr: Ref<NativeArray>): Bool;
  67. }