11#pragma once
22
3+ #include < iostream>
4+
35#include " util/instance_manager.h"
6+ #include " util/jni/ArrayFromJava.h"
47#include " util/pp_cat.h"
5- #include " util/debug_log.h"
6-
7- #include < iostream>
8+ #include " util/wrap_void.h"
89
910
1011
@@ -55,9 +56,9 @@ struct conversions
5556 }
5657
5758 static auto
58- to_java (JNIEnv *env, LogEntry &log_entry, ToxFunc func, Args ...args)
59+ to_java (JNIEnv *env, ToxFunc func, Args ...args)
5960 {
60- return to_java (env, log_entry. print_result (func, from_java (args)...));
61+ return to_java (env, wrap_void (func, from_java (args)...));
6162 }
6263};
6364
@@ -228,12 +229,9 @@ throw_tox_exception (JNIEnv *env, ErrorType error)
228229 * The return type of with_error_handling is the result type of calling
229230 * success_func with the return value of tox_func called with args.
230231 *
231- * It stores the result of the function call in the passed LogEntry.
232- *
233232 * @param Object Tox or ToxAV, the type of the first parameter to the tox
234233 * function without pointer.
235234 *
236- * @param log_entry A LogEntry to store the function result in.
237235 * @param env The current JNIEnv.
238236 * @param success_func Function to be called when the error code is OK.
239237 * @param tox_func The native function to call. Must have an error code as
@@ -243,8 +241,7 @@ throw_tox_exception (JNIEnv *env, ErrorType error)
243241 */
244242template <typename Object, typename SuccessFunc, typename ToxFunc, typename ...Args>
245243auto
246- with_error_handling (LogEntry &log_entry,
247- JNIEnv *env,
244+ with_error_handling (JNIEnv *env,
248245 SuccessFunc success_func,
249246 ToxFunc tox_func,
250247 Args &&...args)
@@ -254,7 +251,7 @@ with_error_handling (LogEntry &log_entry,
254251 // Create an error code value and pass a pointer to the tox function.
255252 error_type error;
256253 auto value = conversions<ToxFunc, Args..., error_type *>::to_java (
257- env, log_entry, tox_func, std::forward<Args> (args)..., &error
254+ env, tox_func, std::forward<Args> (args)..., &error
258255 );
259256 // Handle it, producing either a SUCCESS or a FAILURE with the error code.
260257 ErrorHandling result = handle_error_enum<error_type> (error);
@@ -283,8 +280,6 @@ with_error_handling (LogEntry &log_entry,
283280 * A Tox instance manager. In addition to the facilities provided by
284281 * instance_manager, this provides with_error_handling member functions for
285282 * tox error code to exception translation.
286- *
287- * All function calls are logged to a LogEntry.
288283 */
289284template <typename ObjectP, typename EventsP>
290285struct ToxInstances
@@ -307,9 +302,8 @@ struct ToxInstances
307302 ToxFunc tox_func,
308303 Args &&...args)
309304 {
310- LogEntry log_entry (tox_func, args...);
311305 return ::with_error_handling<Object> (
312- log_entry, env, success_func,
306+ env, success_func,
313307 tox_func, std::forward<Args> (args)...
314308 );
315309 }
@@ -330,9 +324,8 @@ struct ToxInstances
330324 [&] (Object *tox, Events &events)
331325 {
332326 unused (events);
333- InstanceLogEntry log_entry (instanceNumber, tox_func, tox, args...);
334327 return ::with_error_handling<Object> (
335- log_entry, env, success_func,
328+ env, success_func,
336329 tox_func, tox, std::forward<Args> (args)...
337330 );
338331 }
@@ -376,9 +369,8 @@ struct ToxInstances
376369 [&] (Object *tox, Events &events)
377370 {
378371 unused (events);
379- InstanceLogEntry log_entry (instanceNumber, tox_func, tox, args...);
380372 return conversions<ToxFunc, Object *, Args...>::to_java (
381- env, log_entry, tox_func, tox, std::forward<Args> (args)...
373+ env, tox_func, tox, std::forward<Args> (args)...
382374 );
383375 }
384376 );
0 commit comments