react-native-nitro-input 0.2.0 → 0.3.0
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 +38 -0
- package/README.md +43 -1
- package/android/CMakeLists.txt +4 -0
- package/android/gradle.properties +1 -1
- package/android/src/main/cpp/JRollingEngine.cpp +3 -2
- package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroInputView.kt +20 -0
- package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroNumberFormatPlatform.kt +209 -0
- package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroNumberView.kt +25 -0
- package/android/src/main/java/com/margelo/nitro/nitroinput/NitroInputView.kt +69 -10
- package/android/src/main/java/com/margelo/nitro/nitroinput/NitroNumberView.kt +164 -24
- package/android/src/main/java/com/margelo/nitro/nitroinput/RollingEngine.kt +2 -1
- package/cpp/RollingEngine.cpp +12 -2
- package/cpp/RollingEngine.hpp +8 -1
- 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 +348 -0
- package/ios/HybridNitroNumberView.swift +19 -0
- package/ios/NitroInputView.swift +79 -19
- package/ios/NitroNumberView.swift +171 -31
- package/lib/commonjs/nitrogen/generated/shared/json/NitroInputViewConfig.json +5 -0
- package/lib/commonjs/nitrogen/generated/shared/json/NitroNumberViewConfig.json +6 -0
- package/lib/commonjs/src/NitroInput.js +8 -6
- package/lib/commonjs/src/NitroNumber.js +4 -2
- package/lib/commonjs/src/NumberFormat.js +525 -0
- package/lib/commonjs/src/formatProps.js +48 -0
- package/lib/commonjs/src/index.js +3 -1
- 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 +6 -0
- package/lib/module/src/NitroInput.js +8 -6
- package/lib/module/src/NitroNumber.js +4 -2
- package/lib/module/src/NumberFormat.js +521 -0
- package/lib/module/src/formatProps.js +45 -0
- package/lib/module/src/index.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 +36 -1
- package/lib/typescript/src/NumberFormat.d.ts +47 -0
- package/lib/typescript/src/formatProps.d.ts +21 -0
- package/lib/typescript/src/index.d.ts +2 -0
- package/lib/typescript/src/specs/NitroInput.nitro.d.ts +10 -0
- package/lib/typescript/src/specs/NitroNumber.nitro.d.ts +13 -1
- package/lib/typescript/src/specs/NumberFormat.nitro.d.ts +139 -0
- package/nitro.json +16 -0
- package/nitrogen/generated/android/NitroInput+autolinking.cmake +6 -0
- package/nitrogen/generated/android/NitroInputOnLoad.cpp +28 -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 +54 -0
- package/nitrogen/generated/android/c++/JHybridNitroNumberViewSpec.hpp +12 -0
- package/nitrogen/generated/android/c++/JHybridNitroPlatformNumberFormatterSpec.cpp +65 -0
- package/nitrogen/generated/android/c++/JHybridNitroPlatformNumberFormatterSpec.hpp +64 -0
- package/nitrogen/generated/android/c++/JNitroNumberDirection.hpp +3 -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 +30 -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 +36 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroPlatformNumberFormatterSpec.kt +62 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberDirection.kt +2 -1
- 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/ios/NitroInput-Swift-Cxx-Bridge.cpp +34 -0
- package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Bridge.hpp +63 -0
- package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Umbrella.hpp +40 -0
- package/nitrogen/generated/ios/NitroInputAutolinking.mm +18 -0
- package/nitrogen/generated/ios/NitroInputAutolinking.swift +12 -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 +42 -0
- package/nitrogen/generated/ios/c++/HybridNitroPlatformNumberFormatterSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridNitroPlatformNumberFormatterSpecSwift.hpp +94 -0
- package/nitrogen/generated/ios/c++/views/HybridNitroInputViewComponent.mm +30 -0
- package/nitrogen/generated/ios/c++/views/HybridNitroNumberViewComponent.mm +36 -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 +6 -0
- package/nitrogen/generated/ios/swift/HybridNitroNumberViewSpec_cxx.swift +144 -0
- package/nitrogen/generated/ios/swift/HybridNitroPlatformNumberFormatterSpec.swift +56 -0
- package/nitrogen/generated/ios/swift/HybridNitroPlatformNumberFormatterSpec_cxx.swift +155 -0
- package/nitrogen/generated/ios/swift/NitroNumberDirection.swift +4 -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 +12 -0
- package/nitrogen/generated/shared/c++/HybridNitroNumberViewSpec.hpp +12 -0
- package/nitrogen/generated/shared/c++/HybridNitroPlatformNumberFormatterSpec.cpp +23 -0
- package/nitrogen/generated/shared/c++/HybridNitroPlatformNumberFormatterSpec.hpp +65 -0
- package/nitrogen/generated/shared/c++/NitroNumberDirection.hpp +4 -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 +12 -0
- package/nitrogen/generated/shared/c++/views/HybridNitroNumberViewComponent.hpp +18 -0
- package/nitrogen/generated/shared/json/NitroInputViewConfig.json +5 -0
- package/nitrogen/generated/shared/json/NitroNumberViewConfig.json +6 -0
- package/package.json +2 -2
- package/src/NitroInput.tsx +42 -7
- package/src/NitroNumber.tsx +57 -7
- package/src/NumberFormat.ts +563 -0
- package/src/formatProps.ts +59 -0
- package/src/index.ts +18 -0
- package/src/specs/NitroInput.nitro.ts +10 -0
- package/src/specs/NitroNumber.nitro.ts +13 -1
- package/src/specs/NumberFormat.nitro.ts +145 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NumberFormatPlatformSymbols.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 (NumberFormatPlatformSymbols).
|
|
39
|
+
*/
|
|
40
|
+
struct NumberFormatPlatformSymbols final {
|
|
41
|
+
public:
|
|
42
|
+
std::string locale SWIFT_PRIVATE;
|
|
43
|
+
std::string numberingSystem SWIFT_PRIVATE;
|
|
44
|
+
std::string minusSign SWIFT_PRIVATE;
|
|
45
|
+
std::string plusSign SWIFT_PRIVATE;
|
|
46
|
+
std::string percentSign SWIFT_PRIVATE;
|
|
47
|
+
std::string currency SWIFT_PRIVATE;
|
|
48
|
+
std::string nan SWIFT_PRIVATE;
|
|
49
|
+
std::string infinity SWIFT_PRIVATE;
|
|
50
|
+
std::string exponentSeparator SWIFT_PRIVATE;
|
|
51
|
+
|
|
52
|
+
public:
|
|
53
|
+
NumberFormatPlatformSymbols() = default;
|
|
54
|
+
explicit NumberFormatPlatformSymbols(std::string locale, std::string numberingSystem, std::string minusSign, std::string plusSign, std::string percentSign, std::string currency, std::string nan, std::string infinity, std::string exponentSeparator): locale(locale), numberingSystem(numberingSystem), minusSign(minusSign), plusSign(plusSign), percentSign(percentSign), currency(currency), nan(nan), infinity(infinity), exponentSeparator(exponentSeparator) {}
|
|
55
|
+
|
|
56
|
+
public:
|
|
57
|
+
friend bool operator==(const NumberFormatPlatformSymbols& lhs, const NumberFormatPlatformSymbols& rhs) = default;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
} // namespace margelo::nitro::nitroinput
|
|
61
|
+
|
|
62
|
+
namespace margelo::nitro {
|
|
63
|
+
|
|
64
|
+
// C++ NumberFormatPlatformSymbols <> JS NumberFormatPlatformSymbols (object)
|
|
65
|
+
template <>
|
|
66
|
+
struct JSIConverter<margelo::nitro::nitroinput::NumberFormatPlatformSymbols> final {
|
|
67
|
+
static inline margelo::nitro::nitroinput::NumberFormatPlatformSymbols fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
68
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
69
|
+
return margelo::nitro::nitroinput::NumberFormatPlatformSymbols(
|
|
70
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "locale"))),
|
|
71
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "numberingSystem"))),
|
|
72
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "minusSign"))),
|
|
73
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "plusSign"))),
|
|
74
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "percentSign"))),
|
|
75
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "currency"))),
|
|
76
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "nan"))),
|
|
77
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "infinity"))),
|
|
78
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "exponentSeparator")))
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitroinput::NumberFormatPlatformSymbols& arg) {
|
|
82
|
+
jsi::Object obj(runtime);
|
|
83
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "locale"), JSIConverter<std::string>::toJSI(runtime, arg.locale));
|
|
84
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "numberingSystem"), JSIConverter<std::string>::toJSI(runtime, arg.numberingSystem));
|
|
85
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "minusSign"), JSIConverter<std::string>::toJSI(runtime, arg.minusSign));
|
|
86
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "plusSign"), JSIConverter<std::string>::toJSI(runtime, arg.plusSign));
|
|
87
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "percentSign"), JSIConverter<std::string>::toJSI(runtime, arg.percentSign));
|
|
88
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "currency"), JSIConverter<std::string>::toJSI(runtime, arg.currency));
|
|
89
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "nan"), JSIConverter<std::string>::toJSI(runtime, arg.nan));
|
|
90
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "infinity"), JSIConverter<std::string>::toJSI(runtime, arg.infinity));
|
|
91
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "exponentSeparator"), JSIConverter<std::string>::toJSI(runtime, arg.exponentSeparator));
|
|
92
|
+
return obj;
|
|
93
|
+
}
|
|
94
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
95
|
+
if (!value.isObject()) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
jsi::Object obj = value.getObject(runtime);
|
|
99
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "locale")))) return false;
|
|
103
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "numberingSystem")))) return false;
|
|
104
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "minusSign")))) return false;
|
|
105
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "plusSign")))) return false;
|
|
106
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "percentSign")))) return false;
|
|
107
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "currency")))) return false;
|
|
108
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "nan")))) return false;
|
|
109
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "infinity")))) return false;
|
|
110
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "exponentSeparator")))) return false;
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NumberFormatRoundingMode.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 (NumberFormatRoundingMode).
|
|
30
|
+
*/
|
|
31
|
+
enum class NumberFormatRoundingMode {
|
|
32
|
+
CEIL SWIFT_NAME(ceil) = 0,
|
|
33
|
+
FLOOR SWIFT_NAME(floor) = 1,
|
|
34
|
+
EXPAND SWIFT_NAME(expand) = 2,
|
|
35
|
+
TRUNC SWIFT_NAME(trunc) = 3,
|
|
36
|
+
HALFCEIL SWIFT_NAME(halfceil) = 4,
|
|
37
|
+
HALFFLOOR SWIFT_NAME(halffloor) = 5,
|
|
38
|
+
HALFEXPAND SWIFT_NAME(halfexpand) = 6,
|
|
39
|
+
HALFTRUNC SWIFT_NAME(halftrunc) = 7,
|
|
40
|
+
HALFEVEN SWIFT_NAME(halfeven) = 8,
|
|
41
|
+
} CLOSED_ENUM;
|
|
42
|
+
|
|
43
|
+
} // namespace margelo::nitro::nitroinput
|
|
44
|
+
|
|
45
|
+
namespace margelo::nitro {
|
|
46
|
+
|
|
47
|
+
// C++ NumberFormatRoundingMode <> JS NumberFormatRoundingMode (union)
|
|
48
|
+
template <>
|
|
49
|
+
struct JSIConverter<margelo::nitro::nitroinput::NumberFormatRoundingMode> final {
|
|
50
|
+
static inline margelo::nitro::nitroinput::NumberFormatRoundingMode fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
51
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
52
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
53
|
+
case hashString("ceil"): return margelo::nitro::nitroinput::NumberFormatRoundingMode::CEIL;
|
|
54
|
+
case hashString("floor"): return margelo::nitro::nitroinput::NumberFormatRoundingMode::FLOOR;
|
|
55
|
+
case hashString("expand"): return margelo::nitro::nitroinput::NumberFormatRoundingMode::EXPAND;
|
|
56
|
+
case hashString("trunc"): return margelo::nitro::nitroinput::NumberFormatRoundingMode::TRUNC;
|
|
57
|
+
case hashString("halfCeil"): return margelo::nitro::nitroinput::NumberFormatRoundingMode::HALFCEIL;
|
|
58
|
+
case hashString("halfFloor"): return margelo::nitro::nitroinput::NumberFormatRoundingMode::HALFFLOOR;
|
|
59
|
+
case hashString("halfExpand"): return margelo::nitro::nitroinput::NumberFormatRoundingMode::HALFEXPAND;
|
|
60
|
+
case hashString("halfTrunc"): return margelo::nitro::nitroinput::NumberFormatRoundingMode::HALFTRUNC;
|
|
61
|
+
case hashString("halfEven"): return margelo::nitro::nitroinput::NumberFormatRoundingMode::HALFEVEN;
|
|
62
|
+
default: [[unlikely]]
|
|
63
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum NumberFormatRoundingMode - invalid value!");
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::nitroinput::NumberFormatRoundingMode arg) {
|
|
67
|
+
switch (arg) {
|
|
68
|
+
case margelo::nitro::nitroinput::NumberFormatRoundingMode::CEIL: return JSIConverter<std::string>::toJSI(runtime, "ceil");
|
|
69
|
+
case margelo::nitro::nitroinput::NumberFormatRoundingMode::FLOOR: return JSIConverter<std::string>::toJSI(runtime, "floor");
|
|
70
|
+
case margelo::nitro::nitroinput::NumberFormatRoundingMode::EXPAND: return JSIConverter<std::string>::toJSI(runtime, "expand");
|
|
71
|
+
case margelo::nitro::nitroinput::NumberFormatRoundingMode::TRUNC: return JSIConverter<std::string>::toJSI(runtime, "trunc");
|
|
72
|
+
case margelo::nitro::nitroinput::NumberFormatRoundingMode::HALFCEIL: return JSIConverter<std::string>::toJSI(runtime, "halfCeil");
|
|
73
|
+
case margelo::nitro::nitroinput::NumberFormatRoundingMode::HALFFLOOR: return JSIConverter<std::string>::toJSI(runtime, "halfFloor");
|
|
74
|
+
case margelo::nitro::nitroinput::NumberFormatRoundingMode::HALFEXPAND: return JSIConverter<std::string>::toJSI(runtime, "halfExpand");
|
|
75
|
+
case margelo::nitro::nitroinput::NumberFormatRoundingMode::HALFTRUNC: return JSIConverter<std::string>::toJSI(runtime, "halfTrunc");
|
|
76
|
+
case margelo::nitro::nitroinput::NumberFormatRoundingMode::HALFEVEN: return JSIConverter<std::string>::toJSI(runtime, "halfEven");
|
|
77
|
+
default: [[unlikely]]
|
|
78
|
+
throw std::invalid_argument("Cannot convert NumberFormatRoundingMode to JS - invalid value: "
|
|
79
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
83
|
+
if (!value.isString()) {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
87
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
88
|
+
case hashString("ceil"):
|
|
89
|
+
case hashString("floor"):
|
|
90
|
+
case hashString("expand"):
|
|
91
|
+
case hashString("trunc"):
|
|
92
|
+
case hashString("halfCeil"):
|
|
93
|
+
case hashString("halfFloor"):
|
|
94
|
+
case hashString("halfExpand"):
|
|
95
|
+
case hashString("halfTrunc"):
|
|
96
|
+
case hashString("halfEven"):
|
|
97
|
+
return true;
|
|
98
|
+
default:
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NumberFormatRoundingPriority.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 (NumberFormatRoundingPriority).
|
|
30
|
+
*/
|
|
31
|
+
enum class NumberFormatRoundingPriority {
|
|
32
|
+
AUTO SWIFT_NAME(auto) = 0,
|
|
33
|
+
MOREPRECISION SWIFT_NAME(moreprecision) = 1,
|
|
34
|
+
LESSPRECISION SWIFT_NAME(lessprecision) = 2,
|
|
35
|
+
} CLOSED_ENUM;
|
|
36
|
+
|
|
37
|
+
} // namespace margelo::nitro::nitroinput
|
|
38
|
+
|
|
39
|
+
namespace margelo::nitro {
|
|
40
|
+
|
|
41
|
+
// C++ NumberFormatRoundingPriority <> JS NumberFormatRoundingPriority (union)
|
|
42
|
+
template <>
|
|
43
|
+
struct JSIConverter<margelo::nitro::nitroinput::NumberFormatRoundingPriority> final {
|
|
44
|
+
static inline margelo::nitro::nitroinput::NumberFormatRoundingPriority 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::NumberFormatRoundingPriority::AUTO;
|
|
48
|
+
case hashString("morePrecision"): return margelo::nitro::nitroinput::NumberFormatRoundingPriority::MOREPRECISION;
|
|
49
|
+
case hashString("lessPrecision"): return margelo::nitro::nitroinput::NumberFormatRoundingPriority::LESSPRECISION;
|
|
50
|
+
default: [[unlikely]]
|
|
51
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum NumberFormatRoundingPriority - invalid value!");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::nitroinput::NumberFormatRoundingPriority arg) {
|
|
55
|
+
switch (arg) {
|
|
56
|
+
case margelo::nitro::nitroinput::NumberFormatRoundingPriority::AUTO: return JSIConverter<std::string>::toJSI(runtime, "auto");
|
|
57
|
+
case margelo::nitro::nitroinput::NumberFormatRoundingPriority::MOREPRECISION: return JSIConverter<std::string>::toJSI(runtime, "morePrecision");
|
|
58
|
+
case margelo::nitro::nitroinput::NumberFormatRoundingPriority::LESSPRECISION: return JSIConverter<std::string>::toJSI(runtime, "lessPrecision");
|
|
59
|
+
default: [[unlikely]]
|
|
60
|
+
throw std::invalid_argument("Cannot convert NumberFormatRoundingPriority 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("morePrecision"):
|
|
72
|
+
case hashString("lessPrecision"):
|
|
73
|
+
return true;
|
|
74
|
+
default:
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NumberFormatSignDisplay.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 (NumberFormatSignDisplay).
|
|
30
|
+
*/
|
|
31
|
+
enum class NumberFormatSignDisplay {
|
|
32
|
+
AUTO SWIFT_NAME(auto) = 0,
|
|
33
|
+
ALWAYS SWIFT_NAME(always) = 1,
|
|
34
|
+
NEVER SWIFT_NAME(never) = 2,
|
|
35
|
+
EXCEPTZERO SWIFT_NAME(exceptzero) = 3,
|
|
36
|
+
NEGATIVE SWIFT_NAME(negative) = 4,
|
|
37
|
+
} CLOSED_ENUM;
|
|
38
|
+
|
|
39
|
+
} // namespace margelo::nitro::nitroinput
|
|
40
|
+
|
|
41
|
+
namespace margelo::nitro {
|
|
42
|
+
|
|
43
|
+
// C++ NumberFormatSignDisplay <> JS NumberFormatSignDisplay (union)
|
|
44
|
+
template <>
|
|
45
|
+
struct JSIConverter<margelo::nitro::nitroinput::NumberFormatSignDisplay> final {
|
|
46
|
+
static inline margelo::nitro::nitroinput::NumberFormatSignDisplay fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
47
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
48
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
49
|
+
case hashString("auto"): return margelo::nitro::nitroinput::NumberFormatSignDisplay::AUTO;
|
|
50
|
+
case hashString("always"): return margelo::nitro::nitroinput::NumberFormatSignDisplay::ALWAYS;
|
|
51
|
+
case hashString("never"): return margelo::nitro::nitroinput::NumberFormatSignDisplay::NEVER;
|
|
52
|
+
case hashString("exceptZero"): return margelo::nitro::nitroinput::NumberFormatSignDisplay::EXCEPTZERO;
|
|
53
|
+
case hashString("negative"): return margelo::nitro::nitroinput::NumberFormatSignDisplay::NEGATIVE;
|
|
54
|
+
default: [[unlikely]]
|
|
55
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum NumberFormatSignDisplay - invalid value!");
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::nitroinput::NumberFormatSignDisplay arg) {
|
|
59
|
+
switch (arg) {
|
|
60
|
+
case margelo::nitro::nitroinput::NumberFormatSignDisplay::AUTO: return JSIConverter<std::string>::toJSI(runtime, "auto");
|
|
61
|
+
case margelo::nitro::nitroinput::NumberFormatSignDisplay::ALWAYS: return JSIConverter<std::string>::toJSI(runtime, "always");
|
|
62
|
+
case margelo::nitro::nitroinput::NumberFormatSignDisplay::NEVER: return JSIConverter<std::string>::toJSI(runtime, "never");
|
|
63
|
+
case margelo::nitro::nitroinput::NumberFormatSignDisplay::EXCEPTZERO: return JSIConverter<std::string>::toJSI(runtime, "exceptZero");
|
|
64
|
+
case margelo::nitro::nitroinput::NumberFormatSignDisplay::NEGATIVE: return JSIConverter<std::string>::toJSI(runtime, "negative");
|
|
65
|
+
default: [[unlikely]]
|
|
66
|
+
throw std::invalid_argument("Cannot convert NumberFormatSignDisplay to JS - invalid value: "
|
|
67
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
71
|
+
if (!value.isString()) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
75
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
76
|
+
case hashString("auto"):
|
|
77
|
+
case hashString("always"):
|
|
78
|
+
case hashString("never"):
|
|
79
|
+
case hashString("exceptZero"):
|
|
80
|
+
case hashString("negative"):
|
|
81
|
+
return true;
|
|
82
|
+
default:
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NumberFormatStyle.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 (NumberFormatStyle).
|
|
30
|
+
*/
|
|
31
|
+
enum class NumberFormatStyle {
|
|
32
|
+
DECIMAL SWIFT_NAME(decimal) = 0,
|
|
33
|
+
CURRENCY SWIFT_NAME(currency) = 1,
|
|
34
|
+
PERCENT SWIFT_NAME(percent) = 2,
|
|
35
|
+
UNIT SWIFT_NAME(unit) = 3,
|
|
36
|
+
} CLOSED_ENUM;
|
|
37
|
+
|
|
38
|
+
} // namespace margelo::nitro::nitroinput
|
|
39
|
+
|
|
40
|
+
namespace margelo::nitro {
|
|
41
|
+
|
|
42
|
+
// C++ NumberFormatStyle <> JS NumberFormatStyle (union)
|
|
43
|
+
template <>
|
|
44
|
+
struct JSIConverter<margelo::nitro::nitroinput::NumberFormatStyle> final {
|
|
45
|
+
static inline margelo::nitro::nitroinput::NumberFormatStyle 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("decimal"): return margelo::nitro::nitroinput::NumberFormatStyle::DECIMAL;
|
|
49
|
+
case hashString("currency"): return margelo::nitro::nitroinput::NumberFormatStyle::CURRENCY;
|
|
50
|
+
case hashString("percent"): return margelo::nitro::nitroinput::NumberFormatStyle::PERCENT;
|
|
51
|
+
case hashString("unit"): return margelo::nitro::nitroinput::NumberFormatStyle::UNIT;
|
|
52
|
+
default: [[unlikely]]
|
|
53
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum NumberFormatStyle - invalid value!");
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::nitroinput::NumberFormatStyle arg) {
|
|
57
|
+
switch (arg) {
|
|
58
|
+
case margelo::nitro::nitroinput::NumberFormatStyle::DECIMAL: return JSIConverter<std::string>::toJSI(runtime, "decimal");
|
|
59
|
+
case margelo::nitro::nitroinput::NumberFormatStyle::CURRENCY: return JSIConverter<std::string>::toJSI(runtime, "currency");
|
|
60
|
+
case margelo::nitro::nitroinput::NumberFormatStyle::PERCENT: return JSIConverter<std::string>::toJSI(runtime, "percent");
|
|
61
|
+
case margelo::nitro::nitroinput::NumberFormatStyle::UNIT: return JSIConverter<std::string>::toJSI(runtime, "unit");
|
|
62
|
+
default: [[unlikely]]
|
|
63
|
+
throw std::invalid_argument("Cannot convert NumberFormatStyle 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("decimal"):
|
|
74
|
+
case hashString("currency"):
|
|
75
|
+
case hashString("percent"):
|
|
76
|
+
case hashString("unit"):
|
|
77
|
+
return true;
|
|
78
|
+
default:
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NumberFormatTrailingZeroDisplay.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 (NumberFormatTrailingZeroDisplay).
|
|
30
|
+
*/
|
|
31
|
+
enum class NumberFormatTrailingZeroDisplay {
|
|
32
|
+
AUTO SWIFT_NAME(auto) = 0,
|
|
33
|
+
STRIPIFINTEGER SWIFT_NAME(stripifinteger) = 1,
|
|
34
|
+
} CLOSED_ENUM;
|
|
35
|
+
|
|
36
|
+
} // namespace margelo::nitro::nitroinput
|
|
37
|
+
|
|
38
|
+
namespace margelo::nitro {
|
|
39
|
+
|
|
40
|
+
// C++ NumberFormatTrailingZeroDisplay <> JS NumberFormatTrailingZeroDisplay (union)
|
|
41
|
+
template <>
|
|
42
|
+
struct JSIConverter<margelo::nitro::nitroinput::NumberFormatTrailingZeroDisplay> final {
|
|
43
|
+
static inline margelo::nitro::nitroinput::NumberFormatTrailingZeroDisplay fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
44
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
45
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
46
|
+
case hashString("auto"): return margelo::nitro::nitroinput::NumberFormatTrailingZeroDisplay::AUTO;
|
|
47
|
+
case hashString("stripIfInteger"): return margelo::nitro::nitroinput::NumberFormatTrailingZeroDisplay::STRIPIFINTEGER;
|
|
48
|
+
default: [[unlikely]]
|
|
49
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum NumberFormatTrailingZeroDisplay - invalid value!");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::nitroinput::NumberFormatTrailingZeroDisplay arg) {
|
|
53
|
+
switch (arg) {
|
|
54
|
+
case margelo::nitro::nitroinput::NumberFormatTrailingZeroDisplay::AUTO: return JSIConverter<std::string>::toJSI(runtime, "auto");
|
|
55
|
+
case margelo::nitro::nitroinput::NumberFormatTrailingZeroDisplay::STRIPIFINTEGER: return JSIConverter<std::string>::toJSI(runtime, "stripIfInteger");
|
|
56
|
+
default: [[unlikely]]
|
|
57
|
+
throw std::invalid_argument("Cannot convert NumberFormatTrailingZeroDisplay to JS - invalid value: "
|
|
58
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
62
|
+
if (!value.isString()) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
66
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
67
|
+
case hashString("auto"):
|
|
68
|
+
case hashString("stripIfInteger"):
|
|
69
|
+
return true;
|
|
70
|
+
default:
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NumberFormatUnitDisplay.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 (NumberFormatUnitDisplay).
|
|
30
|
+
*/
|
|
31
|
+
enum class NumberFormatUnitDisplay {
|
|
32
|
+
SHORT SWIFT_NAME(short) = 0,
|
|
33
|
+
NARROW SWIFT_NAME(narrow) = 1,
|
|
34
|
+
LONG SWIFT_NAME(long) = 2,
|
|
35
|
+
} CLOSED_ENUM;
|
|
36
|
+
|
|
37
|
+
} // namespace margelo::nitro::nitroinput
|
|
38
|
+
|
|
39
|
+
namespace margelo::nitro {
|
|
40
|
+
|
|
41
|
+
// C++ NumberFormatUnitDisplay <> JS NumberFormatUnitDisplay (union)
|
|
42
|
+
template <>
|
|
43
|
+
struct JSIConverter<margelo::nitro::nitroinput::NumberFormatUnitDisplay> final {
|
|
44
|
+
static inline margelo::nitro::nitroinput::NumberFormatUnitDisplay 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("short"): return margelo::nitro::nitroinput::NumberFormatUnitDisplay::SHORT;
|
|
48
|
+
case hashString("narrow"): return margelo::nitro::nitroinput::NumberFormatUnitDisplay::NARROW;
|
|
49
|
+
case hashString("long"): return margelo::nitro::nitroinput::NumberFormatUnitDisplay::LONG;
|
|
50
|
+
default: [[unlikely]]
|
|
51
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum NumberFormatUnitDisplay - invalid value!");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::nitroinput::NumberFormatUnitDisplay arg) {
|
|
55
|
+
switch (arg) {
|
|
56
|
+
case margelo::nitro::nitroinput::NumberFormatUnitDisplay::SHORT: return JSIConverter<std::string>::toJSI(runtime, "short");
|
|
57
|
+
case margelo::nitro::nitroinput::NumberFormatUnitDisplay::NARROW: return JSIConverter<std::string>::toJSI(runtime, "narrow");
|
|
58
|
+
case margelo::nitro::nitroinput::NumberFormatUnitDisplay::LONG: return JSIConverter<std::string>::toJSI(runtime, "long");
|
|
59
|
+
default: [[unlikely]]
|
|
60
|
+
throw std::invalid_argument("Cannot convert NumberFormatUnitDisplay 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("short"):
|
|
71
|
+
case hashString("narrow"):
|
|
72
|
+
case hashString("long"):
|
|
73
|
+
return true;
|
|
74
|
+
default:
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
} // namespace margelo::nitro
|