UnicodeSymbols.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Copyright (c) 2021, Tim Flynn <trflynn89@pm.me>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/Optional.h>
  8. #include <AK/String.h>
  9. #include <AK/StringView.h>
  10. #include <AK/Types.h>
  11. #include <AK/Vector.h>
  12. #include <LibUnicode/Forward.h>
  13. namespace Unicode::Detail {
  14. struct Symbols {
  15. static Symbols const& ensure_loaded();
  16. // Loaded from UnicodeData.cpp:
  17. Optional<String> (*code_point_display_name)(u32) { nullptr };
  18. u32 (*canonical_combining_class)(u32 code_point) { nullptr };
  19. u32 (*simple_uppercase_mapping)(u32) { nullptr };
  20. u32 (*simple_lowercase_mapping)(u32) { nullptr };
  21. Span<SpecialCasing const* const> (*special_case_mapping)(u32 code_point) { nullptr };
  22. Optional<GeneralCategory> (*general_category_from_string)(StringView) { nullptr };
  23. bool (*code_point_has_general_category)(u32, GeneralCategory) { nullptr };
  24. Optional<Property> (*property_from_string)(StringView) { nullptr };
  25. bool (*code_point_has_property)(u32, Property) { nullptr };
  26. Optional<Script> (*script_from_string)(StringView) { nullptr };
  27. bool (*code_point_has_script)(u32, Script) { nullptr };
  28. bool (*code_point_has_script_extension)(u32, Script) { nullptr };
  29. // Loaded from UnicodeLocale.cpp:
  30. Optional<Locale> (*locale_from_string)(StringView) { nullptr };
  31. Optional<StringView> (*get_locale_language_mapping)(StringView, StringView) { nullptr };
  32. Optional<StringView> (*get_locale_territory_mapping)(StringView, StringView) { nullptr };
  33. Optional<StringView> (*get_locale_script_tag_mapping)(StringView, StringView) { nullptr };
  34. Optional<StringView> (*get_locale_long_currency_mapping)(StringView, StringView) { nullptr };
  35. Optional<StringView> (*get_locale_short_currency_mapping)(StringView, StringView) { nullptr };
  36. Optional<StringView> (*get_locale_narrow_currency_mapping)(StringView, StringView) { nullptr };
  37. Optional<StringView> (*get_locale_numeric_currency_mapping)(StringView, StringView) { nullptr };
  38. Optional<StringView> (*get_locale_key_mapping)(StringView, StringView) { nullptr };
  39. Optional<ListPatterns> (*get_locale_list_pattern_mapping)(StringView, StringView, StringView) { nullptr };
  40. Optional<StringView> (*resolve_language_alias)(StringView) { nullptr };
  41. Optional<StringView> (*resolve_territory_alias)(StringView) { nullptr };
  42. Optional<StringView> (*resolve_script_tag_alias)(StringView) { nullptr };
  43. Optional<StringView> (*resolve_variant_alias)(StringView) { nullptr };
  44. Optional<StringView> (*resolve_subdivision_alias)(StringView) { nullptr };
  45. void (*resolve_complex_language_aliases)(LanguageID&);
  46. Optional<LanguageID> (*add_likely_subtags)(LanguageID const&);
  47. Optional<String> (*resolve_most_likely_territory)(LanguageID const&);
  48. private:
  49. Symbols() = default;
  50. };
  51. }