// Jackson Coxson #pragma once #include #include #include #include #include #include namespace IdeviceFFI { using CrashReportCopyMobilePtr = std::unique_ptr>; class CrashReportCopyMobile { public: // Factory: connect via Provider static Result connect(Provider& provider); // Factory: wrap an existing Idevice socket (consumes it on success) static Result from_socket(Idevice&& socket); // Static: flush crash reports from system storage static Result flush(Provider& provider); // Ops Result, FfiError> ls(const char* dir_path = nullptr); Result, FfiError> pull(const std::string& log_name); Result remove(const std::string& log_name); // RAII / moves ~CrashReportCopyMobile() noexcept = default; CrashReportCopyMobile(CrashReportCopyMobile&&) noexcept = default; CrashReportCopyMobile& operator=(CrashReportCopyMobile&&) noexcept = default; CrashReportCopyMobile(const CrashReportCopyMobile&) = delete; CrashReportCopyMobile& operator=(const CrashReportCopyMobile&) = delete; CrashReportCopyMobileHandle* raw() const noexcept { return handle_.get(); } static CrashReportCopyMobile adopt(CrashReportCopyMobileHandle* h) noexcept { return CrashReportCopyMobile(h); } private: explicit CrashReportCopyMobile(CrashReportCopyMobileHandle* h) noexcept : handle_(h) {} CrashReportCopyMobilePtr handle_{}; }; } // namespace IdeviceFFI