CharacterTypes.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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_is_printable(u32 code_point);
  16. bool code_point_has_control_general_category(u32 code_point);
  17. bool code_point_has_letter_general_category(u32 code_point);
  18. bool code_point_has_number_general_category(u32 code_point);
  19. bool code_point_has_punctuation_general_category(u32 code_point);
  20. bool code_point_has_separator_general_category(u32 code_point);
  21. bool code_point_has_space_separator_general_category(u32 code_point);
  22. bool code_point_has_symbol_general_category(u32 code_point);
  23. Optional<Property> property_from_string(StringView);
  24. bool code_point_has_property(u32 code_point, Property property);
  25. bool code_point_has_emoji_property(u32 code_point);
  26. bool code_point_has_emoji_modifier_base_property(u32 code_point);
  27. bool code_point_has_emoji_presentation_property(u32 code_point);
  28. bool code_point_has_identifier_start_property(u32 code_point);
  29. bool code_point_has_identifier_continue_property(u32 code_point);
  30. bool code_point_has_regional_indicator_property(u32 code_point);
  31. bool code_point_has_variation_selector_property(u32 code_point);
  32. bool is_ecma262_property(Property);
  33. Optional<Script> script_from_string(StringView);
  34. bool code_point_has_script(u32 code_point, Script script);
  35. bool code_point_has_script_extension(u32 code_point, Script script);
  36. enum class BidiClass {
  37. ArabicNumber, // AN
  38. BlockSeparator, // B
  39. BoundaryNeutral, // BN
  40. CommonNumberSeparator, // CS
  41. DirNonSpacingMark, // NSM
  42. EuropeanNumber, // EN
  43. EuropeanNumberSeparator, // ES
  44. EuropeanNumberTerminator, // ET
  45. FirstStrongIsolate, // FSI
  46. LeftToRight, // L
  47. LeftToRightEmbedding, // LRE
  48. LeftToRightIsolate, // LRI
  49. LeftToRightOverride, // LRO
  50. OtherNeutral, // ON
  51. PopDirectionalFormat, // PDF
  52. PopDirectionalIsolate, // PDI
  53. RightToLeft, // R
  54. RightToLeftArabic, // AL
  55. RightToLeftEmbedding, // RLE
  56. RightToLeftIsolate, // RLI
  57. RightToLeftOverride, // RLO
  58. SegmentSeparator, // S
  59. WhiteSpaceNeutral, // WS
  60. };
  61. BidiClass bidirectional_class(u32 code_point);
  62. }