mirror of
https://github.com/jkcoxson/idevice.git
synced 2026-03-02 14:36:16 +01:00
usbmuxd class implementation for usbmuxd
This commit is contained in:
29
cpp/include/ffi.hpp
Normal file
29
cpp/include/ffi.hpp
Normal file
@@ -0,0 +1,29 @@
|
||||
// Jackson Coxson
|
||||
|
||||
#ifndef IDEVICE_FFI
|
||||
#define IDEVICE_FFI
|
||||
|
||||
#include "idevice.hpp"
|
||||
#include <string>
|
||||
|
||||
namespace IdeviceFFI {
|
||||
struct FfiError {
|
||||
int32_t code = 0;
|
||||
std::string message;
|
||||
|
||||
static FfiError from(const IdeviceFfiError* err) {
|
||||
FfiError out;
|
||||
if (err) {
|
||||
out.code = err->code;
|
||||
out.message = err->message ? err->message : "";
|
||||
idevice_error_free(const_cast<IdeviceFfiError*>(err));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
static FfiError success() { return {0, ""}; }
|
||||
|
||||
explicit operator bool() const { return code != 0; }
|
||||
};
|
||||
} // namespace IdeviceFFI
|
||||
#endif
|
||||
Reference in New Issue
Block a user