#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/platform/text/platform_locale.h"
#include <memory>
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/strings/grit/blink_strings.h"
#include "third_party/blink/renderer/platform/text/date_time_format.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
#include "third_party/blink/renderer/platform/wtf/wtf.h"
namespace blink {
namespace {
Locale* g_default_locale;
}
class DateTimeStringBuilder : private DateTimeFormat::TokenHandler { … };
DateTimeStringBuilder::DateTimeStringBuilder(Locale& localizer,
const DateComponents& date)
: … { … }
bool DateTimeStringBuilder::Build(const String& format_string) { … }
String DateTimeStringBuilder::ZeroPadString(const String& string,
size_t pad_width) { … }
void DateTimeStringBuilder::AppendNumber(int number, size_t width) { … }
void DateTimeStringBuilder::VisitField(DateTimeFormat::FieldType field_type,
int number_of_pattern_characters) { … }
void DateTimeStringBuilder::VisitLiteral(const String& text) { … }
String DateTimeStringBuilder::ToString() { … }
Locale& Locale::DefaultLocale() { … }
void Locale::ResetDefaultLocale() { … }
Locale::~Locale() = default;
String Locale::QueryString(int resource_id) { … }
String Locale::QueryString(int resource_id, const String& parameter) { … }
String Locale::QueryString(int resource_id,
const String& parameter1,
const String& parameter2) { … }
String Locale::ValidationMessageTooLongText(unsigned value_length,
int max_length) { … }
String Locale::ValidationMessageTooShortText(unsigned value_length,
int min_length) { … }
String Locale::WeekFormatInLDML() { … }
void Locale::SetLocaleData(const Vector<String, kDecimalSymbolsSize>& symbols,
const String& positive_prefix,
const String& positive_suffix,
const String& negative_prefix,
const String& negative_suffix) { … }
String Locale::ConvertToLocalizedNumber(const String& input) { … }
static bool Matches(const String& text, unsigned position, const String& part) { … }
bool Locale::DetectSignAndGetDigitRange(const String& input,
bool& is_negative,
unsigned& start_index,
unsigned& end_index) { … }
unsigned Locale::MatchedDecimalSymbolIndex(const String& input,
unsigned& position) { … }
String Locale::ConvertFromLocalizedNumber(const String& localized) { … }
String Locale::StripInvalidNumberCharacters(const String& input,
const String& standard_chars) { … }
String Locale::LocalizedDecimalSeparator() { … }
bool Locale::UsesSingleCharNumberFiltering() { … }
static bool IsE(UChar ch) { … }
bool Locale::IsSignPrefix(UChar ch) { … }
bool Locale::HasTwoSignChars(const String& str) { … }
bool Locale::HasSignNotAfterE(const String& str) { … }
bool Locale::IsDigit(UChar ch) { … }
bool Locale::IsDecimalSeparator(UChar ch) { … }
bool Locale::HasDecimalSeparator(const String& str) { … }
String Locale::FormatDateTime(const DateComponents& date,
FormatType format_type) { … }
}