// // Created by robin on 10/1/17. // #ifndef MIFARE_TOOLS_LIBNFCOPERATION_HXX #define MIFARE_TOOLS_LIBNFCOPERATION_HXX #include "LibNfcOperation.h" template void LibNfcOperation::runOperation(QSharedPointer libNfc, std::function(QSharedPointer)> operation, std::function)> callback) { LibNfc::Utils::Result* result = nullptr; auto nfcOperation = new LibNfcOperation(libNfc, [&result, operation](QSharedPointer libNfc) { auto res = operation(libNfc); result = new LibNfc::Utils::Result(res); }); connect(nfcOperation, &LibNfcOperation::finished, [&result, nfcOperation, callback]() { nfcOperation->deleteLater(); callback(*result); delete result; }); nfcOperation->start(); } #endif //MIFARE_TOOLS_LIBNFCOPERATION_HXX