summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2022-01-30 16:51:29 -0500
committerLinus Groh <mail@linusgroh.de>2022-01-31 00:32:41 +0000
commitbb0f548614ba1b788a2d9f3e5ce7d99d3228e3be (patch)
treeb8d3f95dbad68cc26d003b053a6e2b3c170ead13
parent481ced53d85444280039ec9c33834eb98f16a5b6 (diff)
downloadserenity-bb0f548614ba1b788a2d9f3e5ce7d99d3228e3be.zip
LibUnicode: Generate a list of available currencies
-rw-r--r--Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeLocale.cpp3
-rw-r--r--Userland/Libraries/LibUnicode/CurrencyCode.cpp2
-rw-r--r--Userland/Libraries/LibUnicode/CurrencyCode.h2
3 files changed, 7 insertions, 0 deletions
diff --git a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeLocale.cpp b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeLocale.cpp
index 8369ce8169..43bfce94d2 100644
--- a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeLocale.cpp
+++ b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeLocale.cpp
@@ -986,6 +986,7 @@ static void generate_unicode_locale_implementation(Core::File& file, UnicodeLoca
#include <AK/Span.h>
#include <AK/StringView.h>
#include <AK/Vector.h>
+#include <LibUnicode/CurrencyCode.h>
#include <LibUnicode/Locale.h>
#include <LibUnicode/UnicodeLocale.h>
@@ -1019,6 +1020,8 @@ struct Patterns {
};
)~~~");
+ generate_available_values(generator, "get_available_currencies"sv, locale_data.currencies);
+
locale_data.unique_display_patterns.generate(generator, "DisplayPatternImpl"sv, "s_display_patterns"sv, 30);
locale_data.unique_language_lists.generate(generator, s_string_index_type, "s_language_lists"sv);
locale_data.unique_territory_lists.generate(generator, s_string_index_type, "s_territory_lists"sv);
diff --git a/Userland/Libraries/LibUnicode/CurrencyCode.cpp b/Userland/Libraries/LibUnicode/CurrencyCode.cpp
index e19cf8da49..cdbf4af44f 100644
--- a/Userland/Libraries/LibUnicode/CurrencyCode.cpp
+++ b/Userland/Libraries/LibUnicode/CurrencyCode.cpp
@@ -203,4 +203,6 @@ Optional<CurrencyCode> get_currency_code(StringView currency)
return currency_codes.get(currency);
}
+Span<StringView const> __attribute__((weak)) get_available_currencies() { return {}; }
+
}
diff --git a/Userland/Libraries/LibUnicode/CurrencyCode.h b/Userland/Libraries/LibUnicode/CurrencyCode.h
index 1eb831e701..773eb54616 100644
--- a/Userland/Libraries/LibUnicode/CurrencyCode.h
+++ b/Userland/Libraries/LibUnicode/CurrencyCode.h
@@ -8,6 +8,7 @@
#include <AK/HashMap.h>
#include <AK/Optional.h>
+#include <AK/Span.h>
#include <AK/StringView.h>
namespace Unicode {
@@ -17,5 +18,6 @@ struct CurrencyCode {
};
Optional<CurrencyCode> get_currency_code(StringView currency);
+Span<StringView const> get_available_currencies();
}