react-native-nitro-input 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +87 -0
- package/README.md +132 -2
- package/android/CMakeLists.txt +4 -0
- package/android/gradle.properties +1 -1
- package/android/src/main/cpp/JReflowEngine.cpp +32 -0
- package/android/src/main/cpp/JReflowEngine.hpp +13 -0
- package/android/src/main/cpp/JRollingEngine.cpp +43 -2
- package/android/src/main/cpp/JRollingEngine.hpp +9 -1
- package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroInputView.kt +20 -0
- package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroNumberFormatPlatform.kt +284 -0
- package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroNumberView.kt +113 -0
- package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroTextMeasure.kt +25 -0
- package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroTextView.kt +140 -0
- package/android/src/main/java/com/margelo/nitro/nitroinput/NitroInputPackage.kt +2 -1
- package/android/src/main/java/com/margelo/nitro/nitroinput/NitroInputView.kt +69 -10
- package/android/src/main/java/com/margelo/nitro/nitroinput/NitroNumberView.kt +522 -130
- package/android/src/main/java/com/margelo/nitro/nitroinput/NitroTextView.kt +868 -0
- package/android/src/main/java/com/margelo/nitro/nitroinput/ReflowEngine.kt +21 -0
- package/android/src/main/java/com/margelo/nitro/nitroinput/RollingEngine.kt +14 -2
- package/cpp/RollingEngine.cpp +102 -8
- package/cpp/RollingEngine.hpp +44 -3
- package/cpp/numberformat/HybridNitroNumberFormat.cpp +498 -0
- package/cpp/numberformat/HybridNitroNumberFormat.hpp +74 -0
- package/cpp/numberformat/HybridNitroNumberFormatFactory.hpp +11 -0
- package/cpp/numberformat/NumberFormatCore.cpp +629 -0
- package/cpp/numberformat/NumberFormatCore.hpp +154 -0
- package/cpp/numberformat/NumberFormatProbe.cpp +354 -0
- package/cpp/numberformat/NumberFormatProbe.hpp +63 -0
- package/ios/HybridNitroInputView.swift +15 -0
- package/ios/HybridNitroNumberFormatPlatform.swift +426 -0
- package/ios/HybridNitroNumberView.swift +101 -1
- package/ios/HybridNitroTextView.swift +134 -0
- package/ios/NitroInputView.swift +79 -19
- package/ios/NitroNumberView.swift +520 -147
- package/ios/NitroTextView.swift +583 -0
- package/lib/commonjs/nitrogen/generated/shared/json/NitroInputViewConfig.json +5 -0
- package/lib/commonjs/nitrogen/generated/shared/json/NitroNumberViewConfig.json +26 -0
- package/lib/commonjs/nitrogen/generated/shared/json/NitroTextViewConfig.json +30 -0
- package/lib/commonjs/src/NitroInput.js +8 -6
- package/lib/commonjs/src/NitroNumber.js +54 -3
- package/lib/commonjs/src/NitroText.js +138 -0
- package/lib/commonjs/src/NitroTime.js +65 -0
- package/lib/commonjs/src/NumberFormat.js +525 -0
- package/lib/commonjs/src/formatProps.js +108 -0
- package/lib/commonjs/src/index.js +8 -1
- package/lib/commonjs/src/specs/NitroText.nitro.js +2 -0
- package/lib/commonjs/src/specs/NumberFormat.nitro.js +2 -0
- package/lib/module/nitrogen/generated/shared/json/NitroInputViewConfig.json +5 -0
- package/lib/module/nitrogen/generated/shared/json/NitroNumberViewConfig.json +26 -0
- package/lib/module/nitrogen/generated/shared/json/NitroTextViewConfig.json +30 -0
- package/lib/module/src/NitroInput.js +8 -6
- package/lib/module/src/NitroNumber.js +54 -3
- package/lib/module/src/NitroText.js +98 -0
- package/lib/module/src/NitroTime.js +29 -0
- package/lib/module/src/NumberFormat.js +521 -0
- package/lib/module/src/formatProps.js +104 -0
- package/lib/module/src/index.js +3 -0
- package/lib/module/src/specs/NitroText.nitro.js +1 -0
- package/lib/module/src/specs/NumberFormat.nitro.js +1 -0
- package/lib/typescript/src/NitroInput.d.ts +22 -0
- package/lib/typescript/src/NitroNumber.d.ts +115 -2
- package/lib/typescript/src/NitroText.d.ts +67 -0
- package/lib/typescript/src/NitroTime.d.ts +19 -0
- package/lib/typescript/src/NumberFormat.d.ts +47 -0
- package/lib/typescript/src/formatProps.d.ts +47 -0
- package/lib/typescript/src/index.d.ts +6 -1
- package/lib/typescript/src/specs/NitroInput.nitro.d.ts +10 -0
- package/lib/typescript/src/specs/NitroNumber.nitro.d.ts +80 -1
- package/lib/typescript/src/specs/NitroText.nitro.d.ts +60 -0
- package/lib/typescript/src/specs/NumberFormat.nitro.d.ts +139 -0
- package/nitro.json +36 -0
- package/nitrogen/generated/android/NitroInput+autolinking.cmake +12 -0
- package/nitrogen/generated/android/NitroInputOnLoad.cpp +62 -0
- package/nitrogen/generated/android/c++/JHybridNitroInputViewSpec.cpp +45 -0
- package/nitrogen/generated/android/c++/JHybridNitroInputViewSpec.hpp +10 -0
- package/nitrogen/generated/android/c++/JHybridNitroNumberFormatPlatformSpec.cpp +118 -0
- package/nitrogen/generated/android/c++/JHybridNitroNumberFormatPlatformSpec.hpp +64 -0
- package/nitrogen/generated/android/c++/JHybridNitroNumberViewSpec.cpp +297 -0
- package/nitrogen/generated/android/c++/JHybridNitroNumberViewSpec.hpp +52 -0
- package/nitrogen/generated/android/c++/JHybridNitroPlatformNumberFormatterSpec.cpp +65 -0
- package/nitrogen/generated/android/c++/JHybridNitroPlatformNumberFormatterSpec.hpp +64 -0
- package/nitrogen/generated/android/c++/JHybridNitroTextMeasureSpec.cpp +58 -0
- package/nitrogen/generated/android/c++/JHybridNitroTextMeasureSpec.hpp +64 -0
- package/nitrogen/generated/android/c++/JHybridNitroTextViewSpec.cpp +253 -0
- package/nitrogen/generated/android/c++/JHybridNitroTextViewSpec.hpp +104 -0
- package/nitrogen/generated/android/c++/JNitroNumberDirection.hpp +3 -0
- package/nitrogen/generated/android/c++/JNitroNumberShimmerDirection.hpp +61 -0
- package/nitrogen/generated/android/c++/JNitroNumberSignDisplay.hpp +67 -0
- package/nitrogen/generated/android/c++/JNumberFormatCompactDisplay.hpp +58 -0
- package/nitrogen/generated/android/c++/JNumberFormatCurrencyDisplay.hpp +64 -0
- package/nitrogen/generated/android/c++/JNumberFormatCurrencySign.hpp +58 -0
- package/nitrogen/generated/android/c++/JNumberFormatNotation.hpp +64 -0
- package/nitrogen/generated/android/c++/JNumberFormatPlatformOptions.hpp +161 -0
- package/nitrogen/generated/android/c++/JNumberFormatPlatformSymbols.hpp +89 -0
- package/nitrogen/generated/android/c++/JNumberFormatRoundingMode.hpp +79 -0
- package/nitrogen/generated/android/c++/JNumberFormatSignDisplay.hpp +67 -0
- package/nitrogen/generated/android/c++/JNumberFormatStyle.hpp +64 -0
- package/nitrogen/generated/android/c++/JNumberFormatUnitDisplay.hpp +61 -0
- package/nitrogen/generated/android/c++/views/JHybridNitroInputViewStateUpdater.cpp +25 -0
- package/nitrogen/generated/android/c++/views/JHybridNitroNumberViewStateUpdater.cpp +130 -0
- package/nitrogen/generated/android/c++/views/JHybridNitroTextViewStateUpdater.cpp +174 -0
- package/nitrogen/generated/android/c++/views/JHybridNitroTextViewStateUpdater.hpp +54 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroInputViewSpec.kt +30 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroNumberFormatPlatformSpec.kt +60 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroNumberViewSpec.kt +172 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroPlatformNumberFormatterSpec.kt +62 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroTextMeasureSpec.kt +60 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroTextViewSpec.kt +179 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberDirection.kt +2 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberShimmerDirection.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberSignDisplay.kt +26 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatCompactDisplay.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatCurrencyDisplay.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatCurrencySign.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatNotation.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatPlatformOptions.kt +136 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatPlatformSymbols.kt +91 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatRoundingMode.kt +30 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatSignDisplay.kt +26 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatStyle.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatUnitDisplay.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/views/HybridNitroTextViewManager.kt +96 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/views/HybridNitroTextViewStateUpdater.kt +23 -0
- package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Bridge.cpp +68 -0
- package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Bridge.hpp +184 -0
- package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Umbrella.hpp +56 -0
- package/nitrogen/generated/ios/NitroInputAutolinking.mm +34 -0
- package/nitrogen/generated/ios/NitroInputAutolinking.swift +36 -0
- package/nitrogen/generated/ios/c++/HybridNitroInputViewSpecSwift.hpp +30 -0
- package/nitrogen/generated/ios/c++/HybridNitroNumberFormatPlatformSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridNitroNumberFormatPlatformSpecSwift.hpp +122 -0
- package/nitrogen/generated/ios/c++/HybridNitroNumberViewSpecSwift.hpp +188 -0
- package/nitrogen/generated/ios/c++/HybridNitroPlatformNumberFormatterSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridNitroPlatformNumberFormatterSpecSwift.hpp +94 -0
- package/nitrogen/generated/ios/c++/HybridNitroTextMeasureSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridNitroTextMeasureSpecSwift.hpp +90 -0
- package/nitrogen/generated/ios/c++/HybridNitroTextViewSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridNitroTextViewSpecSwift.hpp +233 -0
- package/nitrogen/generated/ios/c++/views/HybridNitroInputViewComponent.mm +30 -0
- package/nitrogen/generated/ios/c++/views/HybridNitroNumberViewComponent.mm +156 -0
- package/nitrogen/generated/ios/c++/views/HybridNitroTextViewComponent.mm +264 -0
- package/nitrogen/generated/ios/swift/HybridNitroInputViewSpec.swift +5 -0
- package/nitrogen/generated/ios/swift/HybridNitroInputViewSpec_cxx.swift +55 -0
- package/nitrogen/generated/ios/swift/HybridNitroNumberFormatPlatformSpec.swift +56 -0
- package/nitrogen/generated/ios/swift/HybridNitroNumberFormatPlatformSpec_cxx.swift +159 -0
- package/nitrogen/generated/ios/swift/HybridNitroNumberViewSpec.swift +26 -0
- package/nitrogen/generated/ios/swift/HybridNitroNumberViewSpec_cxx.swift +658 -21
- package/nitrogen/generated/ios/swift/HybridNitroPlatformNumberFormatterSpec.swift +56 -0
- package/nitrogen/generated/ios/swift/HybridNitroPlatformNumberFormatterSpec_cxx.swift +155 -0
- package/nitrogen/generated/ios/swift/HybridNitroTextMeasureSpec.swift +56 -0
- package/nitrogen/generated/ios/swift/HybridNitroTextMeasureSpec_cxx.swift +150 -0
- package/nitrogen/generated/ios/swift/HybridNitroTextViewSpec.swift +75 -0
- package/nitrogen/generated/ios/swift/HybridNitroTextViewSpec_cxx.swift +608 -0
- package/nitrogen/generated/ios/swift/NitroNumberDirection.swift +4 -0
- package/nitrogen/generated/ios/swift/NitroNumberShimmerDirection.swift +44 -0
- package/nitrogen/generated/ios/swift/NitroNumberSignDisplay.swift +52 -0
- package/nitrogen/generated/ios/swift/NumberFormatCompactDisplay.swift +40 -0
- package/nitrogen/generated/ios/swift/NumberFormatCurrencyDisplay.swift +48 -0
- package/nitrogen/generated/ios/swift/NumberFormatCurrencySign.swift +40 -0
- package/nitrogen/generated/ios/swift/NumberFormatNotation.swift +48 -0
- package/nitrogen/generated/ios/swift/NumberFormatPlatformOptions.swift +159 -0
- package/nitrogen/generated/ios/swift/NumberFormatPlatformSymbols.swift +69 -0
- package/nitrogen/generated/ios/swift/NumberFormatRoundingMode.swift +68 -0
- package/nitrogen/generated/ios/swift/NumberFormatSignDisplay.swift +52 -0
- package/nitrogen/generated/ios/swift/NumberFormatStyle.swift +48 -0
- package/nitrogen/generated/ios/swift/NumberFormatUnitDisplay.swift +44 -0
- package/nitrogen/generated/shared/c++/HybridNitroInputViewSpec.cpp +10 -0
- package/nitrogen/generated/shared/c++/HybridNitroInputViewSpec.hpp +10 -0
- package/nitrogen/generated/shared/c++/HybridNitroNumberFormatFactorySpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridNitroNumberFormatFactorySpec.hpp +70 -0
- package/nitrogen/generated/shared/c++/HybridNitroNumberFormatPlatformSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridNitroNumberFormatPlatformSpec.hpp +70 -0
- package/nitrogen/generated/shared/c++/HybridNitroNumberFormatSpec.cpp +23 -0
- package/nitrogen/generated/shared/c++/HybridNitroNumberFormatSpec.hpp +71 -0
- package/nitrogen/generated/shared/c++/HybridNitroNumberViewSpec.cpp +52 -0
- package/nitrogen/generated/shared/c++/HybridNitroNumberViewSpec.hpp +58 -0
- package/nitrogen/generated/shared/c++/HybridNitroPlatformNumberFormatterSpec.cpp +23 -0
- package/nitrogen/generated/shared/c++/HybridNitroPlatformNumberFormatterSpec.hpp +65 -0
- package/nitrogen/generated/shared/c++/HybridNitroTextMeasureSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridNitroTextMeasureSpec.hpp +63 -0
- package/nitrogen/generated/shared/c++/HybridNitroTextViewSpec.cpp +62 -0
- package/nitrogen/generated/shared/c++/HybridNitroTextViewSpec.hpp +115 -0
- package/nitrogen/generated/shared/c++/NitroNumberDirection.hpp +4 -0
- package/nitrogen/generated/shared/c++/NitroNumberShimmerDirection.hpp +80 -0
- package/nitrogen/generated/shared/c++/NitroNumberSignDisplay.hpp +88 -0
- package/nitrogen/generated/shared/c++/NumberFormatCompactDisplay.hpp +76 -0
- package/nitrogen/generated/shared/c++/NumberFormatCurrencyDisplay.hpp +84 -0
- package/nitrogen/generated/shared/c++/NumberFormatCurrencySign.hpp +76 -0
- package/nitrogen/generated/shared/c++/NumberFormatGrouping.hpp +80 -0
- package/nitrogen/generated/shared/c++/NumberFormatNotation.hpp +84 -0
- package/nitrogen/generated/shared/c++/NumberFormatOptions.hpp +193 -0
- package/nitrogen/generated/shared/c++/NumberFormatPart.hpp +87 -0
- package/nitrogen/generated/shared/c++/NumberFormatPlatformOptions.hpp +176 -0
- package/nitrogen/generated/shared/c++/NumberFormatPlatformSymbols.hpp +115 -0
- package/nitrogen/generated/shared/c++/NumberFormatRoundingMode.hpp +104 -0
- package/nitrogen/generated/shared/c++/NumberFormatRoundingPriority.hpp +80 -0
- package/nitrogen/generated/shared/c++/NumberFormatSignDisplay.hpp +88 -0
- package/nitrogen/generated/shared/c++/NumberFormatStyle.hpp +84 -0
- package/nitrogen/generated/shared/c++/NumberFormatTrailingZeroDisplay.hpp +76 -0
- package/nitrogen/generated/shared/c++/NumberFormatUnitDisplay.hpp +80 -0
- package/nitrogen/generated/shared/c++/ResolvedNumberFormatOptions.hpp +197 -0
- package/nitrogen/generated/shared/c++/views/HybridNitroInputViewComponent.cpp +10 -0
- package/nitrogen/generated/shared/c++/views/HybridNitroInputViewComponent.hpp +15 -0
- package/nitrogen/generated/shared/c++/views/HybridNitroNumberViewComponent.cpp +52 -0
- package/nitrogen/generated/shared/c++/views/HybridNitroNumberViewComponent.hpp +80 -0
- package/nitrogen/generated/shared/c++/views/HybridNitroTextViewComponent.cpp +74 -0
- package/nitrogen/generated/shared/c++/views/HybridNitroTextViewComponent.hpp +149 -0
- package/nitrogen/generated/shared/json/NitroInputViewConfig.json +5 -0
- package/nitrogen/generated/shared/json/NitroNumberViewConfig.json +26 -0
- package/nitrogen/generated/shared/json/NitroTextViewConfig.json +30 -0
- package/package.json +2 -2
- package/src/NitroInput.tsx +42 -7
- package/src/NitroNumber.tsx +236 -12
- package/src/NitroText.tsx +166 -0
- package/src/NitroTime.tsx +68 -0
- package/src/NumberFormat.ts +563 -0
- package/src/formatProps.ts +149 -0
- package/src/index.ts +23 -0
- package/src/specs/NitroInput.nitro.ts +10 -0
- package/src/specs/NitroNumber.nitro.ts +82 -1
- package/src/specs/NitroText.nitro.ts +65 -0
- package/src/specs/NumberFormat.nitro.ts +145 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NumberFormatGrouping.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/NitroHash.hpp>)
|
|
11
|
+
#include <NitroModules/NitroHash.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
16
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
21
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::nitroinput {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* An enum which can be represented as a JavaScript union (NumberFormatGrouping).
|
|
30
|
+
*/
|
|
31
|
+
enum class NumberFormatGrouping {
|
|
32
|
+
AUTO SWIFT_NAME(auto) = 0,
|
|
33
|
+
ALWAYS SWIFT_NAME(always) = 1,
|
|
34
|
+
MIN2 SWIFT_NAME(min2) = 2,
|
|
35
|
+
} CLOSED_ENUM;
|
|
36
|
+
|
|
37
|
+
} // namespace margelo::nitro::nitroinput
|
|
38
|
+
|
|
39
|
+
namespace margelo::nitro {
|
|
40
|
+
|
|
41
|
+
// C++ NumberFormatGrouping <> JS NumberFormatGrouping (union)
|
|
42
|
+
template <>
|
|
43
|
+
struct JSIConverter<margelo::nitro::nitroinput::NumberFormatGrouping> final {
|
|
44
|
+
static inline margelo::nitro::nitroinput::NumberFormatGrouping fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
45
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
46
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
47
|
+
case hashString("auto"): return margelo::nitro::nitroinput::NumberFormatGrouping::AUTO;
|
|
48
|
+
case hashString("always"): return margelo::nitro::nitroinput::NumberFormatGrouping::ALWAYS;
|
|
49
|
+
case hashString("min2"): return margelo::nitro::nitroinput::NumberFormatGrouping::MIN2;
|
|
50
|
+
default: [[unlikely]]
|
|
51
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum NumberFormatGrouping - invalid value!");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::nitroinput::NumberFormatGrouping arg) {
|
|
55
|
+
switch (arg) {
|
|
56
|
+
case margelo::nitro::nitroinput::NumberFormatGrouping::AUTO: return JSIConverter<std::string>::toJSI(runtime, "auto");
|
|
57
|
+
case margelo::nitro::nitroinput::NumberFormatGrouping::ALWAYS: return JSIConverter<std::string>::toJSI(runtime, "always");
|
|
58
|
+
case margelo::nitro::nitroinput::NumberFormatGrouping::MIN2: return JSIConverter<std::string>::toJSI(runtime, "min2");
|
|
59
|
+
default: [[unlikely]]
|
|
60
|
+
throw std::invalid_argument("Cannot convert NumberFormatGrouping to JS - invalid value: "
|
|
61
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
65
|
+
if (!value.isString()) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
69
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
70
|
+
case hashString("auto"):
|
|
71
|
+
case hashString("always"):
|
|
72
|
+
case hashString("min2"):
|
|
73
|
+
return true;
|
|
74
|
+
default:
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NumberFormatNotation.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/NitroHash.hpp>)
|
|
11
|
+
#include <NitroModules/NitroHash.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
16
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
21
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::nitroinput {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* An enum which can be represented as a JavaScript union (NumberFormatNotation).
|
|
30
|
+
*/
|
|
31
|
+
enum class NumberFormatNotation {
|
|
32
|
+
STANDARD SWIFT_NAME(standard) = 0,
|
|
33
|
+
SCIENTIFIC SWIFT_NAME(scientific) = 1,
|
|
34
|
+
ENGINEERING SWIFT_NAME(engineering) = 2,
|
|
35
|
+
COMPACT SWIFT_NAME(compact) = 3,
|
|
36
|
+
} CLOSED_ENUM;
|
|
37
|
+
|
|
38
|
+
} // namespace margelo::nitro::nitroinput
|
|
39
|
+
|
|
40
|
+
namespace margelo::nitro {
|
|
41
|
+
|
|
42
|
+
// C++ NumberFormatNotation <> JS NumberFormatNotation (union)
|
|
43
|
+
template <>
|
|
44
|
+
struct JSIConverter<margelo::nitro::nitroinput::NumberFormatNotation> final {
|
|
45
|
+
static inline margelo::nitro::nitroinput::NumberFormatNotation fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
46
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
47
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
48
|
+
case hashString("standard"): return margelo::nitro::nitroinput::NumberFormatNotation::STANDARD;
|
|
49
|
+
case hashString("scientific"): return margelo::nitro::nitroinput::NumberFormatNotation::SCIENTIFIC;
|
|
50
|
+
case hashString("engineering"): return margelo::nitro::nitroinput::NumberFormatNotation::ENGINEERING;
|
|
51
|
+
case hashString("compact"): return margelo::nitro::nitroinput::NumberFormatNotation::COMPACT;
|
|
52
|
+
default: [[unlikely]]
|
|
53
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum NumberFormatNotation - invalid value!");
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::nitroinput::NumberFormatNotation arg) {
|
|
57
|
+
switch (arg) {
|
|
58
|
+
case margelo::nitro::nitroinput::NumberFormatNotation::STANDARD: return JSIConverter<std::string>::toJSI(runtime, "standard");
|
|
59
|
+
case margelo::nitro::nitroinput::NumberFormatNotation::SCIENTIFIC: return JSIConverter<std::string>::toJSI(runtime, "scientific");
|
|
60
|
+
case margelo::nitro::nitroinput::NumberFormatNotation::ENGINEERING: return JSIConverter<std::string>::toJSI(runtime, "engineering");
|
|
61
|
+
case margelo::nitro::nitroinput::NumberFormatNotation::COMPACT: return JSIConverter<std::string>::toJSI(runtime, "compact");
|
|
62
|
+
default: [[unlikely]]
|
|
63
|
+
throw std::invalid_argument("Cannot convert NumberFormatNotation to JS - invalid value: "
|
|
64
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
68
|
+
if (!value.isString()) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
72
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
73
|
+
case hashString("standard"):
|
|
74
|
+
case hashString("scientific"):
|
|
75
|
+
case hashString("engineering"):
|
|
76
|
+
case hashString("compact"):
|
|
77
|
+
return true;
|
|
78
|
+
default:
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NumberFormatOptions.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
// Forward declaration of `NumberFormatStyle` to properly resolve imports.
|
|
32
|
+
namespace margelo::nitro::nitroinput { enum class NumberFormatStyle; }
|
|
33
|
+
// Forward declaration of `NumberFormatCurrencyDisplay` to properly resolve imports.
|
|
34
|
+
namespace margelo::nitro::nitroinput { enum class NumberFormatCurrencyDisplay; }
|
|
35
|
+
// Forward declaration of `NumberFormatCurrencySign` to properly resolve imports.
|
|
36
|
+
namespace margelo::nitro::nitroinput { enum class NumberFormatCurrencySign; }
|
|
37
|
+
// Forward declaration of `NumberFormatUnitDisplay` to properly resolve imports.
|
|
38
|
+
namespace margelo::nitro::nitroinput { enum class NumberFormatUnitDisplay; }
|
|
39
|
+
// Forward declaration of `NumberFormatRoundingPriority` to properly resolve imports.
|
|
40
|
+
namespace margelo::nitro::nitroinput { enum class NumberFormatRoundingPriority; }
|
|
41
|
+
// Forward declaration of `NumberFormatRoundingMode` to properly resolve imports.
|
|
42
|
+
namespace margelo::nitro::nitroinput { enum class NumberFormatRoundingMode; }
|
|
43
|
+
// Forward declaration of `NumberFormatTrailingZeroDisplay` to properly resolve imports.
|
|
44
|
+
namespace margelo::nitro::nitroinput { enum class NumberFormatTrailingZeroDisplay; }
|
|
45
|
+
// Forward declaration of `NumberFormatNotation` to properly resolve imports.
|
|
46
|
+
namespace margelo::nitro::nitroinput { enum class NumberFormatNotation; }
|
|
47
|
+
// Forward declaration of `NumberFormatCompactDisplay` to properly resolve imports.
|
|
48
|
+
namespace margelo::nitro::nitroinput { enum class NumberFormatCompactDisplay; }
|
|
49
|
+
// Forward declaration of `NumberFormatGrouping` to properly resolve imports.
|
|
50
|
+
namespace margelo::nitro::nitroinput { enum class NumberFormatGrouping; }
|
|
51
|
+
// Forward declaration of `NumberFormatSignDisplay` to properly resolve imports.
|
|
52
|
+
namespace margelo::nitro::nitroinput { enum class NumberFormatSignDisplay; }
|
|
53
|
+
|
|
54
|
+
#include <string>
|
|
55
|
+
#include <optional>
|
|
56
|
+
#include "NumberFormatStyle.hpp"
|
|
57
|
+
#include "NumberFormatCurrencyDisplay.hpp"
|
|
58
|
+
#include "NumberFormatCurrencySign.hpp"
|
|
59
|
+
#include "NumberFormatUnitDisplay.hpp"
|
|
60
|
+
#include "NumberFormatRoundingPriority.hpp"
|
|
61
|
+
#include "NumberFormatRoundingMode.hpp"
|
|
62
|
+
#include "NumberFormatTrailingZeroDisplay.hpp"
|
|
63
|
+
#include "NumberFormatNotation.hpp"
|
|
64
|
+
#include "NumberFormatCompactDisplay.hpp"
|
|
65
|
+
#include "NumberFormatGrouping.hpp"
|
|
66
|
+
#include <variant>
|
|
67
|
+
#include "NumberFormatSignDisplay.hpp"
|
|
68
|
+
|
|
69
|
+
namespace margelo::nitro::nitroinput {
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* A struct which can be represented as a JavaScript object (NumberFormatOptions).
|
|
73
|
+
*/
|
|
74
|
+
struct NumberFormatOptions final {
|
|
75
|
+
public:
|
|
76
|
+
std::optional<std::string> numberingSystem SWIFT_PRIVATE;
|
|
77
|
+
std::optional<NumberFormatStyle> style SWIFT_PRIVATE;
|
|
78
|
+
std::optional<std::string> currency SWIFT_PRIVATE;
|
|
79
|
+
std::optional<NumberFormatCurrencyDisplay> currencyDisplay SWIFT_PRIVATE;
|
|
80
|
+
std::optional<NumberFormatCurrencySign> currencySign SWIFT_PRIVATE;
|
|
81
|
+
std::optional<std::string> unit SWIFT_PRIVATE;
|
|
82
|
+
std::optional<NumberFormatUnitDisplay> unitDisplay SWIFT_PRIVATE;
|
|
83
|
+
std::optional<double> minimumIntegerDigits SWIFT_PRIVATE;
|
|
84
|
+
std::optional<double> minimumFractionDigits SWIFT_PRIVATE;
|
|
85
|
+
std::optional<double> maximumFractionDigits SWIFT_PRIVATE;
|
|
86
|
+
std::optional<double> minimumSignificantDigits SWIFT_PRIVATE;
|
|
87
|
+
std::optional<double> maximumSignificantDigits SWIFT_PRIVATE;
|
|
88
|
+
std::optional<NumberFormatRoundingPriority> roundingPriority SWIFT_PRIVATE;
|
|
89
|
+
std::optional<double> roundingIncrement SWIFT_PRIVATE;
|
|
90
|
+
std::optional<NumberFormatRoundingMode> roundingMode SWIFT_PRIVATE;
|
|
91
|
+
std::optional<NumberFormatTrailingZeroDisplay> trailingZeroDisplay SWIFT_PRIVATE;
|
|
92
|
+
std::optional<NumberFormatNotation> notation SWIFT_PRIVATE;
|
|
93
|
+
std::optional<NumberFormatCompactDisplay> compactDisplay SWIFT_PRIVATE;
|
|
94
|
+
std::optional<std::variant<bool, NumberFormatGrouping>> useGrouping SWIFT_PRIVATE;
|
|
95
|
+
std::optional<NumberFormatSignDisplay> signDisplay SWIFT_PRIVATE;
|
|
96
|
+
|
|
97
|
+
public:
|
|
98
|
+
NumberFormatOptions() = default;
|
|
99
|
+
explicit NumberFormatOptions(std::optional<std::string> numberingSystem, std::optional<NumberFormatStyle> style, std::optional<std::string> currency, std::optional<NumberFormatCurrencyDisplay> currencyDisplay, std::optional<NumberFormatCurrencySign> currencySign, std::optional<std::string> unit, std::optional<NumberFormatUnitDisplay> unitDisplay, std::optional<double> minimumIntegerDigits, std::optional<double> minimumFractionDigits, std::optional<double> maximumFractionDigits, std::optional<double> minimumSignificantDigits, std::optional<double> maximumSignificantDigits, std::optional<NumberFormatRoundingPriority> roundingPriority, std::optional<double> roundingIncrement, std::optional<NumberFormatRoundingMode> roundingMode, std::optional<NumberFormatTrailingZeroDisplay> trailingZeroDisplay, std::optional<NumberFormatNotation> notation, std::optional<NumberFormatCompactDisplay> compactDisplay, std::optional<std::variant<bool, NumberFormatGrouping>> useGrouping, std::optional<NumberFormatSignDisplay> signDisplay): numberingSystem(numberingSystem), style(style), currency(currency), currencyDisplay(currencyDisplay), currencySign(currencySign), unit(unit), unitDisplay(unitDisplay), minimumIntegerDigits(minimumIntegerDigits), minimumFractionDigits(minimumFractionDigits), maximumFractionDigits(maximumFractionDigits), minimumSignificantDigits(minimumSignificantDigits), maximumSignificantDigits(maximumSignificantDigits), roundingPriority(roundingPriority), roundingIncrement(roundingIncrement), roundingMode(roundingMode), trailingZeroDisplay(trailingZeroDisplay), notation(notation), compactDisplay(compactDisplay), useGrouping(useGrouping), signDisplay(signDisplay) {}
|
|
100
|
+
|
|
101
|
+
public:
|
|
102
|
+
friend bool operator==(const NumberFormatOptions& lhs, const NumberFormatOptions& rhs) = default;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
} // namespace margelo::nitro::nitroinput
|
|
106
|
+
|
|
107
|
+
namespace margelo::nitro {
|
|
108
|
+
|
|
109
|
+
// C++ NumberFormatOptions <> JS NumberFormatOptions (object)
|
|
110
|
+
template <>
|
|
111
|
+
struct JSIConverter<margelo::nitro::nitroinput::NumberFormatOptions> final {
|
|
112
|
+
static inline margelo::nitro::nitroinput::NumberFormatOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
113
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
114
|
+
return margelo::nitro::nitroinput::NumberFormatOptions(
|
|
115
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "numberingSystem"))),
|
|
116
|
+
JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatStyle>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "style"))),
|
|
117
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "currency"))),
|
|
118
|
+
JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatCurrencyDisplay>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "currencyDisplay"))),
|
|
119
|
+
JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatCurrencySign>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "currencySign"))),
|
|
120
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "unit"))),
|
|
121
|
+
JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatUnitDisplay>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "unitDisplay"))),
|
|
122
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "minimumIntegerDigits"))),
|
|
123
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "minimumFractionDigits"))),
|
|
124
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maximumFractionDigits"))),
|
|
125
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "minimumSignificantDigits"))),
|
|
126
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maximumSignificantDigits"))),
|
|
127
|
+
JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatRoundingPriority>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "roundingPriority"))),
|
|
128
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "roundingIncrement"))),
|
|
129
|
+
JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatRoundingMode>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "roundingMode"))),
|
|
130
|
+
JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatTrailingZeroDisplay>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "trailingZeroDisplay"))),
|
|
131
|
+
JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatNotation>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "notation"))),
|
|
132
|
+
JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatCompactDisplay>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "compactDisplay"))),
|
|
133
|
+
JSIConverter<std::optional<std::variant<bool, margelo::nitro::nitroinput::NumberFormatGrouping>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "useGrouping"))),
|
|
134
|
+
JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatSignDisplay>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "signDisplay")))
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitroinput::NumberFormatOptions& arg) {
|
|
138
|
+
jsi::Object obj(runtime);
|
|
139
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "numberingSystem"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.numberingSystem));
|
|
140
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "style"), JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatStyle>>::toJSI(runtime, arg.style));
|
|
141
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "currency"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.currency));
|
|
142
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "currencyDisplay"), JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatCurrencyDisplay>>::toJSI(runtime, arg.currencyDisplay));
|
|
143
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "currencySign"), JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatCurrencySign>>::toJSI(runtime, arg.currencySign));
|
|
144
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "unit"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.unit));
|
|
145
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "unitDisplay"), JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatUnitDisplay>>::toJSI(runtime, arg.unitDisplay));
|
|
146
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "minimumIntegerDigits"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.minimumIntegerDigits));
|
|
147
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "minimumFractionDigits"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.minimumFractionDigits));
|
|
148
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "maximumFractionDigits"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.maximumFractionDigits));
|
|
149
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "minimumSignificantDigits"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.minimumSignificantDigits));
|
|
150
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "maximumSignificantDigits"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.maximumSignificantDigits));
|
|
151
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "roundingPriority"), JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatRoundingPriority>>::toJSI(runtime, arg.roundingPriority));
|
|
152
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "roundingIncrement"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.roundingIncrement));
|
|
153
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "roundingMode"), JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatRoundingMode>>::toJSI(runtime, arg.roundingMode));
|
|
154
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "trailingZeroDisplay"), JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatTrailingZeroDisplay>>::toJSI(runtime, arg.trailingZeroDisplay));
|
|
155
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "notation"), JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatNotation>>::toJSI(runtime, arg.notation));
|
|
156
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "compactDisplay"), JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatCompactDisplay>>::toJSI(runtime, arg.compactDisplay));
|
|
157
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "useGrouping"), JSIConverter<std::optional<std::variant<bool, margelo::nitro::nitroinput::NumberFormatGrouping>>>::toJSI(runtime, arg.useGrouping));
|
|
158
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "signDisplay"), JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatSignDisplay>>::toJSI(runtime, arg.signDisplay));
|
|
159
|
+
return obj;
|
|
160
|
+
}
|
|
161
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
162
|
+
if (!value.isObject()) {
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
jsi::Object obj = value.getObject(runtime);
|
|
166
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "numberingSystem")))) return false;
|
|
170
|
+
if (!JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatStyle>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "style")))) return false;
|
|
171
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "currency")))) return false;
|
|
172
|
+
if (!JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatCurrencyDisplay>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "currencyDisplay")))) return false;
|
|
173
|
+
if (!JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatCurrencySign>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "currencySign")))) return false;
|
|
174
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "unit")))) return false;
|
|
175
|
+
if (!JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatUnitDisplay>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "unitDisplay")))) return false;
|
|
176
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "minimumIntegerDigits")))) return false;
|
|
177
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "minimumFractionDigits")))) return false;
|
|
178
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maximumFractionDigits")))) return false;
|
|
179
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "minimumSignificantDigits")))) return false;
|
|
180
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maximumSignificantDigits")))) return false;
|
|
181
|
+
if (!JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatRoundingPriority>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "roundingPriority")))) return false;
|
|
182
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "roundingIncrement")))) return false;
|
|
183
|
+
if (!JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatRoundingMode>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "roundingMode")))) return false;
|
|
184
|
+
if (!JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatTrailingZeroDisplay>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "trailingZeroDisplay")))) return false;
|
|
185
|
+
if (!JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatNotation>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "notation")))) return false;
|
|
186
|
+
if (!JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatCompactDisplay>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "compactDisplay")))) return false;
|
|
187
|
+
if (!JSIConverter<std::optional<std::variant<bool, margelo::nitro::nitroinput::NumberFormatGrouping>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "useGrouping")))) return false;
|
|
188
|
+
if (!JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatSignDisplay>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "signDisplay")))) return false;
|
|
189
|
+
return true;
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NumberFormatPart.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
#include <string>
|
|
34
|
+
|
|
35
|
+
namespace margelo::nitro::nitroinput {
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A struct which can be represented as a JavaScript object (NumberFormatPart).
|
|
39
|
+
*/
|
|
40
|
+
struct NumberFormatPart final {
|
|
41
|
+
public:
|
|
42
|
+
std::string type SWIFT_PRIVATE;
|
|
43
|
+
std::string value SWIFT_PRIVATE;
|
|
44
|
+
|
|
45
|
+
public:
|
|
46
|
+
NumberFormatPart() = default;
|
|
47
|
+
explicit NumberFormatPart(std::string type, std::string value): type(type), value(value) {}
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
friend bool operator==(const NumberFormatPart& lhs, const NumberFormatPart& rhs) = default;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
} // namespace margelo::nitro::nitroinput
|
|
54
|
+
|
|
55
|
+
namespace margelo::nitro {
|
|
56
|
+
|
|
57
|
+
// C++ NumberFormatPart <> JS NumberFormatPart (object)
|
|
58
|
+
template <>
|
|
59
|
+
struct JSIConverter<margelo::nitro::nitroinput::NumberFormatPart> final {
|
|
60
|
+
static inline margelo::nitro::nitroinput::NumberFormatPart fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
61
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
62
|
+
return margelo::nitro::nitroinput::NumberFormatPart(
|
|
63
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type"))),
|
|
64
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "value")))
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitroinput::NumberFormatPart& arg) {
|
|
68
|
+
jsi::Object obj(runtime);
|
|
69
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "type"), JSIConverter<std::string>::toJSI(runtime, arg.type));
|
|
70
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "value"), JSIConverter<std::string>::toJSI(runtime, arg.value));
|
|
71
|
+
return obj;
|
|
72
|
+
}
|
|
73
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
74
|
+
if (!value.isObject()) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
jsi::Object obj = value.getObject(runtime);
|
|
78
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type")))) return false;
|
|
82
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "value")))) return false;
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NumberFormatPlatformOptions.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
// Forward declaration of `NumberFormatStyle` to properly resolve imports.
|
|
32
|
+
namespace margelo::nitro::nitroinput { enum class NumberFormatStyle; }
|
|
33
|
+
// Forward declaration of `NumberFormatCurrencyDisplay` to properly resolve imports.
|
|
34
|
+
namespace margelo::nitro::nitroinput { enum class NumberFormatCurrencyDisplay; }
|
|
35
|
+
// Forward declaration of `NumberFormatCurrencySign` to properly resolve imports.
|
|
36
|
+
namespace margelo::nitro::nitroinput { enum class NumberFormatCurrencySign; }
|
|
37
|
+
// Forward declaration of `NumberFormatUnitDisplay` to properly resolve imports.
|
|
38
|
+
namespace margelo::nitro::nitroinput { enum class NumberFormatUnitDisplay; }
|
|
39
|
+
// Forward declaration of `NumberFormatNotation` to properly resolve imports.
|
|
40
|
+
namespace margelo::nitro::nitroinput { enum class NumberFormatNotation; }
|
|
41
|
+
// Forward declaration of `NumberFormatCompactDisplay` to properly resolve imports.
|
|
42
|
+
namespace margelo::nitro::nitroinput { enum class NumberFormatCompactDisplay; }
|
|
43
|
+
// Forward declaration of `NumberFormatRoundingMode` to properly resolve imports.
|
|
44
|
+
namespace margelo::nitro::nitroinput { enum class NumberFormatRoundingMode; }
|
|
45
|
+
// Forward declaration of `NumberFormatSignDisplay` to properly resolve imports.
|
|
46
|
+
namespace margelo::nitro::nitroinput { enum class NumberFormatSignDisplay; }
|
|
47
|
+
|
|
48
|
+
#include <string>
|
|
49
|
+
#include <vector>
|
|
50
|
+
#include <optional>
|
|
51
|
+
#include "NumberFormatStyle.hpp"
|
|
52
|
+
#include "NumberFormatCurrencyDisplay.hpp"
|
|
53
|
+
#include "NumberFormatCurrencySign.hpp"
|
|
54
|
+
#include "NumberFormatUnitDisplay.hpp"
|
|
55
|
+
#include "NumberFormatNotation.hpp"
|
|
56
|
+
#include "NumberFormatCompactDisplay.hpp"
|
|
57
|
+
#include "NumberFormatRoundingMode.hpp"
|
|
58
|
+
#include "NumberFormatSignDisplay.hpp"
|
|
59
|
+
|
|
60
|
+
namespace margelo::nitro::nitroinput {
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* A struct which can be represented as a JavaScript object (NumberFormatPlatformOptions).
|
|
64
|
+
*/
|
|
65
|
+
struct NumberFormatPlatformOptions final {
|
|
66
|
+
public:
|
|
67
|
+
std::vector<std::string> locales SWIFT_PRIVATE;
|
|
68
|
+
std::optional<std::string> numberingSystem SWIFT_PRIVATE;
|
|
69
|
+
NumberFormatStyle style SWIFT_PRIVATE;
|
|
70
|
+
std::optional<std::string> currency SWIFT_PRIVATE;
|
|
71
|
+
NumberFormatCurrencyDisplay currencyDisplay SWIFT_PRIVATE;
|
|
72
|
+
NumberFormatCurrencySign currencySign SWIFT_PRIVATE;
|
|
73
|
+
std::optional<std::string> unit SWIFT_PRIVATE;
|
|
74
|
+
NumberFormatUnitDisplay unitDisplay SWIFT_PRIVATE;
|
|
75
|
+
NumberFormatNotation notation SWIFT_PRIVATE;
|
|
76
|
+
NumberFormatCompactDisplay compactDisplay SWIFT_PRIVATE;
|
|
77
|
+
bool useGrouping SWIFT_PRIVATE;
|
|
78
|
+
double minimumIntegerDigits SWIFT_PRIVATE;
|
|
79
|
+
double minimumFractionDigits SWIFT_PRIVATE;
|
|
80
|
+
double maximumFractionDigits SWIFT_PRIVATE;
|
|
81
|
+
double minimumSignificantDigits SWIFT_PRIVATE;
|
|
82
|
+
double maximumSignificantDigits SWIFT_PRIVATE;
|
|
83
|
+
NumberFormatRoundingMode roundingMode SWIFT_PRIVATE;
|
|
84
|
+
NumberFormatSignDisplay signDisplay SWIFT_PRIVATE;
|
|
85
|
+
|
|
86
|
+
public:
|
|
87
|
+
NumberFormatPlatformOptions() = default;
|
|
88
|
+
explicit NumberFormatPlatformOptions(std::vector<std::string> locales, std::optional<std::string> numberingSystem, NumberFormatStyle style, std::optional<std::string> currency, NumberFormatCurrencyDisplay currencyDisplay, NumberFormatCurrencySign currencySign, std::optional<std::string> unit, NumberFormatUnitDisplay unitDisplay, NumberFormatNotation notation, NumberFormatCompactDisplay compactDisplay, bool useGrouping, double minimumIntegerDigits, double minimumFractionDigits, double maximumFractionDigits, double minimumSignificantDigits, double maximumSignificantDigits, NumberFormatRoundingMode roundingMode, NumberFormatSignDisplay signDisplay): locales(locales), numberingSystem(numberingSystem), style(style), currency(currency), currencyDisplay(currencyDisplay), currencySign(currencySign), unit(unit), unitDisplay(unitDisplay), notation(notation), compactDisplay(compactDisplay), useGrouping(useGrouping), minimumIntegerDigits(minimumIntegerDigits), minimumFractionDigits(minimumFractionDigits), maximumFractionDigits(maximumFractionDigits), minimumSignificantDigits(minimumSignificantDigits), maximumSignificantDigits(maximumSignificantDigits), roundingMode(roundingMode), signDisplay(signDisplay) {}
|
|
89
|
+
|
|
90
|
+
public:
|
|
91
|
+
friend bool operator==(const NumberFormatPlatformOptions& lhs, const NumberFormatPlatformOptions& rhs) = default;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
} // namespace margelo::nitro::nitroinput
|
|
95
|
+
|
|
96
|
+
namespace margelo::nitro {
|
|
97
|
+
|
|
98
|
+
// C++ NumberFormatPlatformOptions <> JS NumberFormatPlatformOptions (object)
|
|
99
|
+
template <>
|
|
100
|
+
struct JSIConverter<margelo::nitro::nitroinput::NumberFormatPlatformOptions> final {
|
|
101
|
+
static inline margelo::nitro::nitroinput::NumberFormatPlatformOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
102
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
103
|
+
return margelo::nitro::nitroinput::NumberFormatPlatformOptions(
|
|
104
|
+
JSIConverter<std::vector<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "locales"))),
|
|
105
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "numberingSystem"))),
|
|
106
|
+
JSIConverter<margelo::nitro::nitroinput::NumberFormatStyle>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "style"))),
|
|
107
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "currency"))),
|
|
108
|
+
JSIConverter<margelo::nitro::nitroinput::NumberFormatCurrencyDisplay>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "currencyDisplay"))),
|
|
109
|
+
JSIConverter<margelo::nitro::nitroinput::NumberFormatCurrencySign>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "currencySign"))),
|
|
110
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "unit"))),
|
|
111
|
+
JSIConverter<margelo::nitro::nitroinput::NumberFormatUnitDisplay>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "unitDisplay"))),
|
|
112
|
+
JSIConverter<margelo::nitro::nitroinput::NumberFormatNotation>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "notation"))),
|
|
113
|
+
JSIConverter<margelo::nitro::nitroinput::NumberFormatCompactDisplay>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "compactDisplay"))),
|
|
114
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "useGrouping"))),
|
|
115
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "minimumIntegerDigits"))),
|
|
116
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "minimumFractionDigits"))),
|
|
117
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maximumFractionDigits"))),
|
|
118
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "minimumSignificantDigits"))),
|
|
119
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maximumSignificantDigits"))),
|
|
120
|
+
JSIConverter<margelo::nitro::nitroinput::NumberFormatRoundingMode>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "roundingMode"))),
|
|
121
|
+
JSIConverter<margelo::nitro::nitroinput::NumberFormatSignDisplay>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "signDisplay")))
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitroinput::NumberFormatPlatformOptions& arg) {
|
|
125
|
+
jsi::Object obj(runtime);
|
|
126
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "locales"), JSIConverter<std::vector<std::string>>::toJSI(runtime, arg.locales));
|
|
127
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "numberingSystem"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.numberingSystem));
|
|
128
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "style"), JSIConverter<margelo::nitro::nitroinput::NumberFormatStyle>::toJSI(runtime, arg.style));
|
|
129
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "currency"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.currency));
|
|
130
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "currencyDisplay"), JSIConverter<margelo::nitro::nitroinput::NumberFormatCurrencyDisplay>::toJSI(runtime, arg.currencyDisplay));
|
|
131
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "currencySign"), JSIConverter<margelo::nitro::nitroinput::NumberFormatCurrencySign>::toJSI(runtime, arg.currencySign));
|
|
132
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "unit"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.unit));
|
|
133
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "unitDisplay"), JSIConverter<margelo::nitro::nitroinput::NumberFormatUnitDisplay>::toJSI(runtime, arg.unitDisplay));
|
|
134
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "notation"), JSIConverter<margelo::nitro::nitroinput::NumberFormatNotation>::toJSI(runtime, arg.notation));
|
|
135
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "compactDisplay"), JSIConverter<margelo::nitro::nitroinput::NumberFormatCompactDisplay>::toJSI(runtime, arg.compactDisplay));
|
|
136
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "useGrouping"), JSIConverter<bool>::toJSI(runtime, arg.useGrouping));
|
|
137
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "minimumIntegerDigits"), JSIConverter<double>::toJSI(runtime, arg.minimumIntegerDigits));
|
|
138
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "minimumFractionDigits"), JSIConverter<double>::toJSI(runtime, arg.minimumFractionDigits));
|
|
139
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "maximumFractionDigits"), JSIConverter<double>::toJSI(runtime, arg.maximumFractionDigits));
|
|
140
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "minimumSignificantDigits"), JSIConverter<double>::toJSI(runtime, arg.minimumSignificantDigits));
|
|
141
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "maximumSignificantDigits"), JSIConverter<double>::toJSI(runtime, arg.maximumSignificantDigits));
|
|
142
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "roundingMode"), JSIConverter<margelo::nitro::nitroinput::NumberFormatRoundingMode>::toJSI(runtime, arg.roundingMode));
|
|
143
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "signDisplay"), JSIConverter<margelo::nitro::nitroinput::NumberFormatSignDisplay>::toJSI(runtime, arg.signDisplay));
|
|
144
|
+
return obj;
|
|
145
|
+
}
|
|
146
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
147
|
+
if (!value.isObject()) {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
jsi::Object obj = value.getObject(runtime);
|
|
151
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
if (!JSIConverter<std::vector<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "locales")))) return false;
|
|
155
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "numberingSystem")))) return false;
|
|
156
|
+
if (!JSIConverter<margelo::nitro::nitroinput::NumberFormatStyle>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "style")))) return false;
|
|
157
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "currency")))) return false;
|
|
158
|
+
if (!JSIConverter<margelo::nitro::nitroinput::NumberFormatCurrencyDisplay>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "currencyDisplay")))) return false;
|
|
159
|
+
if (!JSIConverter<margelo::nitro::nitroinput::NumberFormatCurrencySign>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "currencySign")))) return false;
|
|
160
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "unit")))) return false;
|
|
161
|
+
if (!JSIConverter<margelo::nitro::nitroinput::NumberFormatUnitDisplay>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "unitDisplay")))) return false;
|
|
162
|
+
if (!JSIConverter<margelo::nitro::nitroinput::NumberFormatNotation>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "notation")))) return false;
|
|
163
|
+
if (!JSIConverter<margelo::nitro::nitroinput::NumberFormatCompactDisplay>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "compactDisplay")))) return false;
|
|
164
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "useGrouping")))) return false;
|
|
165
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "minimumIntegerDigits")))) return false;
|
|
166
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "minimumFractionDigits")))) return false;
|
|
167
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maximumFractionDigits")))) return false;
|
|
168
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "minimumSignificantDigits")))) return false;
|
|
169
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maximumSignificantDigits")))) return false;
|
|
170
|
+
if (!JSIConverter<margelo::nitro::nitroinput::NumberFormatRoundingMode>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "roundingMode")))) return false;
|
|
171
|
+
if (!JSIConverter<margelo::nitro::nitroinput::NumberFormatSignDisplay>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "signDisplay")))) return false;
|
|
172
|
+
return true;
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
} // namespace margelo::nitro
|