CharacterTypes.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Copyright (c) 2021-2024, Tim Flynn <trflynn89@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/Forward.h>
  8. #include <AK/Optional.h>
  9. #include <AK/StringView.h>
  10. #include <AK/Types.h>
  11. #include <LibUnicode/Forward.h>
  12. namespace Unicode {
  13. Optional<GeneralCategory> general_category_from_string(StringView);
  14. bool code_point_has_general_category(u32 code_point, GeneralCategory general_category);
  15. bool code_point_has_control_general_category(u32 code_point);
  16. bool code_point_has_letter_general_category(u32 code_point);
  17. bool code_point_has_number_general_category(u32 code_point);
  18. bool code_point_has_punctuation_general_category(u32 code_point);
  19. bool code_point_has_separator_general_category(u32 code_point);
  20. bool code_point_has_space_separator_general_category(u32 code_point);
  21. bool code_point_has_symbol_general_category(u32 code_point);
  22. Optional<Property> property_from_string(StringView);
  23. bool code_point_has_property(u32 code_point, Property property);
  24. bool code_point_has_emoji_property(u32 code_point);
  25. bool code_point_has_emoji_modifier_base_property(u32 code_point);
  26. bool code_point_has_emoji_presentation_property(u32 code_point);
  27. bool code_point_has_identifier_start_property(u32 code_point);
  28. bool code_point_has_identifier_continue_property(u32 code_point);
  29. bool code_point_has_regional_indicator_property(u32 code_point);
  30. bool code_point_has_variation_selector_property(u32 code_point);
  31. bool is_ecma262_property(Property);
  32. Optional<Script> script_from_string(StringView);
  33. bool code_point_has_script(u32 code_point, Script script);
  34. bool code_point_has_script_extension(u32 code_point, Script script);
  35. enum class BidiClass {
  36. ArabicNumber, // AN
  37. BlockSeparator, // B
  38. BoundaryNeutral, // BN
  39. CommonNumberSeparator, // CS
  40. DirNonSpacingMark, // NSM
  41. EuropeanNumber, // EN
  42. EuropeanNumberSeparator, // ES
  43. EuropeanNumberTerminator, // ET
  44. FirstStrongIsolate, // FSI
  45. LeftToRight, // L
  46. LeftToRightEmbedding, // LRE
  47. LeftToRightIsolate, // LRI
  48. LeftToRightOverride, // LRO
  49. OtherNeutral, // ON
  50. PopDirectionalFormat, // PDF
  51. PopDirectionalIsolate, // PDI
  52. RightToLeft, // R
  53. RightToLeftArabic, // AL
  54. RightToLeftEmbedding, // RLE
  55. RightToLeftIsolate, // RLI
  56. RightToLeftOverride, // RLO
  57. SegmentSeparator, // S
  58. WhiteSpaceNeutral, // WS
  59. };
  60. BidiClass bidirectional_class(u32 code_point);
  61. }