Requests XMLConverter::getRequests() { Requests result; for (uint i = 0; i < requestOverseers.length(); i++) { RequestOverseer * requestOverseer = requestOverseers[i]; result.insert(requestOverseer->getRequest()); } return result; }
void Request::ActionDialog::OnActionChoice(CppConsUI::Button& activator, size_t i, GCallback cb) { if (cb) reinterpret_cast<PurpleRequestActionCb>(cb)(user_data, i); /* It's possible that the callback action already called * purple_request_destroy() in which case 'this' object is already deleted * and calling Close() in such a case leads to an error. */ Requests *requests = &REQUEST->requests; if (requests->find(this) != requests->end()) Close(); }
void TweetsSearch::previousResults() { ui->results->clear(); showLoadingImage(ON); QString tweets; Requests *twitterRequest = new Requests; QByteArray request; request = twitterRequest->getRequest(TWEETS_SEARCH,ui->searchField->text().toStdString(),"&count="+twitter->getUserSettings()->searchTweetsByPage.toStdString()+"&since_id="+maxTweet.toStdString()); tweets = clsParser->parseTweets(&request); maxTweet = clsParser->maxTweetID; minTweet = clsParser->minTweetID; ui->results->setText(tweets); delete twitterRequest; showLoadingImage(OFF); }
void HTTPConnection::disconnectFromServer() { if (status == FinishedWork) return; status = FinishedWork; Requests copy = requests; requests.clear(); for (Requests::const_iterator i = copy.cbegin(), e = copy.cend(); i != e; ++i) { (*i)->abort(); (*i)->deleteLater(); } disconnect(&manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(requestFinished(QNetworkReply*))); address = QUrl(); }
void TweetsSearch::startSearch() { showLoadingImage(ON); QString tweets; Requests *twitterRequest = new Requests; QByteArray request; request = twitterRequest->getRequest(TWEETS_SEARCH,ui->searchField->text().toStdString(),"&count="+twitter->getUserSettings()->searchTweetsByPage.toStdString()); tweets = clsParser->parseTweets(&request); maxTweet = clsParser->maxTweetID; minTweet = clsParser->minTweetID; delete twitterRequest; ui->results->setText(tweets); scroolPosition = ui->results->verticalScrollBar()->value(); showLoadingImage(OFF); }
Requests StoragesAssigner::PerformAssignment(Requests& requests) { Requests assignedRequests; // the result set Requests::iterator it = requests.begin(); Requests::iterator itEnd = requests.end(); // generate the assosiative set of nodes RequestsStorages requestsStorages; // form the vector from the set to have an ability to sort it std::vector<Request::Storages * > storages; storages.reserve(requests.size()); for ( ; it != itEnd; ++it ) { requestsStorages[&(*it)->getStorages()] = (*it); storages.push_back(&(*it)->getStorages()); } std::sort(storages.begin(), storages.end(), requestStoragesCompare); for ( unsigned requestIndex = 0; requestIndex < storages.size(); ++requestIndex ) { Request::Storages * st = storages[requestIndex]; // generate new assignment for the chosen storage Assignment* reqAssignment = new Assignment(); requestAssignment[requestsStorages[st]] = reqAssignment; bool result = assignOneRequest(st, reqAssignment); if ( result ) // virtual machine assigned successfully assignedRequests.insert(requestsStorages[st]); else { requestAssignment.erase(requestsStorages[st]); delete reqAssignment; } } return assignedRequests; }