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,70 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNitroNumberFormatFactorySpec.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/HybridObject.hpp>)
|
|
11
|
+
#include <NitroModules/HybridObject.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
// Forward declaration of `HybridNitroNumberFormatSpec` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::nitroinput { class HybridNitroNumberFormatSpec; }
|
|
18
|
+
// Forward declaration of `NumberFormatOptions` to properly resolve imports.
|
|
19
|
+
namespace margelo::nitro::nitroinput { struct NumberFormatOptions; }
|
|
20
|
+
|
|
21
|
+
#include <memory>
|
|
22
|
+
#include "HybridNitroNumberFormatSpec.hpp"
|
|
23
|
+
#include <string>
|
|
24
|
+
#include <vector>
|
|
25
|
+
#include "NumberFormatOptions.hpp"
|
|
26
|
+
|
|
27
|
+
namespace margelo::nitro::nitroinput {
|
|
28
|
+
|
|
29
|
+
using namespace margelo::nitro;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* An abstract base class for `NitroNumberFormatFactory`
|
|
33
|
+
* Inherit this class to create instances of `HybridNitroNumberFormatFactorySpec` in C++.
|
|
34
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
35
|
+
* @example
|
|
36
|
+
* ```cpp
|
|
37
|
+
* class HybridNitroNumberFormatFactory: public HybridNitroNumberFormatFactorySpec {
|
|
38
|
+
* public:
|
|
39
|
+
* HybridNitroNumberFormatFactory(...): HybridObject(TAG) { ... }
|
|
40
|
+
* // ...
|
|
41
|
+
* };
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
class HybridNitroNumberFormatFactorySpec: public virtual HybridObject {
|
|
45
|
+
public:
|
|
46
|
+
// Constructor
|
|
47
|
+
explicit HybridNitroNumberFormatFactorySpec(): HybridObject(TAG) { }
|
|
48
|
+
|
|
49
|
+
// Destructor
|
|
50
|
+
~HybridNitroNumberFormatFactorySpec() override = default;
|
|
51
|
+
|
|
52
|
+
public:
|
|
53
|
+
// Properties
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
public:
|
|
57
|
+
// Methods
|
|
58
|
+
virtual std::shared_ptr<HybridNitroNumberFormatSpec> create(const std::vector<std::string>& locales, const NumberFormatOptions& options) = 0;
|
|
59
|
+
virtual std::vector<std::string> supportedLocalesOf(const std::vector<std::string>& locales) = 0;
|
|
60
|
+
|
|
61
|
+
protected:
|
|
62
|
+
// Hybrid Setup
|
|
63
|
+
void loadHybridMethods() override;
|
|
64
|
+
|
|
65
|
+
protected:
|
|
66
|
+
// Tag for logging
|
|
67
|
+
static constexpr auto TAG = "NitroNumberFormatFactory";
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
} // namespace margelo::nitro::nitroinput
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNitroNumberFormatPlatformSpec.cpp
|
|
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
|
+
#include "HybridNitroNumberFormatPlatformSpec.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::nitroinput {
|
|
11
|
+
|
|
12
|
+
void HybridNitroNumberFormatPlatformSpec::loadHybridMethods() {
|
|
13
|
+
// load base methods/properties
|
|
14
|
+
HybridObject::loadHybridMethods();
|
|
15
|
+
// load custom methods/properties
|
|
16
|
+
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
prototype.registerHybridMethod("create", &HybridNitroNumberFormatPlatformSpec::create);
|
|
18
|
+
prototype.registerHybridMethod("supportedLocalesOf", &HybridNitroNumberFormatPlatformSpec::supportedLocalesOf);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
} // namespace margelo::nitro::nitroinput
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNitroNumberFormatPlatformSpec.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/HybridObject.hpp>)
|
|
11
|
+
#include <NitroModules/HybridObject.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
// Forward declaration of `HybridNitroPlatformNumberFormatterSpec` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::nitroinput { class HybridNitroPlatformNumberFormatterSpec; }
|
|
18
|
+
// Forward declaration of `NumberFormatPlatformOptions` to properly resolve imports.
|
|
19
|
+
namespace margelo::nitro::nitroinput { struct NumberFormatPlatformOptions; }
|
|
20
|
+
|
|
21
|
+
#include <memory>
|
|
22
|
+
#include "HybridNitroPlatformNumberFormatterSpec.hpp"
|
|
23
|
+
#include "NumberFormatPlatformOptions.hpp"
|
|
24
|
+
#include <string>
|
|
25
|
+
#include <vector>
|
|
26
|
+
|
|
27
|
+
namespace margelo::nitro::nitroinput {
|
|
28
|
+
|
|
29
|
+
using namespace margelo::nitro;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* An abstract base class for `NitroNumberFormatPlatform`
|
|
33
|
+
* Inherit this class to create instances of `HybridNitroNumberFormatPlatformSpec` in C++.
|
|
34
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
35
|
+
* @example
|
|
36
|
+
* ```cpp
|
|
37
|
+
* class HybridNitroNumberFormatPlatform: public HybridNitroNumberFormatPlatformSpec {
|
|
38
|
+
* public:
|
|
39
|
+
* HybridNitroNumberFormatPlatform(...): HybridObject(TAG) { ... }
|
|
40
|
+
* // ...
|
|
41
|
+
* };
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
class HybridNitroNumberFormatPlatformSpec: public virtual HybridObject {
|
|
45
|
+
public:
|
|
46
|
+
// Constructor
|
|
47
|
+
explicit HybridNitroNumberFormatPlatformSpec(): HybridObject(TAG) { }
|
|
48
|
+
|
|
49
|
+
// Destructor
|
|
50
|
+
~HybridNitroNumberFormatPlatformSpec() override = default;
|
|
51
|
+
|
|
52
|
+
public:
|
|
53
|
+
// Properties
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
public:
|
|
57
|
+
// Methods
|
|
58
|
+
virtual std::shared_ptr<HybridNitroPlatformNumberFormatterSpec> create(const NumberFormatPlatformOptions& options) = 0;
|
|
59
|
+
virtual std::vector<std::string> supportedLocalesOf(const std::vector<std::string>& locales) = 0;
|
|
60
|
+
|
|
61
|
+
protected:
|
|
62
|
+
// Hybrid Setup
|
|
63
|
+
void loadHybridMethods() override;
|
|
64
|
+
|
|
65
|
+
protected:
|
|
66
|
+
// Tag for logging
|
|
67
|
+
static constexpr auto TAG = "NitroNumberFormatPlatform";
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
} // namespace margelo::nitro::nitroinput
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNitroNumberFormatSpec.cpp
|
|
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
|
+
#include "HybridNitroNumberFormatSpec.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::nitroinput {
|
|
11
|
+
|
|
12
|
+
void HybridNitroNumberFormatSpec::loadHybridMethods() {
|
|
13
|
+
// load base methods/properties
|
|
14
|
+
HybridObject::loadHybridMethods();
|
|
15
|
+
// load custom methods/properties
|
|
16
|
+
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
prototype.registerHybridMethod("format", &HybridNitroNumberFormatSpec::format);
|
|
18
|
+
prototype.registerHybridMethod("formatToParts", &HybridNitroNumberFormatSpec::formatToParts);
|
|
19
|
+
prototype.registerHybridMethod("resolvedOptions", &HybridNitroNumberFormatSpec::resolvedOptions);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
} // namespace margelo::nitro::nitroinput
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNitroNumberFormatSpec.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/HybridObject.hpp>)
|
|
11
|
+
#include <NitroModules/HybridObject.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
// Forward declaration of `NumberFormatPart` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::nitroinput { struct NumberFormatPart; }
|
|
18
|
+
// Forward declaration of `ResolvedNumberFormatOptions` to properly resolve imports.
|
|
19
|
+
namespace margelo::nitro::nitroinput { struct ResolvedNumberFormatOptions; }
|
|
20
|
+
|
|
21
|
+
#include <string>
|
|
22
|
+
#include <variant>
|
|
23
|
+
#include "NumberFormatPart.hpp"
|
|
24
|
+
#include <vector>
|
|
25
|
+
#include "ResolvedNumberFormatOptions.hpp"
|
|
26
|
+
|
|
27
|
+
namespace margelo::nitro::nitroinput {
|
|
28
|
+
|
|
29
|
+
using namespace margelo::nitro;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* An abstract base class for `NitroNumberFormat`
|
|
33
|
+
* Inherit this class to create instances of `HybridNitroNumberFormatSpec` in C++.
|
|
34
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
35
|
+
* @example
|
|
36
|
+
* ```cpp
|
|
37
|
+
* class HybridNitroNumberFormat: public HybridNitroNumberFormatSpec {
|
|
38
|
+
* public:
|
|
39
|
+
* HybridNitroNumberFormat(...): HybridObject(TAG) { ... }
|
|
40
|
+
* // ...
|
|
41
|
+
* };
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
class HybridNitroNumberFormatSpec: public virtual HybridObject {
|
|
45
|
+
public:
|
|
46
|
+
// Constructor
|
|
47
|
+
explicit HybridNitroNumberFormatSpec(): HybridObject(TAG) { }
|
|
48
|
+
|
|
49
|
+
// Destructor
|
|
50
|
+
~HybridNitroNumberFormatSpec() override = default;
|
|
51
|
+
|
|
52
|
+
public:
|
|
53
|
+
// Properties
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
public:
|
|
57
|
+
// Methods
|
|
58
|
+
virtual std::string format(const std::variant<int64_t, double, std::string>& value) = 0;
|
|
59
|
+
virtual std::vector<NumberFormatPart> formatToParts(const std::variant<int64_t, double, std::string>& value) = 0;
|
|
60
|
+
virtual ResolvedNumberFormatOptions resolvedOptions() = 0;
|
|
61
|
+
|
|
62
|
+
protected:
|
|
63
|
+
// Hybrid Setup
|
|
64
|
+
void loadHybridMethods() override;
|
|
65
|
+
|
|
66
|
+
protected:
|
|
67
|
+
// Tag for logging
|
|
68
|
+
static constexpr auto TAG = "NitroNumberFormat";
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
} // namespace margelo::nitro::nitroinput
|
|
@@ -82,6 +82,18 @@ namespace margelo::nitro::nitroinput {
|
|
|
82
82
|
prototype.registerHybridSetter("prefixAlign", &HybridNitroNumberViewSpec::setPrefixAlign);
|
|
83
83
|
prototype.registerHybridGetter("suffixAlign", &HybridNitroNumberViewSpec::getSuffixAlign);
|
|
84
84
|
prototype.registerHybridSetter("suffixAlign", &HybridNitroNumberViewSpec::setSuffixAlign);
|
|
85
|
+
prototype.registerHybridGetter("letterSpacing", &HybridNitroNumberViewSpec::getLetterSpacing);
|
|
86
|
+
prototype.registerHybridSetter("letterSpacing", &HybridNitroNumberViewSpec::setLetterSpacing);
|
|
87
|
+
prototype.registerHybridGetter("prefixSpacing", &HybridNitroNumberViewSpec::getPrefixSpacing);
|
|
88
|
+
prototype.registerHybridSetter("prefixSpacing", &HybridNitroNumberViewSpec::setPrefixSpacing);
|
|
89
|
+
prototype.registerHybridGetter("suffixSpacing", &HybridNitroNumberViewSpec::getSuffixSpacing);
|
|
90
|
+
prototype.registerHybridSetter("suffixSpacing", &HybridNitroNumberViewSpec::setSuffixSpacing);
|
|
91
|
+
prototype.registerHybridGetter("prefixOffset", &HybridNitroNumberViewSpec::getPrefixOffset);
|
|
92
|
+
prototype.registerHybridSetter("prefixOffset", &HybridNitroNumberViewSpec::setPrefixOffset);
|
|
93
|
+
prototype.registerHybridGetter("suffixOffset", &HybridNitroNumberViewSpec::getSuffixOffset);
|
|
94
|
+
prototype.registerHybridSetter("suffixOffset", &HybridNitroNumberViewSpec::setSuffixOffset);
|
|
95
|
+
prototype.registerHybridGetter("tabularNums", &HybridNitroNumberViewSpec::getTabularNums);
|
|
96
|
+
prototype.registerHybridSetter("tabularNums", &HybridNitroNumberViewSpec::setTabularNums);
|
|
85
97
|
prototype.registerHybridGetter("adjustsFontSizeToFit", &HybridNitroNumberViewSpec::getAdjustsFontSizeToFit);
|
|
86
98
|
prototype.registerHybridSetter("adjustsFontSizeToFit", &HybridNitroNumberViewSpec::setAdjustsFontSizeToFit);
|
|
87
99
|
prototype.registerHybridGetter("minimumFontScale", &HybridNitroNumberViewSpec::getMinimumFontScale);
|
|
@@ -132,6 +132,18 @@ namespace margelo::nitro::nitroinput {
|
|
|
132
132
|
virtual void setPrefixAlign(std::optional<NitroNumberAffixAlign> prefixAlign) = 0;
|
|
133
133
|
virtual std::optional<NitroNumberAffixAlign> getSuffixAlign() = 0;
|
|
134
134
|
virtual void setSuffixAlign(std::optional<NitroNumberAffixAlign> suffixAlign) = 0;
|
|
135
|
+
virtual std::optional<double> getLetterSpacing() = 0;
|
|
136
|
+
virtual void setLetterSpacing(std::optional<double> letterSpacing) = 0;
|
|
137
|
+
virtual std::optional<double> getPrefixSpacing() = 0;
|
|
138
|
+
virtual void setPrefixSpacing(std::optional<double> prefixSpacing) = 0;
|
|
139
|
+
virtual std::optional<double> getSuffixSpacing() = 0;
|
|
140
|
+
virtual void setSuffixSpacing(std::optional<double> suffixSpacing) = 0;
|
|
141
|
+
virtual std::optional<double> getPrefixOffset() = 0;
|
|
142
|
+
virtual void setPrefixOffset(std::optional<double> prefixOffset) = 0;
|
|
143
|
+
virtual std::optional<double> getSuffixOffset() = 0;
|
|
144
|
+
virtual void setSuffixOffset(std::optional<double> suffixOffset) = 0;
|
|
145
|
+
virtual std::optional<bool> getTabularNums() = 0;
|
|
146
|
+
virtual void setTabularNums(std::optional<bool> tabularNums) = 0;
|
|
135
147
|
virtual std::optional<bool> getAdjustsFontSizeToFit() = 0;
|
|
136
148
|
virtual void setAdjustsFontSizeToFit(std::optional<bool> adjustsFontSizeToFit) = 0;
|
|
137
149
|
virtual std::optional<double> getMinimumFontScale() = 0;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNitroPlatformNumberFormatterSpec.cpp
|
|
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
|
+
#include "HybridNitroPlatformNumberFormatterSpec.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::nitroinput {
|
|
11
|
+
|
|
12
|
+
void HybridNitroPlatformNumberFormatterSpec::loadHybridMethods() {
|
|
13
|
+
// load base methods/properties
|
|
14
|
+
HybridObject::loadHybridMethods();
|
|
15
|
+
// load custom methods/properties
|
|
16
|
+
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
prototype.registerHybridGetter("symbols", &HybridNitroPlatformNumberFormatterSpec::getSymbols);
|
|
18
|
+
prototype.registerHybridMethod("format", &HybridNitroPlatformNumberFormatterSpec::format);
|
|
19
|
+
prototype.registerHybridMethod("formatDecimal", &HybridNitroPlatformNumberFormatterSpec::formatDecimal);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
} // namespace margelo::nitro::nitroinput
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNitroPlatformNumberFormatterSpec.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/HybridObject.hpp>)
|
|
11
|
+
#include <NitroModules/HybridObject.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
// Forward declaration of `NumberFormatPlatformSymbols` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::nitroinput { struct NumberFormatPlatformSymbols; }
|
|
18
|
+
|
|
19
|
+
#include "NumberFormatPlatformSymbols.hpp"
|
|
20
|
+
#include <string>
|
|
21
|
+
|
|
22
|
+
namespace margelo::nitro::nitroinput {
|
|
23
|
+
|
|
24
|
+
using namespace margelo::nitro;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* An abstract base class for `NitroPlatformNumberFormatter`
|
|
28
|
+
* Inherit this class to create instances of `HybridNitroPlatformNumberFormatterSpec` in C++.
|
|
29
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
30
|
+
* @example
|
|
31
|
+
* ```cpp
|
|
32
|
+
* class HybridNitroPlatformNumberFormatter: public HybridNitroPlatformNumberFormatterSpec {
|
|
33
|
+
* public:
|
|
34
|
+
* HybridNitroPlatformNumberFormatter(...): HybridObject(TAG) { ... }
|
|
35
|
+
* // ...
|
|
36
|
+
* };
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
class HybridNitroPlatformNumberFormatterSpec: public virtual HybridObject {
|
|
40
|
+
public:
|
|
41
|
+
// Constructor
|
|
42
|
+
explicit HybridNitroPlatformNumberFormatterSpec(): HybridObject(TAG) { }
|
|
43
|
+
|
|
44
|
+
// Destructor
|
|
45
|
+
~HybridNitroPlatformNumberFormatterSpec() override = default;
|
|
46
|
+
|
|
47
|
+
public:
|
|
48
|
+
// Properties
|
|
49
|
+
virtual NumberFormatPlatformSymbols getSymbols() = 0;
|
|
50
|
+
|
|
51
|
+
public:
|
|
52
|
+
// Methods
|
|
53
|
+
virtual std::string format(double value) = 0;
|
|
54
|
+
virtual std::string formatDecimal(const std::string& value) = 0;
|
|
55
|
+
|
|
56
|
+
protected:
|
|
57
|
+
// Hybrid Setup
|
|
58
|
+
void loadHybridMethods() override;
|
|
59
|
+
|
|
60
|
+
protected:
|
|
61
|
+
// Tag for logging
|
|
62
|
+
static constexpr auto TAG = "NitroPlatformNumberFormatter";
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
} // namespace margelo::nitro::nitroinput
|
|
@@ -32,6 +32,7 @@ namespace margelo::nitro::nitroinput {
|
|
|
32
32
|
AUTO SWIFT_NAME(auto) = 0,
|
|
33
33
|
UP SWIFT_NAME(up) = 1,
|
|
34
34
|
DOWN SWIFT_NAME(down) = 2,
|
|
35
|
+
SHORTEST SWIFT_NAME(shortest) = 3,
|
|
35
36
|
} CLOSED_ENUM;
|
|
36
37
|
|
|
37
38
|
} // namespace margelo::nitro::nitroinput
|
|
@@ -47,6 +48,7 @@ namespace margelo::nitro {
|
|
|
47
48
|
case hashString("auto"): return margelo::nitro::nitroinput::NitroNumberDirection::AUTO;
|
|
48
49
|
case hashString("up"): return margelo::nitro::nitroinput::NitroNumberDirection::UP;
|
|
49
50
|
case hashString("down"): return margelo::nitro::nitroinput::NitroNumberDirection::DOWN;
|
|
51
|
+
case hashString("shortest"): return margelo::nitro::nitroinput::NitroNumberDirection::SHORTEST;
|
|
50
52
|
default: [[unlikely]]
|
|
51
53
|
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum NitroNumberDirection - invalid value!");
|
|
52
54
|
}
|
|
@@ -56,6 +58,7 @@ namespace margelo::nitro {
|
|
|
56
58
|
case margelo::nitro::nitroinput::NitroNumberDirection::AUTO: return JSIConverter<std::string>::toJSI(runtime, "auto");
|
|
57
59
|
case margelo::nitro::nitroinput::NitroNumberDirection::UP: return JSIConverter<std::string>::toJSI(runtime, "up");
|
|
58
60
|
case margelo::nitro::nitroinput::NitroNumberDirection::DOWN: return JSIConverter<std::string>::toJSI(runtime, "down");
|
|
61
|
+
case margelo::nitro::nitroinput::NitroNumberDirection::SHORTEST: return JSIConverter<std::string>::toJSI(runtime, "shortest");
|
|
59
62
|
default: [[unlikely]]
|
|
60
63
|
throw std::invalid_argument("Cannot convert NitroNumberDirection to JS - invalid value: "
|
|
61
64
|
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
@@ -70,6 +73,7 @@ namespace margelo::nitro {
|
|
|
70
73
|
case hashString("auto"):
|
|
71
74
|
case hashString("up"):
|
|
72
75
|
case hashString("down"):
|
|
76
|
+
case hashString("shortest"):
|
|
73
77
|
return true;
|
|
74
78
|
default:
|
|
75
79
|
return false;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NumberFormatCompactDisplay.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 (NumberFormatCompactDisplay).
|
|
30
|
+
*/
|
|
31
|
+
enum class NumberFormatCompactDisplay {
|
|
32
|
+
SHORT SWIFT_NAME(short) = 0,
|
|
33
|
+
LONG SWIFT_NAME(long) = 1,
|
|
34
|
+
} CLOSED_ENUM;
|
|
35
|
+
|
|
36
|
+
} // namespace margelo::nitro::nitroinput
|
|
37
|
+
|
|
38
|
+
namespace margelo::nitro {
|
|
39
|
+
|
|
40
|
+
// C++ NumberFormatCompactDisplay <> JS NumberFormatCompactDisplay (union)
|
|
41
|
+
template <>
|
|
42
|
+
struct JSIConverter<margelo::nitro::nitroinput::NumberFormatCompactDisplay> final {
|
|
43
|
+
static inline margelo::nitro::nitroinput::NumberFormatCompactDisplay 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("short"): return margelo::nitro::nitroinput::NumberFormatCompactDisplay::SHORT;
|
|
47
|
+
case hashString("long"): return margelo::nitro::nitroinput::NumberFormatCompactDisplay::LONG;
|
|
48
|
+
default: [[unlikely]]
|
|
49
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum NumberFormatCompactDisplay - invalid value!");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::nitroinput::NumberFormatCompactDisplay arg) {
|
|
53
|
+
switch (arg) {
|
|
54
|
+
case margelo::nitro::nitroinput::NumberFormatCompactDisplay::SHORT: return JSIConverter<std::string>::toJSI(runtime, "short");
|
|
55
|
+
case margelo::nitro::nitroinput::NumberFormatCompactDisplay::LONG: return JSIConverter<std::string>::toJSI(runtime, "long");
|
|
56
|
+
default: [[unlikely]]
|
|
57
|
+
throw std::invalid_argument("Cannot convert NumberFormatCompactDisplay 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("short"):
|
|
68
|
+
case hashString("long"):
|
|
69
|
+
return true;
|
|
70
|
+
default:
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NumberFormatCurrencyDisplay.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 (NumberFormatCurrencyDisplay).
|
|
30
|
+
*/
|
|
31
|
+
enum class NumberFormatCurrencyDisplay {
|
|
32
|
+
SYMBOL SWIFT_NAME(symbol) = 0,
|
|
33
|
+
NARROWSYMBOL SWIFT_NAME(narrowsymbol) = 1,
|
|
34
|
+
CODE SWIFT_NAME(code) = 2,
|
|
35
|
+
NAME SWIFT_NAME(name) = 3,
|
|
36
|
+
} CLOSED_ENUM;
|
|
37
|
+
|
|
38
|
+
} // namespace margelo::nitro::nitroinput
|
|
39
|
+
|
|
40
|
+
namespace margelo::nitro {
|
|
41
|
+
|
|
42
|
+
// C++ NumberFormatCurrencyDisplay <> JS NumberFormatCurrencyDisplay (union)
|
|
43
|
+
template <>
|
|
44
|
+
struct JSIConverter<margelo::nitro::nitroinput::NumberFormatCurrencyDisplay> final {
|
|
45
|
+
static inline margelo::nitro::nitroinput::NumberFormatCurrencyDisplay 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("symbol"): return margelo::nitro::nitroinput::NumberFormatCurrencyDisplay::SYMBOL;
|
|
49
|
+
case hashString("narrowSymbol"): return margelo::nitro::nitroinput::NumberFormatCurrencyDisplay::NARROWSYMBOL;
|
|
50
|
+
case hashString("code"): return margelo::nitro::nitroinput::NumberFormatCurrencyDisplay::CODE;
|
|
51
|
+
case hashString("name"): return margelo::nitro::nitroinput::NumberFormatCurrencyDisplay::NAME;
|
|
52
|
+
default: [[unlikely]]
|
|
53
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum NumberFormatCurrencyDisplay - invalid value!");
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::nitroinput::NumberFormatCurrencyDisplay arg) {
|
|
57
|
+
switch (arg) {
|
|
58
|
+
case margelo::nitro::nitroinput::NumberFormatCurrencyDisplay::SYMBOL: return JSIConverter<std::string>::toJSI(runtime, "symbol");
|
|
59
|
+
case margelo::nitro::nitroinput::NumberFormatCurrencyDisplay::NARROWSYMBOL: return JSIConverter<std::string>::toJSI(runtime, "narrowSymbol");
|
|
60
|
+
case margelo::nitro::nitroinput::NumberFormatCurrencyDisplay::CODE: return JSIConverter<std::string>::toJSI(runtime, "code");
|
|
61
|
+
case margelo::nitro::nitroinput::NumberFormatCurrencyDisplay::NAME: return JSIConverter<std::string>::toJSI(runtime, "name");
|
|
62
|
+
default: [[unlikely]]
|
|
63
|
+
throw std::invalid_argument("Cannot convert NumberFormatCurrencyDisplay 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("symbol"):
|
|
74
|
+
case hashString("narrowSymbol"):
|
|
75
|
+
case hashString("code"):
|
|
76
|
+
case hashString("name"):
|
|
77
|
+
return true;
|
|
78
|
+
default:
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NumberFormatCurrencySign.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 (NumberFormatCurrencySign).
|
|
30
|
+
*/
|
|
31
|
+
enum class NumberFormatCurrencySign {
|
|
32
|
+
STANDARD SWIFT_NAME(standard) = 0,
|
|
33
|
+
ACCOUNTING SWIFT_NAME(accounting) = 1,
|
|
34
|
+
} CLOSED_ENUM;
|
|
35
|
+
|
|
36
|
+
} // namespace margelo::nitro::nitroinput
|
|
37
|
+
|
|
38
|
+
namespace margelo::nitro {
|
|
39
|
+
|
|
40
|
+
// C++ NumberFormatCurrencySign <> JS NumberFormatCurrencySign (union)
|
|
41
|
+
template <>
|
|
42
|
+
struct JSIConverter<margelo::nitro::nitroinput::NumberFormatCurrencySign> final {
|
|
43
|
+
static inline margelo::nitro::nitroinput::NumberFormatCurrencySign 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("standard"): return margelo::nitro::nitroinput::NumberFormatCurrencySign::STANDARD;
|
|
47
|
+
case hashString("accounting"): return margelo::nitro::nitroinput::NumberFormatCurrencySign::ACCOUNTING;
|
|
48
|
+
default: [[unlikely]]
|
|
49
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum NumberFormatCurrencySign - invalid value!");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::nitroinput::NumberFormatCurrencySign arg) {
|
|
53
|
+
switch (arg) {
|
|
54
|
+
case margelo::nitro::nitroinput::NumberFormatCurrencySign::STANDARD: return JSIConverter<std::string>::toJSI(runtime, "standard");
|
|
55
|
+
case margelo::nitro::nitroinput::NumberFormatCurrencySign::ACCOUNTING: return JSIConverter<std::string>::toJSI(runtime, "accounting");
|
|
56
|
+
default: [[unlikely]]
|
|
57
|
+
throw std::invalid_argument("Cannot convert NumberFormatCurrencySign 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("standard"):
|
|
68
|
+
case hashString("accounting"):
|
|
69
|
+
return true;
|
|
70
|
+
default:
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
} // namespace margelo::nitro
|