void RenameFile<TRequest>::CoroutineBody(pull_type & yield) { auto self = shared_from_this(); // Hold a reference to our // object until the coroutine // is complete, otherwise // handler will have invalid // reference to this because // the base object has // disappeared from scope std::function<void(const ResponseType & response)> HandleFileGetInfo = [this, self](const ResponseType & response) { if (response.error_code) { // If there was an error, insert into vector and // propagate at the callback. std::string error_str = "No error string provided"; if (response.error_string) error_str = *response.error_string; errors_.push_back(ErrorType( quick_key_, new_name_, response.error_code, error_str)); } else { response_ = response; } // Resume the coroutine request_ = nullptr; // Must free request_ or coroutine cannot be // destructed. Resume(); }; request_ = stm_->Call(RequestType(quick_key_), HandleFileGetInfo); if (cancelled_) request_->Cancel(); yield(); // Coroutine is done, so call the callback. callback_(response_, errors_); }
QTM_BEGIN_NAMESPACE //The name of the requestor //Added by PM //_LIT(KRequestor,"QTMobility Location"); // constructor CQMLBackendAO::CQMLBackendAO() : CActive(EPriorityStandard), // Standard priority mPosInfo(NULL), mRequester(NULL), mRequesterSatellite(NULL), mRequestType(RequestType(0)) { #if !defined QT_NO_DEBUG qDebug() << "CQMLBackendAO::CQMLBackendAO\n" ; #endif }
void HttpRequestHandler::handle_request(QHttpRequest *req, QHttpResponse *resp) { mRequests.push_front(RequestType(req,resp)); req->storeBody(); connect(req, SIGNAL(end()), this, SLOT(onRequestSuccessful())); }