aboutsummaryrefslogtreecommitdiff
path: root/src/intercopycontext.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/intercopycontext.hpp')
-rw-r--r--src/intercopycontext.hpp32
1 files changed, 21 insertions, 11 deletions
diff --git a/src/intercopycontext.hpp b/src/intercopycontext.hpp
index ece4674..0b88666 100644
--- a/src/intercopycontext.hpp
+++ b/src/intercopycontext.hpp
@@ -1,6 +1,7 @@
1#pragma once 1#pragma once
2 2
3#include "tools.hpp" 3#include "tools.hpp"
4#include "universe.hpp"
4 5
5// forwards 6// forwards
6class Universe; 7class Universe;
@@ -21,6 +22,13 @@ enum class [[nodiscard]] InterCopyResult
21 Error 22 Error
22}; 23};
23 24
25enum class [[nodiscard]] InterCopyOneResult
26{
27 NotCopied,
28 Copied,
29 RetryAfterConversion
30};
31
24// ################################################################################################# 32// #################################################################################################
25 33
26DECLARE_UNIQUE_TYPE(CacheIndex, StackIndex); 34DECLARE_UNIQUE_TYPE(CacheIndex, StackIndex);
@@ -43,8 +51,14 @@ class InterCopyContext final
43 // when mode == LookupMode::FromKeeper, L1 is a keeper state and L2 is not, therefore L2 is the state where we want to raise the error 51 // when mode == LookupMode::FromKeeper, L1 is a keeper state and L2 is not, therefore L2 is the state where we want to raise the error
44 // whon mode != LookupMode::FromKeeper, L1 is not a keeper state, therefore L1 is the state where we want to raise the error 52 // whon mode != LookupMode::FromKeeper, L1 is not a keeper state, therefore L1 is the state where we want to raise the error
45 lua_State* getErrL() const { return (mode == LookupMode::FromKeeper) ? L2.value() : L1.value(); } 53 lua_State* getErrL() const { return (mode == LookupMode::FromKeeper) ? L2.value() : L1.value(); }
54
55 // for use in processConversion
56 [[nodiscard]]
57 ConvertMode lookupConverter() const;
58
59 // for use in interCopyTable and interCopyUserdata
46 [[nodiscard]] 60 [[nodiscard]]
47 LuaType processConversion() const; 61 bool processConversion() const;
48 62
49 // for use in copyCachedFunction 63 // for use in copyCachedFunction
50 void copyFunction() const; 64 void copyFunction() const;
@@ -71,22 +85,18 @@ class InterCopyContext final
71 bool tryCopyDeep() const; 85 bool tryCopyDeep() const;
72 86
73 // copying a single Lua stack item 87 // copying a single Lua stack item
74 [[nodiscard]] 88 void interCopyBoolean() const;
75 bool interCopyBoolean() const;
76 [[nodiscard]] 89 [[nodiscard]]
77 bool interCopyFunction() const; 90 bool interCopyFunction() const;
78 [[nodiscard]] 91 void interCopyLightuserdata() const;
79 bool interCopyLightuserdata() const;
80 [[nodiscard]] 92 [[nodiscard]]
81 bool interCopyNil() const; 93 bool interCopyNil() const;
94 void interCopyNumber() const;
95 void interCopyString() const;
82 [[nodiscard]] 96 [[nodiscard]]
83 bool interCopyNumber() const; 97 InterCopyOneResult interCopyTable() const;
84 [[nodiscard]]
85 bool interCopyString() const;
86 [[nodiscard]]
87 bool interCopyTable() const;
88 [[nodiscard]] 98 [[nodiscard]]
89 bool interCopyUserdata() const; 99 InterCopyOneResult interCopyUserdata() const;
90 100
91 public: 101 public:
92 [[nodiscard]] 102 [[nodiscard]]