Remove cpp 17 features and implement Rust into CPP

This commit is contained in:
Jackson Coxson
2025-08-29 14:19:28 -06:00
parent 4fde7cf06b
commit 1169408da1
41 changed files with 1638 additions and 1212 deletions

View File

@@ -2,34 +2,31 @@
#include <idevice++/usbmuxd.hpp>
#include <iostream>
#include <optional>
int main() {
IdeviceFFI::FfiError e;
std::optional<IdeviceFFI::UsbmuxdConnection> u =
IdeviceFFI::UsbmuxdConnection::default_new(0, e);
if (u == std::nullopt) {
auto u = IdeviceFFI::UsbmuxdConnection::default_new(0);
if_let_err(u, e, {
std::cerr << "failed to connect to usbmuxd";
std::cerr << e.message;
}
});
auto devices = u->get_devices(e);
if (u == std::nullopt) {
auto devices = u.unwrap().get_devices();
if_let_err(devices, e, {
std::cerr << "failed to get devices from usbmuxd";
std::cerr << e.message;
}
});
for (IdeviceFFI::UsbmuxdDevice& d : *devices) {
for (IdeviceFFI::UsbmuxdDevice& d : devices.unwrap()) {
auto udid = d.get_udid();
if (!udid) {
if (udid.is_none()) {
std::cerr << "failed to get udid";
continue;
}
auto connection_type = d.get_connection_type();
if (!connection_type) {
if (connection_type.is_none()) {
std::cerr << "failed to get connection type";
continue;
}
std::cout << *udid << " (" << connection_type->to_string() << ")" << "\n";
std::cout << udid.unwrap() << " (" << connection_type.unwrap().to_string() << ")" << "\n";
}
}