react-native-nitro-markdown 0.1.1 → 0.2.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/LICENSE +21 -0
- package/README.md +142 -84
- package/android/src/main/cpp/cpp-adapter.cpp +1 -1
- package/android/src/main/java/com/margelo/nitro/com/nitromarkdown/HybridMarkdownSession.kt +61 -0
- package/android/src/main/java/com/nitromarkdown/NitroMarkdownPackage.kt +5 -1
- package/cpp/bindings/HybridMarkdownParser.cpp +2 -2
- package/cpp/bindings/HybridMarkdownParser.hpp +2 -2
- package/cpp/bindings/HybridMarkdownSession.cpp +0 -0
- package/cpp/core/MarkdownSessionCore.cpp +0 -0
- package/ios/HybridMarkdownSession.swift +64 -0
- package/lib/commonjs/MarkdownContext.js +21 -0
- package/lib/commonjs/MarkdownContext.js.map +1 -0
- package/lib/commonjs/MarkdownSession.js +11 -0
- package/lib/commonjs/MarkdownSession.js.map +1 -0
- package/lib/commonjs/default-markdown-renderer.js +220 -0
- package/lib/commonjs/default-markdown-renderer.js.map +1 -0
- package/lib/commonjs/headless.js +50 -0
- package/lib/commonjs/headless.js.map +1 -0
- package/lib/commonjs/index.js +185 -13
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/markdown-stream.js +32 -0
- package/lib/commonjs/markdown-stream.js.map +1 -0
- package/lib/commonjs/markdown.js +326 -0
- package/lib/commonjs/markdown.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/renderers/blockquote.js +36 -0
- package/lib/commonjs/renderers/blockquote.js.map +1 -0
- package/lib/commonjs/renderers/code.js +92 -0
- package/lib/commonjs/renderers/code.js.map +1 -0
- package/lib/commonjs/renderers/heading.js +62 -0
- package/lib/commonjs/renderers/heading.js.map +1 -0
- package/lib/commonjs/renderers/horizontal-rule.js +27 -0
- package/lib/commonjs/renderers/horizontal-rule.js.map +1 -0
- package/lib/commonjs/renderers/image.js +159 -0
- package/lib/commonjs/renderers/image.js.map +1 -0
- package/lib/commonjs/renderers/link.js +37 -0
- package/lib/commonjs/renderers/link.js.map +1 -0
- package/lib/commonjs/renderers/list.js +114 -0
- package/lib/commonjs/renderers/list.js.map +1 -0
- package/lib/commonjs/renderers/math.js +151 -0
- package/lib/commonjs/renderers/math.js.map +1 -0
- package/lib/commonjs/renderers/paragraph.js +44 -0
- package/lib/commonjs/renderers/paragraph.js.map +1 -0
- package/lib/commonjs/renderers/table.js +283 -0
- package/lib/commonjs/renderers/table.js.map +1 -0
- package/lib/commonjs/specs/MarkdownSession.nitro.js +6 -0
- package/lib/commonjs/specs/MarkdownSession.nitro.js.map +1 -0
- package/lib/commonjs/theme.js +58 -0
- package/lib/commonjs/theme.js.map +1 -0
- package/lib/commonjs/use-markdown-stream.js +71 -0
- package/lib/commonjs/use-markdown-stream.js.map +1 -0
- package/lib/module/MarkdownContext.js +17 -0
- package/lib/module/MarkdownContext.js.map +1 -0
- package/lib/module/MarkdownSession.js +7 -0
- package/lib/module/MarkdownSession.js.map +1 -0
- package/lib/module/default-markdown-renderer.js +215 -0
- package/lib/module/default-markdown-renderer.js.map +1 -0
- package/lib/module/headless.js +44 -0
- package/lib/module/headless.js.map +1 -0
- package/lib/module/index.js +36 -10
- package/lib/module/index.js.map +1 -1
- package/lib/module/markdown-stream.js +27 -0
- package/lib/module/markdown-stream.js.map +1 -0
- package/lib/module/markdown.js +321 -0
- package/lib/module/markdown.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/renderers/blockquote.js +31 -0
- package/lib/module/renderers/blockquote.js.map +1 -0
- package/lib/module/renderers/code.js +86 -0
- package/lib/module/renderers/code.js.map +1 -0
- package/lib/module/renderers/heading.js +57 -0
- package/lib/module/renderers/heading.js.map +1 -0
- package/lib/module/renderers/horizontal-rule.js +22 -0
- package/lib/module/renderers/horizontal-rule.js.map +1 -0
- package/lib/module/renderers/image.js +154 -0
- package/lib/module/renderers/image.js.map +1 -0
- package/lib/module/renderers/link.js +32 -0
- package/lib/module/renderers/link.js.map +1 -0
- package/lib/module/renderers/list.js +107 -0
- package/lib/module/renderers/list.js.map +1 -0
- package/lib/module/renderers/math.js +145 -0
- package/lib/module/renderers/math.js.map +1 -0
- package/lib/module/renderers/paragraph.js +39 -0
- package/lib/module/renderers/paragraph.js.map +1 -0
- package/lib/module/renderers/table.js +278 -0
- package/lib/module/renderers/table.js.map +1 -0
- package/lib/module/specs/MarkdownSession.nitro.js +4 -0
- package/lib/module/specs/MarkdownSession.nitro.js.map +1 -0
- package/lib/module/theme.js +54 -0
- package/lib/module/theme.js.map +1 -0
- package/lib/module/use-markdown-stream.js +66 -0
- package/lib/module/use-markdown-stream.js.map +1 -0
- package/lib/typescript/commonjs/Markdown.nitro.d.ts.map +1 -0
- package/lib/typescript/commonjs/MarkdownContext.d.ts +26 -0
- package/lib/typescript/commonjs/MarkdownContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/MarkdownSession.d.ts +4 -0
- package/lib/typescript/commonjs/MarkdownSession.d.ts.map +1 -0
- package/lib/typescript/commonjs/default-markdown-renderer.d.ts +10 -0
- package/lib/typescript/commonjs/default-markdown-renderer.d.ts.map +1 -0
- package/lib/typescript/commonjs/headless.d.ts +50 -0
- package/lib/typescript/commonjs/headless.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +34 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/markdown-stream.d.ts +15 -0
- package/lib/typescript/commonjs/markdown-stream.d.ts.map +1 -0
- package/lib/typescript/commonjs/markdown.d.ts +29 -0
- package/lib/typescript/commonjs/markdown.d.ts.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/renderers/blockquote.d.ts +9 -0
- package/lib/typescript/commonjs/renderers/blockquote.d.ts.map +1 -0
- package/lib/typescript/commonjs/renderers/code.d.ts +15 -0
- package/lib/typescript/commonjs/renderers/code.d.ts.map +1 -0
- package/lib/typescript/commonjs/renderers/heading.d.ts +10 -0
- package/lib/typescript/commonjs/renderers/heading.d.ts.map +1 -0
- package/lib/typescript/commonjs/renderers/horizontal-rule.d.ts +3 -0
- package/lib/typescript/commonjs/renderers/horizontal-rule.d.ts.map +1 -0
- package/lib/typescript/commonjs/renderers/image.d.ts +11 -0
- package/lib/typescript/commonjs/renderers/image.d.ts.map +1 -0
- package/lib/typescript/commonjs/renderers/link.d.ts +10 -0
- package/lib/typescript/commonjs/renderers/link.d.ts.map +1 -0
- package/lib/typescript/commonjs/renderers/list.d.ts +22 -0
- package/lib/typescript/commonjs/renderers/list.d.ts.map +1 -0
- package/lib/typescript/commonjs/renderers/math.d.ts +15 -0
- package/lib/typescript/commonjs/renderers/math.d.ts.map +1 -0
- package/lib/typescript/commonjs/renderers/paragraph.d.ts +15 -0
- package/lib/typescript/commonjs/renderers/paragraph.d.ts.map +1 -0
- package/lib/typescript/commonjs/renderers/table.d.ts +10 -0
- package/lib/typescript/commonjs/renderers/table.d.ts.map +1 -0
- package/lib/typescript/commonjs/specs/MarkdownSession.nitro.d.ts +12 -0
- package/lib/typescript/commonjs/specs/MarkdownSession.nitro.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme.d.ts +52 -0
- package/lib/typescript/commonjs/theme.d.ts.map +1 -0
- package/lib/typescript/commonjs/use-markdown-stream.d.ts +22 -0
- package/lib/typescript/commonjs/use-markdown-stream.d.ts.map +1 -0
- package/lib/typescript/module/Markdown.nitro.d.ts +13 -0
- package/lib/typescript/module/Markdown.nitro.d.ts.map +1 -0
- package/lib/typescript/module/MarkdownContext.d.ts +26 -0
- package/lib/typescript/module/MarkdownContext.d.ts.map +1 -0
- package/lib/typescript/module/MarkdownSession.d.ts +4 -0
- package/lib/typescript/module/MarkdownSession.d.ts.map +1 -0
- package/lib/typescript/module/default-markdown-renderer.d.ts +10 -0
- package/lib/typescript/module/default-markdown-renderer.d.ts.map +1 -0
- package/lib/typescript/module/headless.d.ts +50 -0
- package/lib/typescript/module/headless.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +34 -0
- package/lib/typescript/module/index.d.ts.map +1 -0
- package/lib/typescript/module/markdown-stream.d.ts +15 -0
- package/lib/typescript/module/markdown-stream.d.ts.map +1 -0
- package/lib/typescript/module/markdown.d.ts +29 -0
- package/lib/typescript/module/markdown.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/renderers/blockquote.d.ts +9 -0
- package/lib/typescript/module/renderers/blockquote.d.ts.map +1 -0
- package/lib/typescript/module/renderers/code.d.ts +15 -0
- package/lib/typescript/module/renderers/code.d.ts.map +1 -0
- package/lib/typescript/module/renderers/heading.d.ts +10 -0
- package/lib/typescript/module/renderers/heading.d.ts.map +1 -0
- package/lib/typescript/module/renderers/horizontal-rule.d.ts +3 -0
- package/lib/typescript/module/renderers/horizontal-rule.d.ts.map +1 -0
- package/lib/typescript/module/renderers/image.d.ts +11 -0
- package/lib/typescript/module/renderers/image.d.ts.map +1 -0
- package/lib/typescript/module/renderers/link.d.ts +10 -0
- package/lib/typescript/module/renderers/link.d.ts.map +1 -0
- package/lib/typescript/module/renderers/list.d.ts +22 -0
- package/lib/typescript/module/renderers/list.d.ts.map +1 -0
- package/lib/typescript/module/renderers/math.d.ts +15 -0
- package/lib/typescript/module/renderers/math.d.ts.map +1 -0
- package/lib/typescript/module/renderers/paragraph.d.ts +15 -0
- package/lib/typescript/module/renderers/paragraph.d.ts.map +1 -0
- package/lib/typescript/module/renderers/table.d.ts +10 -0
- package/lib/typescript/module/renderers/table.d.ts.map +1 -0
- package/lib/typescript/module/specs/MarkdownSession.nitro.d.ts +12 -0
- package/lib/typescript/module/specs/MarkdownSession.nitro.d.ts.map +1 -0
- package/lib/typescript/module/theme.d.ts +52 -0
- package/lib/typescript/module/theme.d.ts.map +1 -0
- package/lib/typescript/module/use-markdown-stream.d.ts +22 -0
- package/lib/typescript/module/use-markdown-stream.d.ts.map +1 -0
- package/nitro.json +5 -2
- package/nitrogen/generated/android/NitroMarkdown+autolinking.cmake +3 -2
- package/nitrogen/generated/android/NitroMarkdown+autolinking.gradle +1 -1
- package/nitrogen/generated/android/NitroMarkdownOnLoad.cpp +17 -5
- package/nitrogen/generated/android/NitroMarkdownOnLoad.hpp +4 -4
- package/nitrogen/generated/android/c++/JFunc_void.hpp +75 -0
- package/nitrogen/generated/android/c++/JHybridMarkdownSessionSpec.cpp +91 -0
- package/nitrogen/generated/android/c++/JHybridMarkdownSessionSpec.hpp +70 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/com/nitromarkdown/Func_void.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/com/nitromarkdown/HybridMarkdownSessionSpec.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/com/nitromarkdown/NitroMarkdownOnLoad.kt +1 -1
- package/nitrogen/generated/ios/NitroMarkdown+autolinking.rb +2 -2
- package/nitrogen/generated/ios/NitroMarkdown-Swift-Cxx-Bridge.cpp +28 -4
- package/nitrogen/generated/ios/NitroMarkdown-Swift-Cxx-Bridge.hpp +72 -6
- package/nitrogen/generated/ios/NitroMarkdown-Swift-Cxx-Umbrella.hpp +11 -4
- package/nitrogen/generated/ios/NitroMarkdownAutolinking.mm +11 -3
- package/nitrogen/generated/ios/NitroMarkdownAutolinking.swift +16 -3
- package/nitrogen/generated/ios/c++/HybridMarkdownSessionSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridMarkdownSessionSpecSwift.hpp +108 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridMarkdownSessionSpec.swift +59 -0
- package/nitrogen/generated/ios/swift/HybridMarkdownSessionSpec_cxx.swift +190 -0
- package/nitrogen/generated/shared/c++/HybridMarkdownParserSpec.cpp +3 -3
- package/nitrogen/generated/shared/c++/HybridMarkdownParserSpec.hpp +4 -4
- package/nitrogen/generated/shared/c++/HybridMarkdownSessionSpec.cpp +26 -0
- package/nitrogen/generated/shared/c++/HybridMarkdownSessionSpec.hpp +67 -0
- package/nitrogen/generated/shared/c++/ParserOptions.hpp +22 -14
- package/package.json +45 -15
- package/react-native-nitro-markdown.podspec +5 -5
- package/src/MarkdownContext.ts +41 -0
- package/src/MarkdownSession.ts +8 -0
- package/src/default-markdown-renderer.tsx +266 -0
- package/src/headless.ts +106 -0
- package/src/index.ts +41 -59
- package/src/markdown-stream.tsx +32 -0
- package/src/markdown.tsx +415 -0
- package/src/renderers/blockquote.tsx +31 -0
- package/src/renderers/code.tsx +88 -0
- package/src/renderers/heading.tsx +66 -0
- package/src/renderers/horizontal-rule.tsx +20 -0
- package/src/renderers/image.tsx +160 -0
- package/src/renderers/link.tsx +38 -0
- package/src/renderers/list.tsx +125 -0
- package/src/renderers/math.tsx +164 -0
- package/src/renderers/paragraph.tsx +53 -0
- package/src/renderers/table.tsx +345 -0
- package/src/specs/MarkdownSession.nitro.ts +16 -0
- package/src/theme.ts +52 -0
- package/src/use-markdown-stream.ts +83 -0
- package/ios/NitroMarkdown-Bridging-Header.h +0 -14
- package/lib/commonjs/MarkdownJS.reference.js +0 -114
- package/lib/commonjs/MarkdownJS.reference.js.map +0 -1
- package/lib/module/MarkdownJS.reference.js +0 -107
- package/lib/module/MarkdownJS.reference.js.map +0 -1
- package/lib/typescript/Markdown.nitro.d.ts.map +0 -1
- package/lib/typescript/MarkdownJS.reference.d.ts +0 -33
- package/lib/typescript/MarkdownJS.reference.d.ts.map +0 -1
- package/lib/typescript/index.d.ts +0 -22
- package/lib/typescript/index.d.ts.map +0 -1
- package/src/MarkdownJS.reference.ts +0 -122
- /package/lib/typescript/{Markdown.nitro.d.ts → commonjs/Markdown.nitro.d.ts} +0 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridMarkdownSessionSpec.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.com.nitromarkdown
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import com.margelo.nitro.core.HybridObject
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A Kotlin class representing the MarkdownSession HybridObject.
|
|
17
|
+
* Implement this abstract class to create Kotlin-based instances of MarkdownSession.
|
|
18
|
+
*/
|
|
19
|
+
@DoNotStrip
|
|
20
|
+
@Keep
|
|
21
|
+
@Suppress(
|
|
22
|
+
"KotlinJniMissingFunction", "unused",
|
|
23
|
+
"RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
|
|
24
|
+
"LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
|
|
25
|
+
)
|
|
26
|
+
abstract class HybridMarkdownSessionSpec: HybridObject() {
|
|
27
|
+
@DoNotStrip
|
|
28
|
+
private var mHybridData: HybridData = initHybrid()
|
|
29
|
+
|
|
30
|
+
init {
|
|
31
|
+
super.updateNative(mHybridData)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
override fun updateNative(hybridData: HybridData) {
|
|
35
|
+
mHybridData = hybridData
|
|
36
|
+
super.updateNative(hybridData)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Default implementation of `HybridObject.toString()`
|
|
40
|
+
override fun toString(): String {
|
|
41
|
+
return "[HybridObject MarkdownSession]"
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Properties
|
|
45
|
+
@get:DoNotStrip
|
|
46
|
+
@get:Keep
|
|
47
|
+
@set:DoNotStrip
|
|
48
|
+
@set:Keep
|
|
49
|
+
abstract var highlightPosition: Double
|
|
50
|
+
|
|
51
|
+
// Methods
|
|
52
|
+
@DoNotStrip
|
|
53
|
+
@Keep
|
|
54
|
+
abstract fun append(chunk: String): Unit
|
|
55
|
+
|
|
56
|
+
@DoNotStrip
|
|
57
|
+
@Keep
|
|
58
|
+
abstract fun clear(): Unit
|
|
59
|
+
|
|
60
|
+
@DoNotStrip
|
|
61
|
+
@Keep
|
|
62
|
+
abstract fun getAllText(): String
|
|
63
|
+
|
|
64
|
+
abstract fun addListener(listener: () -> Unit): () -> Unit
|
|
65
|
+
|
|
66
|
+
@DoNotStrip
|
|
67
|
+
@Keep
|
|
68
|
+
private fun addListener_cxx(listener: Func_void): Func_void {
|
|
69
|
+
val __result = addListener(listener)
|
|
70
|
+
return Func_void_java(__result)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
private external fun initHybrid(): HybridData
|
|
74
|
+
|
|
75
|
+
companion object {
|
|
76
|
+
protected const val TAG = "HybridMarkdownSessionSpec"
|
|
77
|
+
}
|
|
78
|
+
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/com/nitromarkdown/NitroMarkdownOnLoad.kt
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// NitroMarkdownOnLoad.kt
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
package com.margelo.nitro.com.nitromarkdown
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# NitroMarkdown+autolinking.rb
|
|
3
3
|
# This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
# https://github.com/mrousavy/nitro
|
|
5
|
-
# Copyright ©
|
|
5
|
+
# Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
#
|
|
7
7
|
|
|
8
8
|
# This is a Ruby script that adds all files generated by Nitrogen
|
|
@@ -52,7 +52,7 @@ def add_nitrogen_files(spec)
|
|
|
52
52
|
spec.pod_target_xcconfig = current_pod_target_xcconfig.merge({
|
|
53
53
|
# Use C++ 20
|
|
54
54
|
"CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
|
|
55
|
-
# Enables C++ <-> Swift interop (by default it's only
|
|
55
|
+
# Enables C++ <-> Swift interop (by default it's only ObjC)
|
|
56
56
|
"SWIFT_OBJC_INTEROP_MODE" => "objcxx",
|
|
57
57
|
# Enables stricter modular headers
|
|
58
58
|
"DEFINES_MODULE" => "YES",
|
|
@@ -2,16 +2,40 @@
|
|
|
2
2
|
/// NitroMarkdown-Swift-Cxx-Bridge.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "NitroMarkdown-Swift-Cxx-Bridge.hpp"
|
|
9
9
|
|
|
10
10
|
// Include C++ implementation defined types
|
|
11
|
+
#include "HybridMarkdownSessionSpecSwift.hpp"
|
|
12
|
+
#include "NitroMarkdown-Swift-Cxx-Umbrella.hpp"
|
|
13
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
11
14
|
|
|
15
|
+
namespace margelo::nitro::Markdown::bridge::swift {
|
|
12
16
|
|
|
13
|
-
|
|
14
|
-
|
|
17
|
+
// pragma MARK: std::function<void()>
|
|
18
|
+
Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
19
|
+
auto swiftClosure = NitroMarkdown::Func_void::fromUnsafe(swiftClosureWrapper);
|
|
20
|
+
return [swiftClosure = std::move(swiftClosure)]() mutable -> void {
|
|
21
|
+
swiftClosure.call();
|
|
22
|
+
};
|
|
23
|
+
}
|
|
15
24
|
|
|
25
|
+
// pragma MARK: std::shared_ptr<HybridMarkdownSessionSpec>
|
|
26
|
+
std::shared_ptr<HybridMarkdownSessionSpec> create_std__shared_ptr_HybridMarkdownSessionSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
27
|
+
NitroMarkdown::HybridMarkdownSessionSpec_cxx swiftPart = NitroMarkdown::HybridMarkdownSessionSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
28
|
+
return std::make_shared<margelo::nitro::Markdown::HybridMarkdownSessionSpecSwift>(swiftPart);
|
|
29
|
+
}
|
|
30
|
+
void* NON_NULL get_std__shared_ptr_HybridMarkdownSessionSpec_(std__shared_ptr_HybridMarkdownSessionSpec_ cppType) {
|
|
31
|
+
std::shared_ptr<margelo::nitro::Markdown::HybridMarkdownSessionSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::Markdown::HybridMarkdownSessionSpecSwift>(cppType);
|
|
32
|
+
#ifdef NITRO_DEBUG
|
|
33
|
+
if (swiftWrapper == nullptr) [[unlikely]] {
|
|
34
|
+
throw std::runtime_error("Class \"HybridMarkdownSessionSpec\" is not implemented in Swift!");
|
|
35
|
+
}
|
|
36
|
+
#endif
|
|
37
|
+
NitroMarkdown::HybridMarkdownSessionSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
|
38
|
+
return swiftPart.toUnsafe();
|
|
39
|
+
}
|
|
16
40
|
|
|
17
|
-
} // namespace margelo::nitro::
|
|
41
|
+
} // namespace margelo::nitro::Markdown::bridge::swift
|
|
@@ -2,26 +2,92 @@
|
|
|
2
2
|
/// NitroMarkdown-Swift-Cxx-Bridge.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
9
9
|
|
|
10
10
|
// Forward declarations of C++ defined types
|
|
11
|
-
|
|
11
|
+
// Forward declaration of `HybridMarkdownSessionSpec` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::Markdown { class HybridMarkdownSessionSpec; }
|
|
12
13
|
|
|
13
14
|
// Forward declarations of Swift defined types
|
|
14
|
-
|
|
15
|
+
// Forward declaration of `HybridMarkdownSessionSpec_cxx` to properly resolve imports.
|
|
16
|
+
namespace NitroMarkdown { class HybridMarkdownSessionSpec_cxx; }
|
|
15
17
|
|
|
16
18
|
// Include C++ defined types
|
|
17
|
-
|
|
19
|
+
#include "HybridMarkdownSessionSpec.hpp"
|
|
20
|
+
#include <NitroModules/Result.hpp>
|
|
21
|
+
#include <exception>
|
|
22
|
+
#include <functional>
|
|
23
|
+
#include <memory>
|
|
24
|
+
#include <string>
|
|
18
25
|
|
|
19
26
|
/**
|
|
20
27
|
* Contains specialized versions of C++ templated types so they can be accessed from Swift,
|
|
21
28
|
* as well as helper functions to interact with those C++ types from Swift.
|
|
22
29
|
*/
|
|
23
|
-
namespace margelo::nitro::
|
|
30
|
+
namespace margelo::nitro::Markdown::bridge::swift {
|
|
24
31
|
|
|
32
|
+
// pragma MARK: std::function<void()>
|
|
33
|
+
/**
|
|
34
|
+
* Specialized version of `std::function<void()>`.
|
|
35
|
+
*/
|
|
36
|
+
using Func_void = std::function<void()>;
|
|
37
|
+
/**
|
|
38
|
+
* Wrapper class for a `std::function<void()>`, this can be used from Swift.
|
|
39
|
+
*/
|
|
40
|
+
class Func_void_Wrapper final {
|
|
41
|
+
public:
|
|
42
|
+
explicit Func_void_Wrapper(std::function<void()>&& func): _function(std::make_unique<std::function<void()>>(std::move(func))) {}
|
|
43
|
+
inline void call() const noexcept {
|
|
44
|
+
_function->operator()();
|
|
45
|
+
}
|
|
46
|
+
private:
|
|
47
|
+
std::unique_ptr<std::function<void()>> _function;
|
|
48
|
+
} SWIFT_NONCOPYABLE;
|
|
49
|
+
Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
50
|
+
inline Func_void_Wrapper wrap_Func_void(Func_void value) noexcept {
|
|
51
|
+
return Func_void_Wrapper(std::move(value));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// pragma MARK: std::shared_ptr<HybridMarkdownSessionSpec>
|
|
55
|
+
/**
|
|
56
|
+
* Specialized version of `std::shared_ptr<HybridMarkdownSessionSpec>`.
|
|
57
|
+
*/
|
|
58
|
+
using std__shared_ptr_HybridMarkdownSessionSpec_ = std::shared_ptr<HybridMarkdownSessionSpec>;
|
|
59
|
+
std::shared_ptr<HybridMarkdownSessionSpec> create_std__shared_ptr_HybridMarkdownSessionSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
|
60
|
+
void* NON_NULL get_std__shared_ptr_HybridMarkdownSessionSpec_(std__shared_ptr_HybridMarkdownSessionSpec_ cppType);
|
|
61
|
+
|
|
62
|
+
// pragma MARK: std::weak_ptr<HybridMarkdownSessionSpec>
|
|
63
|
+
using std__weak_ptr_HybridMarkdownSessionSpec_ = std::weak_ptr<HybridMarkdownSessionSpec>;
|
|
64
|
+
inline std__weak_ptr_HybridMarkdownSessionSpec_ weakify_std__shared_ptr_HybridMarkdownSessionSpec_(const std::shared_ptr<HybridMarkdownSessionSpec>& strong) noexcept { return strong; }
|
|
65
|
+
|
|
66
|
+
// pragma MARK: Result<void>
|
|
67
|
+
using Result_void_ = Result<void>;
|
|
68
|
+
inline Result_void_ create_Result_void_() noexcept {
|
|
69
|
+
return Result<void>::withValue();
|
|
70
|
+
}
|
|
71
|
+
inline Result_void_ create_Result_void_(const std::exception_ptr& error) noexcept {
|
|
72
|
+
return Result<void>::withError(error);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// pragma MARK: Result<std::string>
|
|
76
|
+
using Result_std__string_ = Result<std::string>;
|
|
77
|
+
inline Result_std__string_ create_Result_std__string_(const std::string& value) noexcept {
|
|
78
|
+
return Result<std::string>::withValue(value);
|
|
79
|
+
}
|
|
80
|
+
inline Result_std__string_ create_Result_std__string_(const std::exception_ptr& error) noexcept {
|
|
81
|
+
return Result<std::string>::withError(error);
|
|
82
|
+
}
|
|
25
83
|
|
|
84
|
+
// pragma MARK: Result<std::function<void()>>
|
|
85
|
+
using Result_std__function_void____ = Result<std::function<void()>>;
|
|
86
|
+
inline Result_std__function_void____ create_Result_std__function_void____(const std::function<void()>& value) noexcept {
|
|
87
|
+
return Result<std::function<void()>>::withValue(value);
|
|
88
|
+
}
|
|
89
|
+
inline Result_std__function_void____ create_Result_std__function_void____(const std::exception_ptr& error) noexcept {
|
|
90
|
+
return Result<std::function<void()>>::withError(error);
|
|
91
|
+
}
|
|
26
92
|
|
|
27
|
-
} // namespace margelo::nitro::
|
|
93
|
+
} // namespace margelo::nitro::Markdown::bridge::swift
|
|
@@ -2,16 +2,22 @@
|
|
|
2
2
|
/// NitroMarkdown-Swift-Cxx-Umbrella.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
9
9
|
|
|
10
10
|
// Forward declarations of C++ defined types
|
|
11
|
-
|
|
11
|
+
// Forward declaration of `HybridMarkdownSessionSpec` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::Markdown { class HybridMarkdownSessionSpec; }
|
|
12
13
|
|
|
13
14
|
// Include C++ defined types
|
|
14
|
-
|
|
15
|
+
#include "HybridMarkdownSessionSpec.hpp"
|
|
16
|
+
#include <NitroModules/Result.hpp>
|
|
17
|
+
#include <exception>
|
|
18
|
+
#include <functional>
|
|
19
|
+
#include <memory>
|
|
20
|
+
#include <string>
|
|
15
21
|
|
|
16
22
|
// C++ helpers for Swift
|
|
17
23
|
#include "NitroMarkdown-Swift-Cxx-Bridge.hpp"
|
|
@@ -23,7 +29,8 @@
|
|
|
23
29
|
#include <NitroModules/DateToChronoDate.hpp>
|
|
24
30
|
|
|
25
31
|
// Forward declarations of Swift defined types
|
|
26
|
-
|
|
32
|
+
// Forward declaration of `HybridMarkdownSessionSpec_cxx` to properly resolve imports.
|
|
33
|
+
namespace NitroMarkdown { class HybridMarkdownSessionSpec_cxx; }
|
|
27
34
|
|
|
28
35
|
// Include Swift defined types
|
|
29
36
|
#if __has_include("NitroMarkdown-Swift.h")
|
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
/// NitroMarkdownAutolinking.mm
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#import <Foundation/Foundation.h>
|
|
9
9
|
#import <NitroModules/HybridObjectRegistry.hpp>
|
|
10
|
-
|
|
10
|
+
#import "NitroMarkdown-Swift-Cxx-Umbrella.hpp"
|
|
11
11
|
#import <type_traits>
|
|
12
12
|
|
|
13
13
|
#include "HybridMarkdownParser.hpp"
|
|
14
|
+
#include "HybridMarkdownSessionSpecSwift.hpp"
|
|
14
15
|
|
|
15
16
|
@interface NitroMarkdownAutolinking : NSObject
|
|
16
17
|
@end
|
|
@@ -19,7 +20,7 @@
|
|
|
19
20
|
|
|
20
21
|
+ (void) load {
|
|
21
22
|
using namespace margelo::nitro;
|
|
22
|
-
using namespace margelo::nitro::
|
|
23
|
+
using namespace margelo::nitro::Markdown;
|
|
23
24
|
|
|
24
25
|
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
25
26
|
"MarkdownParser",
|
|
@@ -30,6 +31,13 @@
|
|
|
30
31
|
return std::make_shared<HybridMarkdownParser>();
|
|
31
32
|
}
|
|
32
33
|
);
|
|
34
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
35
|
+
"MarkdownSession",
|
|
36
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
37
|
+
std::shared_ptr<HybridMarkdownSessionSpec> hybridObject = NitroMarkdown::NitroMarkdownAutolinking::createMarkdownSession();
|
|
38
|
+
return hybridObject;
|
|
39
|
+
}
|
|
40
|
+
);
|
|
33
41
|
}
|
|
34
42
|
|
|
35
43
|
@end
|
|
@@ -2,11 +2,24 @@
|
|
|
2
2
|
/// NitroMarkdownAutolinking.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
public final class NitroMarkdownAutolinking {
|
|
9
|
-
public typealias bridge = margelo.nitro.
|
|
9
|
+
public typealias bridge = margelo.nitro.Markdown.bridge.swift
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Creates an instance of a Swift class that implements `HybridMarkdownSessionSpec`,
|
|
13
|
+
* and wraps it in a Swift class that can directly interop with C++ (`HybridMarkdownSessionSpec_cxx`)
|
|
14
|
+
*
|
|
15
|
+
* This is generated by Nitrogen and will initialize the class specified
|
|
16
|
+
* in the `"autolinking"` property of `nitro.json` (in this case, `HybridMarkdownSession`).
|
|
17
|
+
*/
|
|
18
|
+
public static func createMarkdownSession() -> bridge.std__shared_ptr_HybridMarkdownSessionSpec_ {
|
|
19
|
+
let hybridObject = HybridMarkdownSession()
|
|
20
|
+
return { () -> bridge.std__shared_ptr_HybridMarkdownSessionSpec_ in
|
|
21
|
+
let __cxxWrapped = hybridObject.getCxxWrapper()
|
|
22
|
+
return __cxxWrapped.getCxxPart()
|
|
23
|
+
}()
|
|
24
|
+
}
|
|
12
25
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridMarkdownSessionSpecSwift.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 "HybridMarkdownSessionSpecSwift.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::Markdown {
|
|
11
|
+
} // namespace margelo::nitro::Markdown
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridMarkdownSessionSpecSwift.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
|
+
#include "HybridMarkdownSessionSpec.hpp"
|
|
11
|
+
|
|
12
|
+
// Forward declaration of `HybridMarkdownSessionSpec_cxx` to properly resolve imports.
|
|
13
|
+
namespace NitroMarkdown { class HybridMarkdownSessionSpec_cxx; }
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
#include <string>
|
|
18
|
+
#include <functional>
|
|
19
|
+
|
|
20
|
+
#include "NitroMarkdown-Swift-Cxx-Umbrella.hpp"
|
|
21
|
+
|
|
22
|
+
namespace margelo::nitro::Markdown {
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The C++ part of HybridMarkdownSessionSpec_cxx.swift.
|
|
26
|
+
*
|
|
27
|
+
* HybridMarkdownSessionSpecSwift (C++) accesses HybridMarkdownSessionSpec_cxx (Swift), and might
|
|
28
|
+
* contain some additional bridging code for C++ <> Swift interop.
|
|
29
|
+
*
|
|
30
|
+
* Since this obviously introduces an overhead, I hope at some point in
|
|
31
|
+
* the future, HybridMarkdownSessionSpec_cxx can directly inherit from the C++ class HybridMarkdownSessionSpec
|
|
32
|
+
* to simplify the whole structure and memory management.
|
|
33
|
+
*/
|
|
34
|
+
class HybridMarkdownSessionSpecSwift: public virtual HybridMarkdownSessionSpec {
|
|
35
|
+
public:
|
|
36
|
+
// Constructor from a Swift instance
|
|
37
|
+
explicit HybridMarkdownSessionSpecSwift(const NitroMarkdown::HybridMarkdownSessionSpec_cxx& swiftPart):
|
|
38
|
+
HybridObject(HybridMarkdownSessionSpec::TAG),
|
|
39
|
+
_swiftPart(swiftPart) { }
|
|
40
|
+
|
|
41
|
+
public:
|
|
42
|
+
// Get the Swift part
|
|
43
|
+
inline NitroMarkdown::HybridMarkdownSessionSpec_cxx& getSwiftPart() noexcept {
|
|
44
|
+
return _swiftPart;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public:
|
|
48
|
+
inline size_t getExternalMemorySize() noexcept override {
|
|
49
|
+
return _swiftPart.getMemorySize();
|
|
50
|
+
}
|
|
51
|
+
bool equals(const std::shared_ptr<HybridObject>& other) override {
|
|
52
|
+
if (auto otherCast = std::dynamic_pointer_cast<HybridMarkdownSessionSpecSwift>(other)) {
|
|
53
|
+
return _swiftPart.equals(otherCast->_swiftPart);
|
|
54
|
+
}
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
void dispose() noexcept override {
|
|
58
|
+
_swiftPart.dispose();
|
|
59
|
+
}
|
|
60
|
+
std::string toString() override {
|
|
61
|
+
return _swiftPart.toString();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public:
|
|
65
|
+
// Properties
|
|
66
|
+
inline double getHighlightPosition() noexcept override {
|
|
67
|
+
return _swiftPart.getHighlightPosition();
|
|
68
|
+
}
|
|
69
|
+
inline void setHighlightPosition(double highlightPosition) noexcept override {
|
|
70
|
+
_swiftPart.setHighlightPosition(std::forward<decltype(highlightPosition)>(highlightPosition));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
public:
|
|
74
|
+
// Methods
|
|
75
|
+
inline void append(const std::string& chunk) override {
|
|
76
|
+
auto __result = _swiftPart.append(chunk);
|
|
77
|
+
if (__result.hasError()) [[unlikely]] {
|
|
78
|
+
std::rethrow_exception(__result.error());
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
inline void clear() override {
|
|
82
|
+
auto __result = _swiftPart.clear();
|
|
83
|
+
if (__result.hasError()) [[unlikely]] {
|
|
84
|
+
std::rethrow_exception(__result.error());
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
inline std::string getAllText() override {
|
|
88
|
+
auto __result = _swiftPart.getAllText();
|
|
89
|
+
if (__result.hasError()) [[unlikely]] {
|
|
90
|
+
std::rethrow_exception(__result.error());
|
|
91
|
+
}
|
|
92
|
+
auto __value = std::move(__result.value());
|
|
93
|
+
return __value;
|
|
94
|
+
}
|
|
95
|
+
inline std::function<void()> addListener(const std::function<void()>& listener) override {
|
|
96
|
+
auto __result = _swiftPart.addListener(listener);
|
|
97
|
+
if (__result.hasError()) [[unlikely]] {
|
|
98
|
+
std::rethrow_exception(__result.error());
|
|
99
|
+
}
|
|
100
|
+
auto __value = std::move(__result.value());
|
|
101
|
+
return __value;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
private:
|
|
105
|
+
NitroMarkdown::HybridMarkdownSessionSpec_cxx _swiftPart;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
} // namespace margelo::nitro::Markdown
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void.swift
|
|
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
|
+
import Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Wraps a Swift `() -> Void` as a class.
|
|
13
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
14
|
+
*/
|
|
15
|
+
public final class Func_void {
|
|
16
|
+
public typealias bridge = margelo.nitro.Markdown.bridge.swift
|
|
17
|
+
|
|
18
|
+
private let closure: () -> Void
|
|
19
|
+
|
|
20
|
+
public init(_ closure: @escaping () -> Void) {
|
|
21
|
+
self.closure = closure
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@inline(__always)
|
|
25
|
+
public func call() -> Void {
|
|
26
|
+
self.closure()
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
31
|
+
* This acquires one additional strong reference on the object!
|
|
32
|
+
*/
|
|
33
|
+
@inline(__always)
|
|
34
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
35
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Casts an unsafe pointer to a `Func_void`.
|
|
40
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void>`.
|
|
41
|
+
* This removes one strong reference from the object!
|
|
42
|
+
*/
|
|
43
|
+
@inline(__always)
|
|
44
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void {
|
|
45
|
+
return Unmanaged<Func_void>.fromOpaque(pointer).takeRetainedValue()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridMarkdownSessionSpec.swift
|
|
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
|
+
import Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/// See ``HybridMarkdownSessionSpec``
|
|
12
|
+
public protocol HybridMarkdownSessionSpec_protocol: HybridObject {
|
|
13
|
+
// Properties
|
|
14
|
+
var highlightPosition: Double { get set }
|
|
15
|
+
|
|
16
|
+
// Methods
|
|
17
|
+
func append(chunk: String) throws -> Void
|
|
18
|
+
func clear() throws -> Void
|
|
19
|
+
func getAllText() throws -> String
|
|
20
|
+
func addListener(listener: @escaping () -> Void) throws -> () -> Void
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public extension HybridMarkdownSessionSpec_protocol {
|
|
24
|
+
/// Default implementation of ``HybridObject.toString``
|
|
25
|
+
func toString() -> String {
|
|
26
|
+
return "[HybridObject MarkdownSession]"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/// See ``HybridMarkdownSessionSpec``
|
|
31
|
+
open class HybridMarkdownSessionSpec_base {
|
|
32
|
+
private weak var cxxWrapper: HybridMarkdownSessionSpec_cxx? = nil
|
|
33
|
+
public init() { }
|
|
34
|
+
public func getCxxWrapper() -> HybridMarkdownSessionSpec_cxx {
|
|
35
|
+
#if DEBUG
|
|
36
|
+
guard self is HybridMarkdownSessionSpec else {
|
|
37
|
+
fatalError("`self` is not a `HybridMarkdownSessionSpec`! Did you accidentally inherit from `HybridMarkdownSessionSpec_base` instead of `HybridMarkdownSessionSpec`?")
|
|
38
|
+
}
|
|
39
|
+
#endif
|
|
40
|
+
if let cxxWrapper = self.cxxWrapper {
|
|
41
|
+
return cxxWrapper
|
|
42
|
+
} else {
|
|
43
|
+
let cxxWrapper = HybridMarkdownSessionSpec_cxx(self as! HybridMarkdownSessionSpec)
|
|
44
|
+
self.cxxWrapper = cxxWrapper
|
|
45
|
+
return cxxWrapper
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* A Swift base-protocol representing the MarkdownSession HybridObject.
|
|
52
|
+
* Implement this protocol to create Swift-based instances of MarkdownSession.
|
|
53
|
+
* ```swift
|
|
54
|
+
* class HybridMarkdownSession : HybridMarkdownSessionSpec {
|
|
55
|
+
* // ...
|
|
56
|
+
* }
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
public typealias HybridMarkdownSessionSpec = HybridMarkdownSessionSpec_protocol & HybridMarkdownSessionSpec_base
|