1111
1212namespace Toad
1313{
14-
14+
1515using json = nlohmann::ordered_json;
1616
1717// Define string identifier for type X
@@ -25,7 +25,7 @@ inline std::string_view type_name()
2525 return " Unknown" ;
2626}
2727
28- struct SerializedEnum
28+ struct ENGINE_API SerializedEnum
2929{
3030 union Data
3131 {
@@ -63,7 +63,7 @@ SERIALIZABLE_TYPE(std::string*)
6363#define ReflectTypes SerializedEnum, bool *, int8_t *, int16_t *, int32_t *, int64_t *, float *, std::string*
6464
6565template <typename T>
66- struct ReflectVarsOfT
66+ struct ENGINE_API ReflectVarsOfT
6767{
6868 std::unordered_map<std::string, T> data;
6969
@@ -100,28 +100,28 @@ struct ReflectVarsOfT
100100};
101101
102102template <typename ... Ts>
103- struct ReflectVarsCopy : ReflectVarsOfT<std::remove_pointer_t <Ts>>...
103+ struct ENGINE_API ReflectVarsCopy : ReflectVarsOfT<std::remove_pointer_t <Ts>>...
104104{
105105 template <typename T>
106- ENGINE_API ReflectVarsOfT<T>& Get ()
106+ ReflectVarsOfT<T>& Get ()
107107 {
108108 return static_cast <ReflectVarsOfT<T>&>(*this );
109109 }
110110
111111 template <typename T>
112- ENGINE_API const ReflectVarsOfT<T>& GetCRef () const
112+ const ReflectVarsOfT<T>& GetCRef () const
113113 {
114114 return static_cast <const ReflectVarsOfT<T>&>(*this );
115115 }
116116
117117 template <typename T>
118- ENGINE_API T& GetVar (const std::string& name)
118+ T& GetVar (const std::string& name)
119119 {
120120 return Get<T>().data [name];
121121 }
122122
123123 template <typename T>
124- ENGINE_API void Add (const std::string& name, T value)
124+ void Add (const std::string& name, T value)
125125 {
126126 if (std::is_enum_v<T>)
127127 AddEnum (name, value);
@@ -130,33 +130,33 @@ struct ReflectVarsCopy : ReflectVarsOfT<std::remove_pointer_t<Ts>>...
130130 }
131131
132132 template <typename T>
133- ENGINE_API void Add (const ReflectVarsOfT<T>& vars)
133+ void Add (const ReflectVarsOfT<T>& vars)
134134 {
135135 ReflectVarsOfT<T>::data.insert (vars.data .begin (), vars.data .end ());
136136 }
137137};
138138
139139template <typename ... Ts>
140- struct ReflectVars : ReflectVarsOfT<Ts>...
140+ struct ENGINE_API ReflectVars : ReflectVarsOfT<Ts>...
141141{
142142 ReflectVars ()
143143 : ReflectVarsOfT<Ts>()...
144144 {}
145145
146146 template <typename T>
147- ENGINE_API ReflectVarsOfT<T>& Get ()
147+ ReflectVarsOfT<T>& Get ()
148148 {
149149 return (ReflectVarsOfT<T>&)(*this );
150150 }
151151
152152 template <typename T>
153- ENGINE_API T& GetVar (const std::string& name)
153+ T& GetVar (const std::string& name)
154154 {
155155 return Get<T>().data [name];
156156 }
157157
158158 template <typename T>
159- ENGINE_API void Add (const std::string& name, T value)
159+ void Add (const std::string& name, T value)
160160 {
161161 if constexpr (std::is_enum_v<std::remove_pointer_t <T>>)
162162 AddEnum (name, value);
@@ -165,7 +165,7 @@ struct ReflectVars : ReflectVarsOfT<Ts>...
165165 }
166166
167167 template <typename T>
168- ENGINE_API void AddEnum (const std::string& name, T value)
168+ void AddEnum (const std::string& name, T value)
169169 {
170170 SerializedEnum serialized;
171171 serialized.enum_name = magic_enum::enum_type_name<decltype (*value)>();
@@ -182,7 +182,7 @@ struct ReflectVars : ReflectVarsOfT<Ts>...
182182 }
183183
184184 template <typename T>
185- ENGINE_API ReflectVarsOfT<std::remove_pointer_t <T>> CopyVars () const
185+ ReflectVarsOfT<std::remove_pointer_t <T>> CopyVars () const
186186 {
187187 ReflectVarsOfT<std::remove_pointer_t <T>> res;
188188 for (const auto & [n, v] : ReflectVarsOfT<T>::data)
@@ -200,27 +200,27 @@ struct ReflectVars : ReflectVarsOfT<Ts>...
200200 return res;
201201 }
202202
203- ENGINE_API ReflectVarsCopy<Ts...> Copy () const
203+ ReflectVarsCopy<Ts...> Copy () const
204204 {
205205 ReflectVarsCopy<Ts...> res;
206206 (res.template Add <std::remove_pointer_t <Ts>>(CopyVars<Ts>()), ...);
207207 return res;
208208 }
209209
210- ENGINE_API void Clear ()
210+ void Clear ()
211211 {
212212 (ReflectVarsOfT<Ts>::data.clear (), ...);
213213 }
214214
215- ENGINE_API json Serialize ()
215+ json Serialize ()
216216 {
217217 json res;
218218 (res.push_back (Get<Ts>().Serialize ()), ...);
219219 return res;
220220 }
221221
222222 // update overlapping vars
223- ENGINE_API void Update (const ReflectVarsCopy<Ts...>& reflection)
223+ void Update (const ReflectVarsCopy<Ts...>& reflection)
224224 {
225225 (std::for_each (Get<Ts>().data .begin (), Get<Ts>().data .end (),
226226 [&reflection](auto & e)
0 commit comments