CharacterTypes.h 2.2 KB

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