@imagowave/vision-ocr 0.0.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/NitroVisionOcr.podspec +32 -0
- package/README.md +38 -0
- package/android/CMakeLists.txt +31 -0
- package/android/build.gradle +143 -0
- package/android/fix-prefab.gradle +51 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/cpp-adapter.cpp +9 -0
- package/android/src/main/java/com/margelo/nitro/visionocr/NitroVisionOcrPackage.kt +18 -0
- package/android/src/main/java/com/margelo/nitro/visionocr/VisionOcr.kt +120 -0
- package/ios/Bridge.h +8 -0
- package/ios/VisionOCR.swift +137 -0
- package/nitro.json +19 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/NitroVisionOcr+autolinking.cmake +81 -0
- package/nitrogen/generated/android/NitroVisionOcr+autolinking.gradle +27 -0
- package/nitrogen/generated/android/NitroVisionOcrOnLoad.cpp +41 -0
- package/nitrogen/generated/android/NitroVisionOcrOnLoad.hpp +34 -0
- package/nitrogen/generated/android/c++/JHybridVisionOCRSpec.cpp +87 -0
- package/nitrogen/generated/android/c++/JHybridVisionOCRSpec.hpp +63 -0
- package/nitrogen/generated/android/c++/JOcrBlock.hpp +91 -0
- package/nitrogen/generated/android/c++/JOcrBox.hpp +69 -0
- package/nitrogen/generated/android/c++/JOcrLine.hpp +93 -0
- package/nitrogen/generated/android/c++/JOcrOptions.hpp +95 -0
- package/nitrogen/generated/android/c++/JOcrResult.hpp +89 -0
- package/nitrogen/generated/android/c++/JOcrWord.hpp +68 -0
- package/nitrogen/generated/android/c++/JRLevel.hpp +58 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/visionocr/HybridVisionOCRSpec.kt +55 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/visionocr/NitroVisionOcrOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/visionocr/OcrBlock.kt +61 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/visionocr/OcrBox.kt +66 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/visionocr/OcrLine.kt +66 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/visionocr/OcrOptions.kt +71 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/visionocr/OcrResult.kt +56 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/visionocr/OcrWord.kt +61 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/visionocr/RLevel.kt +23 -0
- package/nitrogen/generated/ios/NitroVisionOcr+autolinking.rb +62 -0
- package/nitrogen/generated/ios/NitroVisionOcr-Swift-Cxx-Bridge.cpp +44 -0
- package/nitrogen/generated/ios/NitroVisionOcr-Swift-Cxx-Bridge.hpp +286 -0
- package/nitrogen/generated/ios/NitroVisionOcr-Swift-Cxx-Umbrella.hpp +72 -0
- package/nitrogen/generated/ios/c++/HybridVisionOCRSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridVisionOCRSpecSwift.hpp +108 -0
- package/nitrogen/generated/ios/swift/HybridVisionOCRSpec.swift +56 -0
- package/nitrogen/generated/ios/swift/HybridVisionOCRSpec_cxx.swift +149 -0
- package/nitrogen/generated/ios/swift/OcrBlock.swift +64 -0
- package/nitrogen/generated/ios/swift/OcrBox.swift +44 -0
- package/nitrogen/generated/ios/swift/OcrLine.swift +82 -0
- package/nitrogen/generated/ios/swift/OcrOptions.swift +113 -0
- package/nitrogen/generated/ios/swift/OcrResult.swift +53 -0
- package/nitrogen/generated/ios/swift/OcrWord.swift +58 -0
- package/nitrogen/generated/ios/swift/RLevel.swift +40 -0
- package/nitrogen/generated/shared/c++/HybridVisionOCRSpec.cpp +21 -0
- package/nitrogen/generated/shared/c++/HybridVisionOCRSpec.hpp +71 -0
- package/nitrogen/generated/shared/c++/OcrBlock.hpp +98 -0
- package/nitrogen/generated/shared/c++/OcrBox.hpp +95 -0
- package/nitrogen/generated/shared/c++/OcrLine.hpp +102 -0
- package/nitrogen/generated/shared/c++/OcrOptions.hpp +103 -0
- package/nitrogen/generated/shared/c++/OcrResult.hpp +91 -0
- package/nitrogen/generated/shared/c++/OcrWord.hpp +94 -0
- package/nitrogen/generated/shared/c++/RLevel.hpp +76 -0
- package/package.json +111 -0
- package/react-native.config.js +16 -0
- package/src/index.ts +21 -0
- package/src/specs/VisionOCR.nitro.ts +11 -0
- package/src/types.ts +41 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// OcrResult.kt
|
|
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
|
+
package com.margelo.nitro.visionocr
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
import java.util.Objects
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript object/struct "OcrResult".
|
|
17
|
+
*/
|
|
18
|
+
@DoNotStrip
|
|
19
|
+
@Keep
|
|
20
|
+
data class OcrResult(
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
val text: String,
|
|
24
|
+
@DoNotStrip
|
|
25
|
+
@Keep
|
|
26
|
+
val blocks: Array<OcrBlock>?
|
|
27
|
+
) {
|
|
28
|
+
/* primary constructor */
|
|
29
|
+
|
|
30
|
+
override fun equals(other: Any?): Boolean {
|
|
31
|
+
if (this === other) return true
|
|
32
|
+
if (other !is OcrResult) return false
|
|
33
|
+
return Objects.deepEquals(this.text, other.text)
|
|
34
|
+
&& Objects.deepEquals(this.blocks, other.blocks)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
override fun hashCode(): Int {
|
|
38
|
+
return arrayOf<Any?>(
|
|
39
|
+
text,
|
|
40
|
+
blocks
|
|
41
|
+
).contentDeepHashCode()
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
companion object {
|
|
45
|
+
/**
|
|
46
|
+
* Constructor called from C++
|
|
47
|
+
*/
|
|
48
|
+
@DoNotStrip
|
|
49
|
+
@Keep
|
|
50
|
+
@Suppress("unused")
|
|
51
|
+
@JvmStatic
|
|
52
|
+
private fun fromCpp(text: String, blocks: Array<OcrBlock>?): OcrResult {
|
|
53
|
+
return OcrResult(text, blocks)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// OcrWord.kt
|
|
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
|
+
package com.margelo.nitro.visionocr
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
import java.util.Objects
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript object/struct "OcrWord".
|
|
17
|
+
*/
|
|
18
|
+
@DoNotStrip
|
|
19
|
+
@Keep
|
|
20
|
+
data class OcrWord(
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
val text: String,
|
|
24
|
+
@DoNotStrip
|
|
25
|
+
@Keep
|
|
26
|
+
val box: OcrBox?,
|
|
27
|
+
@DoNotStrip
|
|
28
|
+
@Keep
|
|
29
|
+
val confidence: Double?
|
|
30
|
+
) {
|
|
31
|
+
/* primary constructor */
|
|
32
|
+
|
|
33
|
+
override fun equals(other: Any?): Boolean {
|
|
34
|
+
if (this === other) return true
|
|
35
|
+
if (other !is OcrWord) return false
|
|
36
|
+
return Objects.deepEquals(this.text, other.text)
|
|
37
|
+
&& Objects.deepEquals(this.box, other.box)
|
|
38
|
+
&& Objects.deepEquals(this.confidence, other.confidence)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
override fun hashCode(): Int {
|
|
42
|
+
return arrayOf<Any?>(
|
|
43
|
+
text,
|
|
44
|
+
box,
|
|
45
|
+
confidence
|
|
46
|
+
).contentDeepHashCode()
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
companion object {
|
|
50
|
+
/**
|
|
51
|
+
* Constructor called from C++
|
|
52
|
+
*/
|
|
53
|
+
@DoNotStrip
|
|
54
|
+
@Keep
|
|
55
|
+
@Suppress("unused")
|
|
56
|
+
@JvmStatic
|
|
57
|
+
private fun fromCpp(text: String, box: OcrBox?, confidence: Double?): OcrWord {
|
|
58
|
+
return OcrWord(text, box, confidence)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// RLevel.kt
|
|
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
|
+
package com.margelo.nitro.visionocr
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Represents the JavaScript enum/union "RLevel".
|
|
15
|
+
*/
|
|
16
|
+
@DoNotStrip
|
|
17
|
+
@Keep
|
|
18
|
+
enum class RLevel(@DoNotStrip @Keep val value: Int) {
|
|
19
|
+
FAST(0),
|
|
20
|
+
ACCURATE(1);
|
|
21
|
+
|
|
22
|
+
companion object
|
|
23
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#
|
|
2
|
+
# NitroVisionOcr+autolinking.rb
|
|
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
|
+
# This is a Ruby script that adds all files generated by Nitrogen
|
|
9
|
+
# to the given podspec.
|
|
10
|
+
#
|
|
11
|
+
# To use it, add this to your .podspec:
|
|
12
|
+
# ```ruby
|
|
13
|
+
# Pod::Spec.new do |spec|
|
|
14
|
+
# # ...
|
|
15
|
+
#
|
|
16
|
+
# # Add all files generated by Nitrogen
|
|
17
|
+
# load 'nitrogen/generated/ios/NitroVisionOcr+autolinking.rb'
|
|
18
|
+
# add_nitrogen_files(spec)
|
|
19
|
+
# end
|
|
20
|
+
# ```
|
|
21
|
+
|
|
22
|
+
def add_nitrogen_files(spec)
|
|
23
|
+
Pod::UI.puts "[NitroModules] 🔥 NitroVisionOcr is boosted by nitro!"
|
|
24
|
+
|
|
25
|
+
spec.dependency "NitroModules"
|
|
26
|
+
|
|
27
|
+
current_source_files = Array(spec.attributes_hash['source_files'])
|
|
28
|
+
spec.source_files = current_source_files + [
|
|
29
|
+
# Generated cross-platform specs
|
|
30
|
+
"nitrogen/generated/shared/**/*.{h,hpp,c,cpp,swift}",
|
|
31
|
+
# Generated bridges for the cross-platform specs
|
|
32
|
+
"nitrogen/generated/ios/**/*.{h,hpp,c,cpp,mm,swift}",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
current_public_header_files = Array(spec.attributes_hash['public_header_files'])
|
|
36
|
+
spec.public_header_files = current_public_header_files + [
|
|
37
|
+
# Generated specs
|
|
38
|
+
"nitrogen/generated/shared/**/*.{h,hpp}",
|
|
39
|
+
# Swift to C++ bridging helpers
|
|
40
|
+
"nitrogen/generated/ios/NitroVisionOcr-Swift-Cxx-Bridge.hpp"
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
current_private_header_files = Array(spec.attributes_hash['private_header_files'])
|
|
44
|
+
spec.private_header_files = current_private_header_files + [
|
|
45
|
+
# iOS specific specs
|
|
46
|
+
"nitrogen/generated/ios/c++/**/*.{h,hpp}",
|
|
47
|
+
# Views are framework-specific and should be private
|
|
48
|
+
"nitrogen/generated/shared/**/views/**/*"
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
current_pod_target_xcconfig = spec.attributes_hash['pod_target_xcconfig'] || {}
|
|
52
|
+
spec.pod_target_xcconfig = current_pod_target_xcconfig.merge({
|
|
53
|
+
# Use C++ 20
|
|
54
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
|
|
55
|
+
# Enables C++ <-> Swift interop (by default it's only ObjC)
|
|
56
|
+
"SWIFT_OBJC_INTEROP_MODE" => "objcxx",
|
|
57
|
+
# Enables stricter modular headers
|
|
58
|
+
"DEFINES_MODULE" => "YES",
|
|
59
|
+
# Disable auto-generated ObjC header for Swift (Static linkage on Xcode 26.4 breaks here)
|
|
60
|
+
"SWIFT_INSTALL_OBJC_HEADER" => "NO",
|
|
61
|
+
})
|
|
62
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroVisionOcr-Swift-Cxx-Bridge.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 "NitroVisionOcr-Swift-Cxx-Bridge.hpp"
|
|
9
|
+
|
|
10
|
+
// Include C++ implementation defined types
|
|
11
|
+
#include "HybridVisionOCRSpecSwift.hpp"
|
|
12
|
+
#include "NitroVisionOcr-Swift-Cxx-Umbrella.hpp"
|
|
13
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
14
|
+
#include <VisionCamera/VisionCamera-Swift-Cxx-Bridge.hpp>
|
|
15
|
+
|
|
16
|
+
namespace margelo::nitro::visionocr::bridge::swift {
|
|
17
|
+
|
|
18
|
+
// pragma MARK: std::shared_ptr<margelo::nitro::camera::HybridFrameSpec>
|
|
19
|
+
std::shared_ptr<margelo::nitro::camera::HybridFrameSpec> create_std__shared_ptr_margelo__nitro__camera__HybridFrameSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
20
|
+
// Implemented in VisionCamera
|
|
21
|
+
return margelo::nitro::camera::bridge::swift::create_std__shared_ptr_HybridFrameSpec_(swiftUnsafePointer);
|
|
22
|
+
}
|
|
23
|
+
void* NON_NULL get_std__shared_ptr_margelo__nitro__camera__HybridFrameSpec_(std__shared_ptr_margelo__nitro__camera__HybridFrameSpec_ cppType) {
|
|
24
|
+
// Implemented in VisionCamera
|
|
25
|
+
return margelo::nitro::camera::bridge::swift::get_std__shared_ptr_HybridFrameSpec_(cppType);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// pragma MARK: std::shared_ptr<HybridVisionOCRSpec>
|
|
29
|
+
std::shared_ptr<HybridVisionOCRSpec> create_std__shared_ptr_HybridVisionOCRSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
30
|
+
NitroVisionOcr::HybridVisionOCRSpec_cxx swiftPart = NitroVisionOcr::HybridVisionOCRSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
31
|
+
return std::make_shared<margelo::nitro::visionocr::HybridVisionOCRSpecSwift>(swiftPart);
|
|
32
|
+
}
|
|
33
|
+
void* NON_NULL get_std__shared_ptr_HybridVisionOCRSpec_(std__shared_ptr_HybridVisionOCRSpec_ cppType) {
|
|
34
|
+
std::shared_ptr<margelo::nitro::visionocr::HybridVisionOCRSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::visionocr::HybridVisionOCRSpecSwift>(cppType);
|
|
35
|
+
#ifdef NITRO_DEBUG
|
|
36
|
+
if (swiftWrapper == nullptr) [[unlikely]] {
|
|
37
|
+
throw std::runtime_error("Class \"HybridVisionOCRSpec\" is not implemented in Swift!");
|
|
38
|
+
}
|
|
39
|
+
#endif
|
|
40
|
+
NitroVisionOcr::HybridVisionOCRSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
|
41
|
+
return swiftPart.toUnsafe();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
} // namespace margelo::nitro::visionocr::bridge::swift
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroVisionOcr-Swift-Cxx-Bridge.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
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `HybridFrameSpec` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::camera { class HybridFrameSpec; }
|
|
13
|
+
// Forward declaration of `HybridVisionOCRSpec` to properly resolve imports.
|
|
14
|
+
namespace margelo::nitro::visionocr { class HybridVisionOCRSpec; }
|
|
15
|
+
// Forward declaration of `OcrBlock` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::visionocr { struct OcrBlock; }
|
|
17
|
+
// Forward declaration of `OcrBox` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::visionocr { struct OcrBox; }
|
|
19
|
+
// Forward declaration of `OcrLine` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::visionocr { struct OcrLine; }
|
|
21
|
+
// Forward declaration of `OcrOptions` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::visionocr { struct OcrOptions; }
|
|
23
|
+
// Forward declaration of `OcrResult` to properly resolve imports.
|
|
24
|
+
namespace margelo::nitro::visionocr { struct OcrResult; }
|
|
25
|
+
// Forward declaration of `OcrWord` to properly resolve imports.
|
|
26
|
+
namespace margelo::nitro::visionocr { struct OcrWord; }
|
|
27
|
+
// Forward declaration of `RLevel` to properly resolve imports.
|
|
28
|
+
namespace margelo::nitro::visionocr { enum class RLevel; }
|
|
29
|
+
|
|
30
|
+
// Forward declarations of Swift defined types
|
|
31
|
+
// Forward declaration of `HybridFrameSpec_cxx` to properly resolve imports.
|
|
32
|
+
namespace VisionCamera { class HybridFrameSpec_cxx; }
|
|
33
|
+
// Forward declaration of `HybridVisionOCRSpec_cxx` to properly resolve imports.
|
|
34
|
+
namespace NitroVisionOcr { class HybridVisionOCRSpec_cxx; }
|
|
35
|
+
|
|
36
|
+
// Include C++ defined types
|
|
37
|
+
#include "HybridVisionOCRSpec.hpp"
|
|
38
|
+
#include "OcrBlock.hpp"
|
|
39
|
+
#include "OcrBox.hpp"
|
|
40
|
+
#include "OcrLine.hpp"
|
|
41
|
+
#include "OcrOptions.hpp"
|
|
42
|
+
#include "OcrResult.hpp"
|
|
43
|
+
#include "OcrWord.hpp"
|
|
44
|
+
#include "RLevel.hpp"
|
|
45
|
+
#include <NitroModules/Result.hpp>
|
|
46
|
+
#include <VisionCamera/HybridFrameSpec.hpp>
|
|
47
|
+
#include <exception>
|
|
48
|
+
#include <memory>
|
|
49
|
+
#include <optional>
|
|
50
|
+
#include <string>
|
|
51
|
+
#include <vector>
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Contains specialized versions of C++ templated types so they can be accessed from Swift,
|
|
55
|
+
* as well as helper functions to interact with those C++ types from Swift.
|
|
56
|
+
*/
|
|
57
|
+
namespace margelo::nitro::visionocr::bridge::swift {
|
|
58
|
+
|
|
59
|
+
// pragma MARK: std::optional<OcrBox>
|
|
60
|
+
/**
|
|
61
|
+
* Specialized version of `std::optional<OcrBox>`.
|
|
62
|
+
*/
|
|
63
|
+
using std__optional_OcrBox_ = std::optional<OcrBox>;
|
|
64
|
+
inline std::optional<OcrBox> create_std__optional_OcrBox_(const OcrBox& value) noexcept {
|
|
65
|
+
return std::optional<OcrBox>(value);
|
|
66
|
+
}
|
|
67
|
+
inline bool has_value_std__optional_OcrBox_(const std::optional<OcrBox>& optional) noexcept {
|
|
68
|
+
return optional.has_value();
|
|
69
|
+
}
|
|
70
|
+
inline OcrBox get_std__optional_OcrBox_(const std::optional<OcrBox>& optional) noexcept {
|
|
71
|
+
return optional.value();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// pragma MARK: std::optional<double>
|
|
75
|
+
/**
|
|
76
|
+
* Specialized version of `std::optional<double>`.
|
|
77
|
+
*/
|
|
78
|
+
using std__optional_double_ = std::optional<double>;
|
|
79
|
+
inline std::optional<double> create_std__optional_double_(const double& value) noexcept {
|
|
80
|
+
return std::optional<double>(value);
|
|
81
|
+
}
|
|
82
|
+
inline bool has_value_std__optional_double_(const std::optional<double>& optional) noexcept {
|
|
83
|
+
return optional.has_value();
|
|
84
|
+
}
|
|
85
|
+
inline double get_std__optional_double_(const std::optional<double>& optional) noexcept {
|
|
86
|
+
return optional.value();
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// pragma MARK: std::vector<OcrWord>
|
|
90
|
+
/**
|
|
91
|
+
* Specialized version of `std::vector<OcrWord>`.
|
|
92
|
+
*/
|
|
93
|
+
using std__vector_OcrWord_ = std::vector<OcrWord>;
|
|
94
|
+
inline std::vector<OcrWord> create_std__vector_OcrWord_(size_t size) noexcept {
|
|
95
|
+
std::vector<OcrWord> vector;
|
|
96
|
+
vector.reserve(size);
|
|
97
|
+
return vector;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// pragma MARK: std::optional<std::vector<OcrWord>>
|
|
101
|
+
/**
|
|
102
|
+
* Specialized version of `std::optional<std::vector<OcrWord>>`.
|
|
103
|
+
*/
|
|
104
|
+
using std__optional_std__vector_OcrWord__ = std::optional<std::vector<OcrWord>>;
|
|
105
|
+
inline std::optional<std::vector<OcrWord>> create_std__optional_std__vector_OcrWord__(const std::vector<OcrWord>& value) noexcept {
|
|
106
|
+
return std::optional<std::vector<OcrWord>>(value);
|
|
107
|
+
}
|
|
108
|
+
inline bool has_value_std__optional_std__vector_OcrWord__(const std::optional<std::vector<OcrWord>>& optional) noexcept {
|
|
109
|
+
return optional.has_value();
|
|
110
|
+
}
|
|
111
|
+
inline std::vector<OcrWord> get_std__optional_std__vector_OcrWord__(const std::optional<std::vector<OcrWord>>& optional) noexcept {
|
|
112
|
+
return optional.value();
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// pragma MARK: std::vector<OcrLine>
|
|
116
|
+
/**
|
|
117
|
+
* Specialized version of `std::vector<OcrLine>`.
|
|
118
|
+
*/
|
|
119
|
+
using std__vector_OcrLine_ = std::vector<OcrLine>;
|
|
120
|
+
inline std::vector<OcrLine> create_std__vector_OcrLine_(size_t size) noexcept {
|
|
121
|
+
std::vector<OcrLine> vector;
|
|
122
|
+
vector.reserve(size);
|
|
123
|
+
return vector;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// pragma MARK: std::optional<std::vector<OcrLine>>
|
|
127
|
+
/**
|
|
128
|
+
* Specialized version of `std::optional<std::vector<OcrLine>>`.
|
|
129
|
+
*/
|
|
130
|
+
using std__optional_std__vector_OcrLine__ = std::optional<std::vector<OcrLine>>;
|
|
131
|
+
inline std::optional<std::vector<OcrLine>> create_std__optional_std__vector_OcrLine__(const std::vector<OcrLine>& value) noexcept {
|
|
132
|
+
return std::optional<std::vector<OcrLine>>(value);
|
|
133
|
+
}
|
|
134
|
+
inline bool has_value_std__optional_std__vector_OcrLine__(const std::optional<std::vector<OcrLine>>& optional) noexcept {
|
|
135
|
+
return optional.has_value();
|
|
136
|
+
}
|
|
137
|
+
inline std::vector<OcrLine> get_std__optional_std__vector_OcrLine__(const std::optional<std::vector<OcrLine>>& optional) noexcept {
|
|
138
|
+
return optional.value();
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// pragma MARK: std::vector<OcrBlock>
|
|
142
|
+
/**
|
|
143
|
+
* Specialized version of `std::vector<OcrBlock>`.
|
|
144
|
+
*/
|
|
145
|
+
using std__vector_OcrBlock_ = std::vector<OcrBlock>;
|
|
146
|
+
inline std::vector<OcrBlock> create_std__vector_OcrBlock_(size_t size) noexcept {
|
|
147
|
+
std::vector<OcrBlock> vector;
|
|
148
|
+
vector.reserve(size);
|
|
149
|
+
return vector;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// pragma MARK: std::optional<std::vector<OcrBlock>>
|
|
153
|
+
/**
|
|
154
|
+
* Specialized version of `std::optional<std::vector<OcrBlock>>`.
|
|
155
|
+
*/
|
|
156
|
+
using std__optional_std__vector_OcrBlock__ = std::optional<std::vector<OcrBlock>>;
|
|
157
|
+
inline std::optional<std::vector<OcrBlock>> create_std__optional_std__vector_OcrBlock__(const std::vector<OcrBlock>& value) noexcept {
|
|
158
|
+
return std::optional<std::vector<OcrBlock>>(value);
|
|
159
|
+
}
|
|
160
|
+
inline bool has_value_std__optional_std__vector_OcrBlock__(const std::optional<std::vector<OcrBlock>>& optional) noexcept {
|
|
161
|
+
return optional.has_value();
|
|
162
|
+
}
|
|
163
|
+
inline std::vector<OcrBlock> get_std__optional_std__vector_OcrBlock__(const std::optional<std::vector<OcrBlock>>& optional) noexcept {
|
|
164
|
+
return optional.value();
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// pragma MARK: std::optional<OcrResult>
|
|
168
|
+
/**
|
|
169
|
+
* Specialized version of `std::optional<OcrResult>`.
|
|
170
|
+
*/
|
|
171
|
+
using std__optional_OcrResult_ = std::optional<OcrResult>;
|
|
172
|
+
inline std::optional<OcrResult> create_std__optional_OcrResult_(const OcrResult& value) noexcept {
|
|
173
|
+
return std::optional<OcrResult>(value);
|
|
174
|
+
}
|
|
175
|
+
inline bool has_value_std__optional_OcrResult_(const std::optional<OcrResult>& optional) noexcept {
|
|
176
|
+
return optional.has_value();
|
|
177
|
+
}
|
|
178
|
+
inline OcrResult get_std__optional_OcrResult_(const std::optional<OcrResult>& optional) noexcept {
|
|
179
|
+
return optional.value();
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// pragma MARK: std::shared_ptr<margelo::nitro::camera::HybridFrameSpec>
|
|
183
|
+
/**
|
|
184
|
+
* Specialized version of `std::shared_ptr<margelo::nitro::camera::HybridFrameSpec>`.
|
|
185
|
+
*/
|
|
186
|
+
using std__shared_ptr_margelo__nitro__camera__HybridFrameSpec_ = std::shared_ptr<margelo::nitro::camera::HybridFrameSpec>;
|
|
187
|
+
std::shared_ptr<margelo::nitro::camera::HybridFrameSpec> create_std__shared_ptr_margelo__nitro__camera__HybridFrameSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
|
188
|
+
void* NON_NULL get_std__shared_ptr_margelo__nitro__camera__HybridFrameSpec_(std__shared_ptr_margelo__nitro__camera__HybridFrameSpec_ cppType);
|
|
189
|
+
|
|
190
|
+
// pragma MARK: std::weak_ptr<margelo::nitro::camera::HybridFrameSpec>
|
|
191
|
+
using std__weak_ptr_margelo__nitro__camera__HybridFrameSpec_ = std::weak_ptr<margelo::nitro::camera::HybridFrameSpec>;
|
|
192
|
+
inline std__weak_ptr_margelo__nitro__camera__HybridFrameSpec_ weakify_std__shared_ptr_margelo__nitro__camera__HybridFrameSpec_(const std::shared_ptr<margelo::nitro::camera::HybridFrameSpec>& strong) noexcept { return strong; }
|
|
193
|
+
|
|
194
|
+
// pragma MARK: std::optional<bool>
|
|
195
|
+
/**
|
|
196
|
+
* Specialized version of `std::optional<bool>`.
|
|
197
|
+
*/
|
|
198
|
+
using std__optional_bool_ = std::optional<bool>;
|
|
199
|
+
inline std::optional<bool> create_std__optional_bool_(const bool& value) noexcept {
|
|
200
|
+
return std::optional<bool>(value);
|
|
201
|
+
}
|
|
202
|
+
inline bool has_value_std__optional_bool_(const std::optional<bool>& optional) noexcept {
|
|
203
|
+
return optional.has_value();
|
|
204
|
+
}
|
|
205
|
+
inline bool get_std__optional_bool_(const std::optional<bool>& optional) noexcept {
|
|
206
|
+
return optional.value();
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// pragma MARK: std::optional<RLevel>
|
|
210
|
+
/**
|
|
211
|
+
* Specialized version of `std::optional<RLevel>`.
|
|
212
|
+
*/
|
|
213
|
+
using std__optional_RLevel_ = std::optional<RLevel>;
|
|
214
|
+
inline std::optional<RLevel> create_std__optional_RLevel_(const RLevel& value) noexcept {
|
|
215
|
+
return std::optional<RLevel>(value);
|
|
216
|
+
}
|
|
217
|
+
inline bool has_value_std__optional_RLevel_(const std::optional<RLevel>& optional) noexcept {
|
|
218
|
+
return optional.has_value();
|
|
219
|
+
}
|
|
220
|
+
inline RLevel get_std__optional_RLevel_(const std::optional<RLevel>& optional) noexcept {
|
|
221
|
+
return optional.value();
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// pragma MARK: std::vector<std::string>
|
|
225
|
+
/**
|
|
226
|
+
* Specialized version of `std::vector<std::string>`.
|
|
227
|
+
*/
|
|
228
|
+
using std__vector_std__string_ = std::vector<std::string>;
|
|
229
|
+
inline std::vector<std::string> create_std__vector_std__string_(size_t size) noexcept {
|
|
230
|
+
std::vector<std::string> vector;
|
|
231
|
+
vector.reserve(size);
|
|
232
|
+
return vector;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// pragma MARK: std::optional<std::vector<std::string>>
|
|
236
|
+
/**
|
|
237
|
+
* Specialized version of `std::optional<std::vector<std::string>>`.
|
|
238
|
+
*/
|
|
239
|
+
using std__optional_std__vector_std__string__ = std::optional<std::vector<std::string>>;
|
|
240
|
+
inline std::optional<std::vector<std::string>> create_std__optional_std__vector_std__string__(const std::vector<std::string>& value) noexcept {
|
|
241
|
+
return std::optional<std::vector<std::string>>(value);
|
|
242
|
+
}
|
|
243
|
+
inline bool has_value_std__optional_std__vector_std__string__(const std::optional<std::vector<std::string>>& optional) noexcept {
|
|
244
|
+
return optional.has_value();
|
|
245
|
+
}
|
|
246
|
+
inline std::vector<std::string> get_std__optional_std__vector_std__string__(const std::optional<std::vector<std::string>>& optional) noexcept {
|
|
247
|
+
return optional.value();
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// pragma MARK: std::optional<OcrOptions>
|
|
251
|
+
/**
|
|
252
|
+
* Specialized version of `std::optional<OcrOptions>`.
|
|
253
|
+
*/
|
|
254
|
+
using std__optional_OcrOptions_ = std::optional<OcrOptions>;
|
|
255
|
+
inline std::optional<OcrOptions> create_std__optional_OcrOptions_(const OcrOptions& value) noexcept {
|
|
256
|
+
return std::optional<OcrOptions>(value);
|
|
257
|
+
}
|
|
258
|
+
inline bool has_value_std__optional_OcrOptions_(const std::optional<OcrOptions>& optional) noexcept {
|
|
259
|
+
return optional.has_value();
|
|
260
|
+
}
|
|
261
|
+
inline OcrOptions get_std__optional_OcrOptions_(const std::optional<OcrOptions>& optional) noexcept {
|
|
262
|
+
return optional.value();
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// pragma MARK: std::shared_ptr<HybridVisionOCRSpec>
|
|
266
|
+
/**
|
|
267
|
+
* Specialized version of `std::shared_ptr<HybridVisionOCRSpec>`.
|
|
268
|
+
*/
|
|
269
|
+
using std__shared_ptr_HybridVisionOCRSpec_ = std::shared_ptr<HybridVisionOCRSpec>;
|
|
270
|
+
std::shared_ptr<HybridVisionOCRSpec> create_std__shared_ptr_HybridVisionOCRSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
|
271
|
+
void* NON_NULL get_std__shared_ptr_HybridVisionOCRSpec_(std__shared_ptr_HybridVisionOCRSpec_ cppType);
|
|
272
|
+
|
|
273
|
+
// pragma MARK: std::weak_ptr<HybridVisionOCRSpec>
|
|
274
|
+
using std__weak_ptr_HybridVisionOCRSpec_ = std::weak_ptr<HybridVisionOCRSpec>;
|
|
275
|
+
inline std__weak_ptr_HybridVisionOCRSpec_ weakify_std__shared_ptr_HybridVisionOCRSpec_(const std::shared_ptr<HybridVisionOCRSpec>& strong) noexcept { return strong; }
|
|
276
|
+
|
|
277
|
+
// pragma MARK: Result<std::optional<OcrResult>>
|
|
278
|
+
using Result_std__optional_OcrResult__ = Result<std::optional<OcrResult>>;
|
|
279
|
+
inline Result_std__optional_OcrResult__ create_Result_std__optional_OcrResult__(const std::optional<OcrResult>& value) noexcept {
|
|
280
|
+
return Result<std::optional<OcrResult>>::withValue(value);
|
|
281
|
+
}
|
|
282
|
+
inline Result_std__optional_OcrResult__ create_Result_std__optional_OcrResult__(const std::exception_ptr& error) noexcept {
|
|
283
|
+
return Result<std::optional<OcrResult>>::withError(error);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
} // namespace margelo::nitro::visionocr::bridge::swift
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroVisionOcr-Swift-Cxx-Umbrella.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
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `HybridFrameSpec` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::camera { class HybridFrameSpec; }
|
|
13
|
+
// Forward declaration of `HybridVisionOCRSpec` to properly resolve imports.
|
|
14
|
+
namespace margelo::nitro::visionocr { class HybridVisionOCRSpec; }
|
|
15
|
+
// Forward declaration of `OcrBlock` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::visionocr { struct OcrBlock; }
|
|
17
|
+
// Forward declaration of `OcrBox` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::visionocr { struct OcrBox; }
|
|
19
|
+
// Forward declaration of `OcrLine` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::visionocr { struct OcrLine; }
|
|
21
|
+
// Forward declaration of `OcrOptions` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::visionocr { struct OcrOptions; }
|
|
23
|
+
// Forward declaration of `OcrResult` to properly resolve imports.
|
|
24
|
+
namespace margelo::nitro::visionocr { struct OcrResult; }
|
|
25
|
+
// Forward declaration of `OcrWord` to properly resolve imports.
|
|
26
|
+
namespace margelo::nitro::visionocr { struct OcrWord; }
|
|
27
|
+
// Forward declaration of `RLevel` to properly resolve imports.
|
|
28
|
+
namespace margelo::nitro::visionocr { enum class RLevel; }
|
|
29
|
+
|
|
30
|
+
// Include C++ defined types
|
|
31
|
+
#include "HybridVisionOCRSpec.hpp"
|
|
32
|
+
#include "OcrBlock.hpp"
|
|
33
|
+
#include "OcrBox.hpp"
|
|
34
|
+
#include "OcrLine.hpp"
|
|
35
|
+
#include "OcrOptions.hpp"
|
|
36
|
+
#include "OcrResult.hpp"
|
|
37
|
+
#include "OcrWord.hpp"
|
|
38
|
+
#include "RLevel.hpp"
|
|
39
|
+
#include <NitroModules/Result.hpp>
|
|
40
|
+
#include <VisionCamera/HybridFrameSpec.hpp>
|
|
41
|
+
#include <exception>
|
|
42
|
+
#include <memory>
|
|
43
|
+
#include <optional>
|
|
44
|
+
#include <string>
|
|
45
|
+
#include <vector>
|
|
46
|
+
|
|
47
|
+
// C++ helpers for Swift
|
|
48
|
+
#include "NitroVisionOcr-Swift-Cxx-Bridge.hpp"
|
|
49
|
+
|
|
50
|
+
// Common C++ types used in Swift
|
|
51
|
+
#include <NitroModules/ArrayBufferHolder.hpp>
|
|
52
|
+
#include <NitroModules/AnyMapUtils.hpp>
|
|
53
|
+
#include <NitroModules/RuntimeError.hpp>
|
|
54
|
+
#include <NitroModules/DateToChronoDate.hpp>
|
|
55
|
+
|
|
56
|
+
// Forward declarations of Swift defined types
|
|
57
|
+
// Forward declaration of `HybridFrameSpec_cxx` to properly resolve imports.
|
|
58
|
+
namespace VisionCamera { class HybridFrameSpec_cxx; }
|
|
59
|
+
// Forward declaration of `HybridVisionOCRSpec_cxx` to properly resolve imports.
|
|
60
|
+
namespace NitroVisionOcr { class HybridVisionOCRSpec_cxx; }
|
|
61
|
+
|
|
62
|
+
// Include Swift defined types
|
|
63
|
+
#if __has_include("NitroVisionOcr-Swift.h")
|
|
64
|
+
// This header is generated by Xcode/Swift on every app build.
|
|
65
|
+
// If it cannot be found, make sure the Swift module's name (= podspec name) is actually "NitroVisionOcr".
|
|
66
|
+
#include "NitroVisionOcr-Swift.h"
|
|
67
|
+
// Same as above, but used when building with frameworks (`use_frameworks`)
|
|
68
|
+
#elif __has_include(<NitroVisionOcr/NitroVisionOcr-Swift.h>)
|
|
69
|
+
#include <NitroVisionOcr/NitroVisionOcr-Swift.h>
|
|
70
|
+
#else
|
|
71
|
+
#error NitroVisionOcr's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "NitroVisionOcr", and try building the app first.
|
|
72
|
+
#endif
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridVisionOCRSpecSwift.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 "HybridVisionOCRSpecSwift.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::visionocr {
|
|
11
|
+
} // namespace margelo::nitro::visionocr
|