-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to copying ICU4X Dart files (#860)
* Switch to copying ICU4X files instead of using symlinks * Switch files to copies * Switch to Dart fix branch * Use dart format * Format files * Add changelog entry * Add flags to building libraries * Add gitattributes * Add newline
- Loading branch information
Showing
129 changed files
with
14,497 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pkgs/intl4x/lib/src/bindings linguist-generated=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
## 0.9.2-wip | ||
|
||
- Copy files instead of symlinking, for easier upgrading. | ||
|
||
## 0.9.1 | ||
|
||
- Small fixes in imports | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
// generated by diplomat-tool | ||
|
||
part of 'lib.g.dart'; | ||
|
||
/// The various calendar types currently supported by [`Calendar`] | ||
/// | ||
/// See the [Rust documentation for `AnyCalendarKind`](https://docs.rs/icu/latest/icu/calendar/enum.AnyCalendarKind.html) for more information. | ||
enum AnyCalendarKind { | ||
/// The kind of an Iso calendar | ||
iso, | ||
|
||
/// The kind of a Gregorian calendar | ||
gregorian, | ||
|
||
/// The kind of a Buddhist calendar | ||
buddhist, | ||
|
||
/// The kind of a Japanese calendar with modern eras | ||
japanese, | ||
|
||
/// The kind of a Japanese calendar with modern and historic eras | ||
japaneseExtended, | ||
|
||
/// The kind of an Ethiopian calendar, with Amete Mihret era | ||
ethiopian, | ||
|
||
/// The kind of an Ethiopian calendar, with Amete Alem era | ||
ethiopianAmeteAlem, | ||
|
||
/// The kind of a Indian calendar | ||
indian, | ||
|
||
/// The kind of a Coptic calendar | ||
coptic, | ||
|
||
/// The kind of a Dangi calendar | ||
dangi, | ||
|
||
/// The kind of a Chinese calendar | ||
chinese, | ||
|
||
/// The kind of a Hebrew calendar | ||
hebrew, | ||
|
||
/// The kind of a Islamic civil calendar | ||
islamicCivil, | ||
|
||
/// The kind of a Islamic observational calendar | ||
islamicObservational, | ||
|
||
/// The kind of a Islamic tabular calendar | ||
islamicTabular, | ||
|
||
/// The kind of a Islamic Umm al-Qura calendar | ||
islamicUmmAlQura, | ||
|
||
/// The kind of a Persian calendar | ||
persian, | ||
|
||
/// The kind of a Roc calendar | ||
roc; | ||
|
||
/// Read the calendar type off of the -u-ca- extension on a locale. | ||
/// | ||
/// Returns nothing if there is no calendar on the locale or if the locale's calendar | ||
/// is not known or supported. | ||
/// | ||
/// See the [Rust documentation for `get_for_locale`](https://docs.rs/icu/latest/icu/calendar/enum.AnyCalendarKind.html#method.get_for_locale) for more information. | ||
static AnyCalendarKind? getForLocale(Locale locale) { | ||
final result = _ICU4XAnyCalendarKind_get_for_locale(locale._ffi); | ||
if (!result.isOk) { | ||
return null; | ||
} | ||
return AnyCalendarKind.values[result.union.ok]; | ||
} | ||
|
||
/// Obtain the calendar type given a BCP-47 -u-ca- extension string. | ||
/// | ||
/// Returns nothing if the calendar is not known or supported. | ||
/// | ||
/// See the [Rust documentation for `get_for_bcp47_value`](https://docs.rs/icu/latest/icu/calendar/enum.AnyCalendarKind.html#method.get_for_bcp47_value) for more information. | ||
static AnyCalendarKind? getForBcp47(String s) { | ||
final temp = ffi2.Arena(); | ||
final sView = s.utf8View; | ||
final result = | ||
_ICU4XAnyCalendarKind_get_for_bcp47(sView.allocIn(temp), sView.length); | ||
temp.releaseAll(); | ||
if (!result.isOk) { | ||
return null; | ||
} | ||
return AnyCalendarKind.values[result.union.ok]; | ||
} | ||
|
||
/// Obtain the string suitable for use in the -u-ca- extension in a BCP47 locale. | ||
/// | ||
/// See the [Rust documentation for `as_bcp47_string`](https://docs.rs/icu/latest/icu/calendar/enum.AnyCalendarKind.html#method.as_bcp47_string) for more information. | ||
/// | ||
/// Throws [Error] on failure. | ||
String get bcp47 { | ||
final writeable = _Writeable(); | ||
final result = _ICU4XAnyCalendarKind_bcp47(index, writeable._ffi); | ||
if (!result.isOk) { | ||
throw Error.values.firstWhere((v) => v._ffi == result.union.err); | ||
} | ||
return writeable.finalize(); | ||
} | ||
} | ||
|
||
@meta.ResourceIdentifier('ICU4XAnyCalendarKind_get_for_locale') | ||
@ffi.Native<_ResultInt32Void Function(ffi.Pointer<ffi.Opaque>)>( | ||
isLeaf: true, symbol: 'ICU4XAnyCalendarKind_get_for_locale') | ||
// ignore: non_constant_identifier_names | ||
external _ResultInt32Void _ICU4XAnyCalendarKind_get_for_locale( | ||
ffi.Pointer<ffi.Opaque> locale); | ||
|
||
@meta.ResourceIdentifier('ICU4XAnyCalendarKind_get_for_bcp47') | ||
@ffi.Native<_ResultInt32Void Function(ffi.Pointer<ffi.Uint8>, ffi.Size)>( | ||
isLeaf: true, symbol: 'ICU4XAnyCalendarKind_get_for_bcp47') | ||
// ignore: non_constant_identifier_names | ||
external _ResultInt32Void _ICU4XAnyCalendarKind_get_for_bcp47( | ||
ffi.Pointer<ffi.Uint8> sData, int sLength); | ||
|
||
@meta.ResourceIdentifier('ICU4XAnyCalendarKind_bcp47') | ||
@ffi.Native<_ResultVoidInt32 Function(ffi.Int32, ffi.Pointer<ffi.Opaque>)>( | ||
isLeaf: true, symbol: 'ICU4XAnyCalendarKind_bcp47') | ||
// ignore: non_constant_identifier_names | ||
external _ResultVoidInt32 _ICU4XAnyCalendarKind_bcp47( | ||
int self, ffi.Pointer<ffi.Opaque> writeable); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
// generated by diplomat-tool | ||
|
||
part of 'lib.g.dart'; | ||
|
||
/// An object capable of mapping from a BCP-47 time zone ID to an IANA ID. | ||
/// | ||
/// See the [Rust documentation for `IanaBcp47RoundTripMapper`](https://docs.rs/icu/latest/icu/timezone/struct.IanaBcp47RoundTripMapper.html) for more information. | ||
final class Bcp47ToIanaMapper implements ffi.Finalizable { | ||
final ffi.Pointer<ffi.Opaque> _ffi; | ||
|
||
// These are "used" in the sense that they keep dependencies alive | ||
// ignore: unused_field | ||
final core.List<Object> _selfEdge; | ||
|
||
// This takes in a list of lifetime edges (including for &self borrows) | ||
// corresponding to data this may borrow from. These should be flat arrays containing | ||
// references to objects, and this object will hold on to them to keep them alive and | ||
// maintain borrow validity. | ||
Bcp47ToIanaMapper._fromFfi(this._ffi, this._selfEdge) { | ||
if (_selfEdge.isEmpty) { | ||
_finalizer.attach(this, _ffi.cast()); | ||
} | ||
} | ||
|
||
static final _finalizer = ffi.NativeFinalizer( | ||
ffi.Native.addressOf(_ICU4XBcp47ToIanaMapper_destroy)); | ||
|
||
/// See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/timezone/struct.IanaBcp47RoundTripMapper.html#method.new) for more information. | ||
/// | ||
/// Throws [Error] on failure. | ||
factory Bcp47ToIanaMapper(DataProvider provider) { | ||
final result = _ICU4XBcp47ToIanaMapper_create(provider._ffi); | ||
if (!result.isOk) { | ||
throw Error.values.firstWhere((v) => v._ffi == result.union.err); | ||
} | ||
return Bcp47ToIanaMapper._fromFfi(result.union.ok, []); | ||
} | ||
|
||
/// Writes out the canonical IANA time zone ID corresponding to the given BCP-47 ID. | ||
/// | ||
/// See the [Rust documentation for `bcp47_to_iana`](https://docs.rs/icu/latest/icu/timezone/struct.IanaBcp47RoundTripMapperBorrowed.html#method.bcp47_to_iana) for more information. | ||
/// | ||
/// Throws [Error] on failure. | ||
String operator [](String value) { | ||
final temp = ffi2.Arena(); | ||
final valueView = value.utf8View; | ||
final writeable = _Writeable(); | ||
final result = _ICU4XBcp47ToIanaMapper_get( | ||
_ffi, valueView.allocIn(temp), valueView.length, writeable._ffi); | ||
temp.releaseAll(); | ||
if (!result.isOk) { | ||
throw Error.values.firstWhere((v) => v._ffi == result.union.err); | ||
} | ||
return writeable.finalize(); | ||
} | ||
} | ||
|
||
@meta.ResourceIdentifier('ICU4XBcp47ToIanaMapper_destroy') | ||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>)>( | ||
isLeaf: true, symbol: 'ICU4XBcp47ToIanaMapper_destroy') | ||
// ignore: non_constant_identifier_names | ||
external void _ICU4XBcp47ToIanaMapper_destroy(ffi.Pointer<ffi.Void> self); | ||
|
||
@meta.ResourceIdentifier('ICU4XBcp47ToIanaMapper_create') | ||
@ffi.Native<_ResultOpaqueInt32 Function(ffi.Pointer<ffi.Opaque>)>( | ||
isLeaf: true, symbol: 'ICU4XBcp47ToIanaMapper_create') | ||
// ignore: non_constant_identifier_names | ||
external _ResultOpaqueInt32 _ICU4XBcp47ToIanaMapper_create( | ||
ffi.Pointer<ffi.Opaque> provider); | ||
|
||
@meta.ResourceIdentifier('ICU4XBcp47ToIanaMapper_get') | ||
@ffi.Native< | ||
_ResultVoidInt32 Function(ffi.Pointer<ffi.Opaque>, | ||
ffi.Pointer<ffi.Uint8>, ffi.Size, ffi.Pointer<ffi.Opaque>)>( | ||
isLeaf: true, symbol: 'ICU4XBcp47ToIanaMapper_get') | ||
// ignore: non_constant_identifier_names | ||
external _ResultVoidInt32 _ICU4XBcp47ToIanaMapper_get( | ||
ffi.Pointer<ffi.Opaque> self, | ||
ffi.Pointer<ffi.Uint8> valueData, | ||
int valueLength, | ||
ffi.Pointer<ffi.Opaque> writeable); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.