mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 20:29:18 +00:00
Everywhere: Hoist the Libraries folder to the top-level
This commit is contained in:
parent
950e819ee7
commit
93712b24bf
Notes:
github-actions[bot]
2024-11-10 11:51:52 +00:00
Author: https://github.com/trflynn89
Commit: 93712b24bf
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2256
Reviewed-by: https://github.com/sideshowbarker
4547 changed files with 104 additions and 113 deletions
57
Libraries/LibUnicode/RelativeTimeFormat.h
Normal file
57
Libraries/LibUnicode/RelativeTimeFormat.h
Normal file
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* Copyright (c) 2022-2024, Tim Flynn <trflynn89@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/NonnullOwnPtr.h>
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibUnicode/Forward.h>
|
||||
|
||||
namespace Unicode {
|
||||
|
||||
// These are just the subset of fields in the CLDR required for ECMA-402.
|
||||
enum class TimeUnit {
|
||||
Second,
|
||||
Minute,
|
||||
Hour,
|
||||
Day,
|
||||
Week,
|
||||
Month,
|
||||
Quarter,
|
||||
Year,
|
||||
};
|
||||
Optional<TimeUnit> time_unit_from_string(StringView);
|
||||
StringView time_unit_to_string(TimeUnit);
|
||||
|
||||
enum class NumericDisplay {
|
||||
Always,
|
||||
Auto,
|
||||
};
|
||||
NumericDisplay numeric_display_from_string(StringView);
|
||||
StringView numeric_display_to_string(NumericDisplay);
|
||||
|
||||
class RelativeTimeFormat {
|
||||
public:
|
||||
static NonnullOwnPtr<RelativeTimeFormat> create(StringView locale, Style style);
|
||||
virtual ~RelativeTimeFormat() = default;
|
||||
|
||||
struct Partition {
|
||||
StringView type;
|
||||
String value;
|
||||
StringView unit;
|
||||
};
|
||||
|
||||
virtual String format(double, TimeUnit, NumericDisplay) const = 0;
|
||||
virtual Vector<Partition> format_to_parts(double, TimeUnit, NumericDisplay) const = 0;
|
||||
|
||||
protected:
|
||||
RelativeTimeFormat() = default;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue