/*! Constructs a QDLLink from the data in \a dataObject */ QDLLink::QDLLink( const QDSData& dataObject ) : d( 0 ) { d = new QDLLinkPrivate(); if ( dataObject.type().id() == mimeType().id() ) { QByteArray array = dataObject.data(); { QDataStream ds( &array, QIODevice::ReadOnly ); ds >> *this; } }
/*! Constructs an action request for a service with \a requestData. The service responding to the request is provided in \a serviceInfo and the channel for responding to the client is provided in \a channel. \a auxiliary data can also be attached to the request. The request is attached to \a parent. */ QDSActionRequest::QDSActionRequest( const QDSServiceInfo& serviceInfo, const QDSData& requestData, const QString& channel, const QByteArray& auxiliary, QObject* parent ) : QObject( parent ), d( 0 ) { d = new QDSActionRequestPrivate( serviceInfo, requestData, auxiliary, channel ); if ( !d->mServiceInfo.supportsRequestDataType( requestData.type() ) ) respond( QString( tr( "request contained unexpected data" ) ) ); }
/*! Sends \a responseData back to the client to indicate that the request has been processed correctly. This method is to be used for services which have response data. Returns false if a response has already been sent or the service doesn't require response data; otherwise returns true. */ bool QDSActionRequest::respond( const QDSData &responseData ) { if ( d->mComplete ) return false; if ( !d->mServiceInfo.supportsResponseDataType( responseData.type() ) ) return false; d->mResponseData = responseData; d->mComplete = true; d->emitResponse(); return true; }