// // 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) { Result* result = new Result(); auto nfcOperation = new LibNfcOperation(libNfc, [result, operation](QSharedPointer libNfc) { auto res = operation(libNfc); *result = res; }); connect(nfcOperation, &LibNfcOperation::finished, [result, nfcOperation, callback]() { nfcOperation->deleteLater(); callback(*result); delete result; }); nfcOperation->start(); } #endif //MIFARE_TOOLS_LIBNFCOPERATION_HXX