// --------------------------------------------------------------------------- // HTTP event handler // --------------------------------------------------------------------------- // void CNcdSendHttpRequestOperation::HandleHttpEventL( MCatalogsHttpOperation& aOperation, TCatalogsHttpEvent aEvent ) { DLTRACEIN(("")); if ( aEvent.iOperationState == ECatalogsHttpOpInProgress && aEvent.iProgressState == ECatalogsHttpResponseBodyReceived ) { // Append the body iBody->InsertL( iBody->Size(), aOperation.Body() ); } else if ( aEvent.iOperationState == ECatalogsHttpOpCompleted ) { DLTRACE(("Operation complete")); // Compose the response here TCatalogsHttpResponseComposer composer; iResponse = composer.ComposeResponseL( aOperation, iBody->Ptr( 0 ) ); delete iBody; iBody = NULL; aOperation.Release(); iTransaction = NULL; iOperationState = EStateComplete; RunOperation(); } }
// --------------------------------------------------------------------------- // HTTP error handler // --------------------------------------------------------------------------- // TBool CNcdSendHttpRequestOperation::HandleHttpError( MCatalogsHttpOperation& aOperation, TCatalogsHttpError aError ) { DLTRACEIN(("")); aOperation.Cancel(); iTransaction = NULL; iError = aError.iError; iOperationState = EStateComplete; RunOperation(); return ETrue; }
int main(int argc, char** argv) { std::vector<int> heapVector; std::vector<std::string> commandVector; BuildVector(commandVector, std::cin); heapVector.reserve(500); MinHeap<int> heap(heapVector); std::ofstream file; file.open("output.txt"); std::vector<std::string>::iterator iter; for (iter = commandVector.begin(); iter != commandVector.end(); ++iter) { // split on the space to get the operation and command auto command = SplitString(*iter, ' '); auto operation = (*command.begin())[0]; RunOperation(operation, command, heap, std::cout); } file.close(); return 0; }