QtMockWebServer  1.0
 All Classes Functions Pages
Public Member Functions | Protected Attributes | List of all members
QueueDispatcher Class Reference

A dispatcher using queue policy. More...

#include <QueueDispatcher.h>

Inheritance diagram for QueueDispatcher:
Dispatcher

Public Member Functions

virtual MockResponse dispatch (const RecordedRequest &request)
 Serve incoming request with next response in queue. More...
 
virtual MockResponse peek ()
 Head response in queue if queue is not empty. Otherwise the fail-fast response is returned if set. If both are empty, Dispatcher::peek() is returned. More...
 
void enqueueResponse (const MockResponse &response)
 Enqueue given response. More...
 
void setFailFast (bool failFast)
 Set if we should dispatch a immediate fail response when the queue is empty. More...
 
void setFailFast (MockResponse *failFastResponse)
 Set the fail-fast response which will be used when the queue is empty. More...
 

Protected Attributes

QQueue< MockResponsem_responseQueue
 

Detailed Description

A dispatcher using queue policy.

Member Function Documentation

MockResponse QueueDispatcher::dispatch ( const RecordedRequest request)
virtual

Serve incoming request with next response in queue.

Parameters
requestThe incoming request.
Returns
Next response in queue.

Implements Dispatcher.

void QueueDispatcher::enqueueResponse ( const MockResponse response)

Enqueue given response.

Parameters
responseA mock response.
MockResponse QueueDispatcher::peek ( )
virtual

Head response in queue if queue is not empty. Otherwise the fail-fast response is returned if set. If both are empty, Dispatcher::peek() is returned.

Returns
Guess of next resposne.

Reimplemented from Dispatcher.

void QueueDispatcher::setFailFast ( bool  failFast)

Set if we should dispatch a immediate fail response when the queue is empty.

Todo:
It will be useful after queue is implemented blockable.
Parameters
failFastTrue if should fail fast.
void QueueDispatcher::setFailFast ( MockResponse failFastResponse)

Set the fail-fast response which will be used when the queue is empty.

Todo:
It will be useful after queue is implemented blockable.
Parameters
failFastResponse

The documentation for this class was generated from the following files: