[*] remove dependency from QObjectPrivate

This commit is contained in:
fuCtor 2012-04-17 06:50:44 -07:00
parent 82f2d89435
commit 288c9df70a
17 changed files with 184 additions and 222 deletions

View File

@ -3,7 +3,6 @@
#include <QTextStream> #include <QTextStream>
#include <QCoreApplication> #include <QCoreApplication>
#include "qamqp_global.h"
#include "amqp_exchange.h" #include "amqp_exchange.h"
#include "amqp_queue.h" #include "amqp_queue.h"
#include "amqp_authenticator.h" #include "amqp_authenticator.h"
@ -27,8 +26,8 @@ struct QAMQP::ClientExceptionCleaner
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
ClientPrivate::ClientPrivate(int version ) ClientPrivate::ClientPrivate( Client * q ) :
:QObjectPrivate(version) pq_ptr(q)
, port(AMQPPORT) , port(AMQPPORT)
, host(QString::fromLatin1(AMQPHOST)) , host(QString::fromLatin1(AMQPHOST))
, virtualHost(QString::fromLatin1(AMQPVHOST)) , virtualHost(QString::fromLatin1(AMQPVHOST))
@ -44,14 +43,14 @@ ClientPrivate::~ClientPrivate()
void ClientPrivate::init(QObject * parent) void ClientPrivate::init(QObject * parent)
{ {
q_func()->setParent(parent); pq_func()->setParent(parent);
if(!network_){ if(!network_){
network_ = new QAMQP::Network(q_func()); network_ = new QAMQP::Network(pq_func());
} }
if(!connection_) if(!connection_)
{ {
connection_ = new QAMQP::Connection(q_func()); connection_ = new QAMQP::Connection(pq_func());
} }
setAuth(new AMQPlainAuthenticator(QString::fromLatin1(AMQPLOGIN), QString::fromLatin1(AMQPPSWD))); setAuth(new AMQPlainAuthenticator(QString::fromLatin1(AMQPLOGIN), QString::fromLatin1(AMQPPSWD)));
@ -98,7 +97,7 @@ void ClientPrivate::connect()
void ClientPrivate::parseCnnString( const QUrl & con ) void ClientPrivate::parseCnnString( const QUrl & con )
{ {
Q_Q(QAMQP::Client); P_Q(QAMQP::Client);
if(con.scheme() == AMQPSCHEME ) if(con.scheme() == AMQPSCHEME )
{ {
q->setPassword(con.password()); q->setPassword(con.password());
@ -122,7 +121,7 @@ void ClientPrivate::login()
Exchange * ClientPrivate::createExchange(int channelNumber, const QString &name ) Exchange * ClientPrivate::createExchange(int channelNumber, const QString &name )
{ {
Exchange * exchange_ = new Exchange(channelNumber, q_func()); Exchange * exchange_ = new Exchange(channelNumber, pq_func());
QObject::connect(network_, SIGNAL(method(const QAMQP::Frame::Method &)), QObject::connect(network_, SIGNAL(method(const QAMQP::Frame::Method &)),
exchange_, SLOT(_q_method(const QAMQP::Frame::Method &))); exchange_, SLOT(_q_method(const QAMQP::Frame::Method &)));
@ -133,7 +132,7 @@ Exchange * ClientPrivate::createExchange(int channelNumber, const QString &name
Queue * ClientPrivate::createQueue(int channelNumber, const QString &name ) Queue * ClientPrivate::createQueue(int channelNumber, const QString &name )
{ {
Queue * queue_ = new Queue(channelNumber, q_func()); Queue * queue_ = new Queue(channelNumber, pq_func());
QObject::connect(network_, SIGNAL(method(const QAMQP::Frame::Method &)), QObject::connect(network_, SIGNAL(method(const QAMQP::Frame::Method &)),
queue_, SLOT(_q_method(const QAMQP::Frame::Method &))); queue_, SLOT(_q_method(const QAMQP::Frame::Method &)));
@ -159,42 +158,29 @@ void ClientPrivate::disconnect()
QAMQP::Client::Client( QObject * parent /*= 0*/ ) QAMQP::Client::Client( QObject * parent /*= 0*/ )
: QObject(*new ClientPrivate, 0) : pd_ptr(new ClientPrivate(this))
{ {
QT_TRY { QT_TRY {
d_func()->init(parent); pd_func()->init(parent);
} QT_CATCH(...) { } QT_CATCH(...) {
ClientExceptionCleaner::cleanup(this, d_func()); ClientExceptionCleaner::cleanup(this, pd_func());
QT_RETHROW; QT_RETHROW;
} }
} }
QAMQP::Client::Client( const QUrl & connectionString, QObject * parent /*= 0*/ ) QAMQP::Client::Client( const QUrl & connectionString, QObject * parent /*= 0*/ )
: QObject(*new ClientPrivate, 0) : pd_ptr(new ClientPrivate(this))
{ {
QT_TRY { QT_TRY {
d_func()->init(parent, connectionString); pd_func()->init(parent, connectionString);
} QT_CATCH(...) { } QT_CATCH(...) {
ClientExceptionCleaner::cleanup(this, d_func()); ClientExceptionCleaner::cleanup(this, pd_func());
QT_RETHROW;
}
}
QAMQP::Client::Client(ClientPrivate &dd, QObject* parent, const QUrl & connectionString)
: QObject(dd, 0)
{
Q_D(QAMQP::Client);
QT_TRY {
d->init(parent, connectionString);
} QT_CATCH(...) {
ClientExceptionCleaner::cleanup(this, d_func());
QT_RETHROW; QT_RETHROW;
} }
} }
QAMQP::Client::~Client() QAMQP::Client::~Client()
{ {
QObjectPrivate::clearGuards(this);
QT_TRY { QT_TRY {
QEvent e(QEvent::Destroy); QEvent e(QEvent::Destroy);
QCoreApplication::sendEvent(this, &e); QCoreApplication::sendEvent(this, &e);
@ -205,37 +191,37 @@ QAMQP::Client::~Client()
quint32 QAMQP::Client::port() const quint32 QAMQP::Client::port() const
{ {
return d_func()->port; return pd_func()->port;
} }
void QAMQP::Client::setPort( quint32 port ) void QAMQP::Client::setPort( quint32 port )
{ {
d_func()->port = port; pd_func()->port = port;
} }
QString QAMQP::Client::host() const QString QAMQP::Client::host() const
{ {
return d_func()->host; return pd_func()->host;
} }
void QAMQP::Client::setHost( const QString & host ) void QAMQP::Client::setHost( const QString & host )
{ {
d_func()->host = host; pd_func()->host = host;
} }
QString QAMQP::Client::virtualHost() const QString QAMQP::Client::virtualHost() const
{ {
return d_func()->virtualHost; return pd_func()->virtualHost;
} }
void QAMQP::Client::setVirtualHost( const QString & virtualHost ) void QAMQP::Client::setVirtualHost( const QString & virtualHost )
{ {
d_func()->virtualHost = virtualHost; pd_func()->virtualHost = virtualHost;
} }
QString QAMQP::Client::user() const QString QAMQP::Client::user() const
{ {
const Authenticator * auth = d_func()->auth_.data(); const Authenticator * auth = pd_func()->auth_.data();
if(auth && auth->type() == "AMQPLAIN") if(auth && auth->type() == "AMQPLAIN")
{ {
@ -247,7 +233,7 @@ QString QAMQP::Client::user() const
void QAMQP::Client::setUser( const QString & user ) void QAMQP::Client::setUser( const QString & user )
{ {
Authenticator * auth = d_func()->auth_.data(); Authenticator * auth = pd_func()->auth_.data();
if(auth && auth->type() == "AMQPLAIN") if(auth && auth->type() == "AMQPLAIN")
{ {
@ -258,7 +244,7 @@ void QAMQP::Client::setUser( const QString & user )
QString QAMQP::Client::password() const QString QAMQP::Client::password() const
{ {
const Authenticator * auth = d_func()->auth_.data(); const Authenticator * auth = pd_func()->auth_.data();
if(auth && auth->type() == "AMQPLAIN") if(auth && auth->type() == "AMQPLAIN")
{ {
@ -270,7 +256,7 @@ QString QAMQP::Client::password() const
void QAMQP::Client::setPassword( const QString & password ) void QAMQP::Client::setPassword( const QString & password )
{ {
Authenticator * auth = d_func()->auth_.data(); Authenticator * auth = pd_func()->auth_.data();
if(auth && auth->type() == "AMQPLAIN") if(auth && auth->type() == "AMQPLAIN")
{ {
@ -282,7 +268,7 @@ void QAMQP::Client::setPassword( const QString & password )
void QAMQP::Client::printConnect() const void QAMQP::Client::printConnect() const
{ {
#ifdef _DEBUG #ifdef _DEBUG
d_func()->printConnect(); pd_func()->printConnect();
#endif // _DEBUG #endif // _DEBUG
} }
@ -293,52 +279,52 @@ void QAMQP::Client::closeChannel()
Exchange * QAMQP::Client::createExchange(int channelNumber) Exchange * QAMQP::Client::createExchange(int channelNumber)
{ {
return d_func()->createExchange(channelNumber, QString()); return pd_func()->createExchange(channelNumber, QString());
} }
Exchange * QAMQP::Client::createExchange( const QString &name, int channelNumber ) Exchange * QAMQP::Client::createExchange( const QString &name, int channelNumber )
{ {
return d_func()->createExchange(channelNumber, name); return pd_func()->createExchange(channelNumber, name);
} }
Queue * QAMQP::Client::createQueue(int channelNumber) Queue * QAMQP::Client::createQueue(int channelNumber)
{ {
return d_func()->createQueue(channelNumber, QString()); return pd_func()->createQueue(channelNumber, QString());
} }
Queue * QAMQP::Client::createQueue( const QString &name, int channelNumber ) Queue * QAMQP::Client::createQueue( const QString &name, int channelNumber )
{ {
return d_func()->createQueue(channelNumber, name); return pd_func()->createQueue(channelNumber, name);
} }
void QAMQP::Client::open() void QAMQP::Client::open()
{ {
return d_func()->connect(); return pd_func()->connect();
} }
void QAMQP::Client::open( const QUrl & connectionString ) void QAMQP::Client::open( const QUrl & connectionString )
{ {
d_func()->parseCnnString(connectionString); pd_func()->parseCnnString(connectionString);
open(); open();
} }
void QAMQP::Client::close() void QAMQP::Client::close()
{ {
return d_func()->disconnect(); return pd_func()->disconnect();
} }
void QAMQP::Client::reopen() void QAMQP::Client::reopen()
{ {
d_func()->disconnect(); pd_func()->disconnect();
d_func()->connect(); pd_func()->connect();
} }
void QAMQP::Client::setAuth( Authenticator * auth ) void QAMQP::Client::setAuth( Authenticator * auth )
{ {
d_func()->setAuth(auth); pd_func()->setAuth(auth);
} }
Authenticator * QAMQP::Client::auth() const Authenticator * QAMQP::Client::auth() const
{ {
return d_func()->auth_.data(); return pd_func()->auth_.data();
} }

View File

@ -3,6 +3,7 @@
#include <QObject> #include <QObject>
#include <QUrl> #include <QUrl>
#include "amqp_global.h"
namespace QAMQP namespace QAMQP
{ {
@ -21,8 +22,10 @@ namespace QAMQP
Q_PROPERTY(QString user READ user WRITE setUser); Q_PROPERTY(QString user READ user WRITE setUser);
Q_PROPERTY(QString password READ password WRITE setPassword); Q_PROPERTY(QString password READ password WRITE setPassword);
Q_DECLARE_PRIVATE(QAMQP::Client)
Q_DISABLE_COPY(Client) Q_DISABLE_COPY(Client)
P_DECLARE_PRIVATE(QAMQP::Client)
friend class ConnectionPrivate; friend class ConnectionPrivate;
friend class ChannelPrivate; friend class ChannelPrivate;
@ -61,12 +64,12 @@ namespace QAMQP
void open(const QUrl & connectionString); void open(const QUrl & connectionString);
void close(); void close();
void reopen(); void reopen();
protected: protected:
Client(ClientPrivate &d, QObject* parent, const QUrl & connectionString); ClientPrivate * const pd_ptr;
private: private:
friend struct ClientExceptionCleaner; friend struct ClientExceptionCleaner;
//void chanalConnect(); //void chanalConnect();
}; };
} }

View File

@ -1,7 +1,7 @@
#ifndef amqp_authenticator_h__ #ifndef amqp_authenticator_h__
#define amqp_authenticator_h__ #define amqp_authenticator_h__
#include "qamqp_global.h" #include "amqp_global.h"
#include <QString> #include <QString>
#include <QDataStream> #include <QDataStream>

View File

@ -33,31 +33,24 @@ namespace QAMQP
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
QAMQP::Channel::Channel(int channelNumber /*= -1*/, Client * parent /*= 0*/ ) QAMQP::Channel::Channel(int channelNumber /*= -1*/, Client * parent /*= 0*/ )
: QObject(*new ChannelPrivate, 0) : pd_ptr(new ChannelPrivate(this))
{ {
QT_TRY { QT_TRY {
d_func()->init(channelNumber, parent); pd_func()->init(channelNumber, parent);
} QT_CATCH(...) { } QT_CATCH(...) {
ChannelExceptionCleaner::cleanup(this, d_func()); ChannelExceptionCleaner::cleanup(this, pd_func());
QT_RETHROW; QT_RETHROW;
} }
} }
QAMQP::Channel::Channel( ChannelPrivate &dd, int channelNumber, Client* parent ) QAMQP::Channel::Channel( ChannelPrivate * d )
: QObject(dd, 0) : pd_ptr(d)
{ {
Q_D(QAMQP::Channel);
QT_TRY {
d->init(channelNumber, parent);
} QT_CATCH(...) {
ChannelExceptionCleaner::cleanup(this, d_func());
QT_RETHROW;
}
} }
QAMQP::Channel::~Channel() QAMQP::Channel::~Channel()
{ {
QObjectPrivate::clearGuards(this);
QT_TRY { QT_TRY {
QEvent e(QEvent::Destroy); QEvent e(QEvent::Destroy);
@ -69,7 +62,7 @@ QAMQP::Channel::~Channel()
void QAMQP::Channel::closeChannel() void QAMQP::Channel::closeChannel()
{ {
Q_D(Channel); P_D(Channel);
d->needOpen = true; d->needOpen = true;
if(d->opened) if(d->opened)
d->close(0, QString(), 0,0); d->close(0, QString(), 0,0);
@ -79,22 +72,22 @@ void QAMQP::Channel::closeChannel()
void QAMQP::Channel::reopen() void QAMQP::Channel::reopen()
{ {
closeChannel(); closeChannel();
d_func()->open(); pd_func()->open();
} }
QString QAMQP::Channel::name() QString QAMQP::Channel::name()
{ {
return d_func()->name; return pd_func()->name;
} }
int QAMQP::Channel::channelNumber() int QAMQP::Channel::channelNumber()
{ {
return d_func()->number; return pd_func()->number;
} }
void QAMQP::Channel::setName( const QString &name ) void QAMQP::Channel::setName( const QString &name )
{ {
d_func()->name = name; pd_func()->name = name;
} }
void QAMQP::Channel::stateChanged( int state ) void QAMQP::Channel::stateChanged( int state )
@ -118,7 +111,7 @@ void QAMQP::Channel::stateChanged( int state )
bool QAMQP::Channel::isOpened() const bool QAMQP::Channel::isOpened() const
{ {
return d_func()->opened; return pd_func()->opened;
} }
void QAMQP::Channel::onOpen() void QAMQP::Channel::onOpen()
@ -133,12 +126,12 @@ void QAMQP::Channel::onClose()
void QAMQP::Channel::setQOS( qint32 prefetchSize, quint16 prefetchCount ) void QAMQP::Channel::setQOS( qint32 prefetchSize, quint16 prefetchCount )
{ {
d_func()->setQOS(prefetchSize, prefetchCount); pd_func()->setQOS(prefetchSize, prefetchCount);
} }
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
ChannelPrivate::ChannelPrivate(int version /* = QObjectPrivateVersion */) ChannelPrivate::ChannelPrivate(Channel * q)
:QObjectPrivate(version) :pq_ptr(q)
, number(0) , number(0)
, opened(false) , opened(false)
, needOpen(true) , needOpen(true)
@ -156,7 +149,7 @@ void ChannelPrivate::init(int channelNumber, Client * parent)
needOpen = channelNumber == -1 ? true : false; needOpen = channelNumber == -1 ? true : false;
number = channelNumber == -1 ? ++nextChannelNumber_ : channelNumber; number = channelNumber == -1 ? ++nextChannelNumber_ : channelNumber;
nextChannelNumber_ = qMax(channelNumber, (nextChannelNumber_ + 1)); nextChannelNumber_ = qMax(channelNumber, (nextChannelNumber_ + 1));
q_func()->setParent(parent); pq_func()->setParent(parent);
client_ = parent; client_ = parent;
} }
@ -200,7 +193,7 @@ void ChannelPrivate::_q_open()
void ChannelPrivate::sendFrame( const QAMQP::Frame::Base & frame ) void ChannelPrivate::sendFrame( const QAMQP::Frame::Base & frame )
{ {
client_->d_func()->network_->sendFrame(frame); client_->pd_func()->network_->sendFrame(frame);
} }
@ -209,7 +202,7 @@ void ChannelPrivate::open()
if(!needOpen) if(!needOpen)
return; return;
if(!client_->d_func()->connection_->isConnected()) if(!client_->pd_func()->connection_->isConnected())
return; return;
qDebug("Open channel #%d", number); qDebug("Open channel #%d", number);
QAMQP::Frame::Method frame(QAMQP::Frame::fcChannel, miOpen); QAMQP::Frame::Method frame(QAMQP::Frame::fcChannel, miOpen);
@ -256,12 +249,12 @@ void ChannelPrivate::close(int code, const QString & text, int classId, int meth
stream << qint16(methodId); stream << qint16(methodId);
frame.setArguments(arguments_); frame.setArguments(arguments_);
client_->d_func()->network_->sendFrame(frame); client_->pd_func()->network_->sendFrame(frame);
} }
void ChannelPrivate::close( const QAMQP::Frame::Method & frame ) void ChannelPrivate::close( const QAMQP::Frame::Method & frame )
{ {
q_func()->stateChanged(csClosed); pq_func()->stateChanged(csClosed);
qDebug(">> CLOSE"); qDebug(">> CLOSE");
QByteArray data = frame.arguments(); QByteArray data = frame.arguments();
@ -288,7 +281,7 @@ void ChannelPrivate::closeOk()
void ChannelPrivate::closeOk( const QAMQP::Frame::Method & frame ) void ChannelPrivate::closeOk( const QAMQP::Frame::Method & frame )
{ {
Q_UNUSED(frame); Q_UNUSED(frame);
Q_Q(Channel); P_Q(Channel);
q->stateChanged(csClosed); q->stateChanged(csClosed);
q->onClose(); q->onClose();
opened = false; opened = false;
@ -297,7 +290,7 @@ void ChannelPrivate::closeOk( const QAMQP::Frame::Method & frame )
void ChannelPrivate::openOk( const QAMQP::Frame::Method & frame ) void ChannelPrivate::openOk( const QAMQP::Frame::Method & frame )
{ {
Q_UNUSED(frame); Q_UNUSED(frame);
Q_Q(Channel); P_Q(Channel);
qDebug(">> OpenOK"); qDebug(">> OpenOK");
opened = true; opened = true;
q->stateChanged(csOpened); q->stateChanged(csOpened);
@ -307,5 +300,5 @@ void ChannelPrivate::openOk( const QAMQP::Frame::Method & frame )
void ChannelPrivate::setQOS( qint32 prefetchSize, quint16 prefetchCount ) void ChannelPrivate::setQOS( qint32 prefetchSize, quint16 prefetchCount )
{ {
client_->d_func()->connection_->d_func()->setQOS(prefetchSize, prefetchCount, number, false); client_->pd_func()->connection_->pd_func()->setQOS(prefetchSize, prefetchCount, number, false);
} }

View File

@ -2,7 +2,7 @@
#define amqp_channel_h__ #define amqp_channel_h__
#include <QObject> #include <QObject>
#include "qamqp_global.h" #include "amqp_global.h"
#include "amqp_frame.h" #include "amqp_frame.h"
namespace QAMQP namespace QAMQP
@ -16,7 +16,7 @@ namespace QAMQP
Q_PROPERTY(int number READ channelNumber); Q_PROPERTY(int number READ channelNumber);
Q_PROPERTY(QString name READ name WRITE setName); Q_PROPERTY(QString name READ name WRITE setName);
Q_DECLARE_PRIVATE(QAMQP::Channel) P_DECLARE_PRIVATE(QAMQP::Channel)
Q_DISABLE_COPY(Channel) Q_DISABLE_COPY(Channel)
public: public:
~Channel(); ~Channel();
@ -38,15 +38,17 @@ namespace QAMQP
protected: protected:
Channel(int channelNumber = -1, Client * parent = 0); Channel(int channelNumber = -1, Client * parent = 0);
Channel(ChannelPrivate &dd, int channelNumber = -1, Client* parent = 0); Channel(ChannelPrivate * d);
virtual void onOpen();; virtual void onOpen();
virtual void onClose();; virtual void onClose();
ChannelPrivate * const pd_ptr;
private: private:
void stateChanged(int state); void stateChanged(int state);
friend class ClientPrivate; friend class ClientPrivate;
Q_PRIVATE_SLOT(d_func(), void _q_open()) Q_PRIVATE_SLOT(pd_func(), void _q_open())
Q_PRIVATE_SLOT(d_func(), void _q_method(const QAMQP::Frame::Method & frame)) Q_PRIVATE_SLOT(pd_func(), void _q_method(const QAMQP::Frame::Method & frame))
}; };
} }

View File

@ -1,7 +1,8 @@
#ifndef amqp_channel_p_h__ #ifndef amqp_channel_p_h__
#define amqp_channel_p_h__ #define amqp_channel_p_h__
#include <QtCore/private/qobject_p.h> #include "amqp_global.h"
#include <QPointer>
#define METHOD_ID_ENUM(name, id) name = id, name ## Ok #define METHOD_ID_ENUM(name, id) name = id, name ## Ok
@ -9,9 +10,9 @@ namespace QAMQP
{ {
class Client; class Client;
class ClientPrivate; class ClientPrivate;
class ChannelPrivate : public QObjectPrivate class ChannelPrivate
{ {
Q_DECLARE_PUBLIC(QAMQP::Channel) P_DECLARE_PUBLIC(QAMQP::Channel)
public: public:
enum MethodId enum MethodId
{ {
@ -43,7 +44,7 @@ namespace QAMQP
METHOD_ID_ENUM(bmRecover, 110) METHOD_ID_ENUM(bmRecover, 110)
}; };
ChannelPrivate(int version = QObjectPrivateVersion); ChannelPrivate(Channel * q);
virtual ~ChannelPrivate(); virtual ~ChannelPrivate();
void init(int channelNumber, Client * parent); void init(int channelNumber, Client * parent);
@ -76,6 +77,8 @@ namespace QAMQP
static int nextChannelNumber_; static int nextChannelNumber_;
bool opened; bool opened;
bool needOpen; bool needOpen;
Channel * const pq_ptr;
}; };
} }
#endif // amqp_channel_p_h__ #endif // amqp_channel_p_h__

View File

@ -33,8 +33,10 @@ namespace QAMQP
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
ConnectionPrivate::ConnectionPrivate( int version /*= QObjectPrivateVersion*/ ) ConnectionPrivate::ConnectionPrivate( Connection * q)
:QObjectPrivate(version), closed_(false), connected(false) :pq_ptr(q)
, closed_(false)
, connected(false)
{ {
} }
@ -46,7 +48,7 @@ ConnectionPrivate::~ConnectionPrivate()
void ConnectionPrivate::init(Client * parent) void ConnectionPrivate::init(Client * parent)
{ {
q_func()->setParent(parent); pq_func()->setParent(parent);
client_ = parent; client_ = parent;
} }
@ -62,13 +64,13 @@ void ConnectionPrivate::startOk()
clientProperties["product"] = "QAMQP"; clientProperties["product"] = "QAMQP";
QAMQP::Frame::serialize(stream, clientProperties); QAMQP::Frame::serialize(stream, clientProperties);
client_->d_func()->auth_->write(stream); client_->pd_func()->auth_->write(stream);
QAMQP::Frame::writeField('s', stream, "en_US"); QAMQP::Frame::writeField('s', stream, "en_US");
frame.setArguments(arguments_); frame.setArguments(arguments_);
client_->d_func()->network_->sendFrame(frame); client_->pd_func()->network_->sendFrame(frame);
} }
void ConnectionPrivate::secureOk() void ConnectionPrivate::secureOk()
@ -88,7 +90,7 @@ void ConnectionPrivate::tuneOk()
stream << qint16(0); //heartbeat stream << qint16(0); //heartbeat
frame.setArguments(arguments_); frame.setArguments(arguments_);
client_->d_func()->network_->sendFrame(frame); client_->pd_func()->network_->sendFrame(frame);
} }
void ConnectionPrivate::open() void ConnectionPrivate::open()
@ -103,7 +105,7 @@ void ConnectionPrivate::open()
stream << qint8(0); stream << qint8(0);
frame.setArguments(arguments_); frame.setArguments(arguments_);
client_->d_func()->network_->sendFrame(frame); client_->pd_func()->network_->sendFrame(frame);
} }
void ConnectionPrivate::start( const QAMQP::Frame::Method & frame ) void ConnectionPrivate::start( const QAMQP::Frame::Method & frame )
@ -164,7 +166,7 @@ void ConnectionPrivate::openOk( const QAMQP::Frame::Method & frame )
Q_UNUSED(frame); Q_UNUSED(frame);
qDebug(">> OpenOK"); qDebug(">> OpenOK");
connected = true; connected = true;
q_func()->openOk(); pq_func()->openOk();
} }
void ConnectionPrivate::close( const QAMQP::Frame::Method & frame ) void ConnectionPrivate::close( const QAMQP::Frame::Method & frame )
@ -199,20 +201,20 @@ void ConnectionPrivate::close(int code, const QString & text, int classId, int m
stream << qint16(methodId); stream << qint16(methodId);
frame.setArguments(arguments_); frame.setArguments(arguments_);
client_->d_func()->network_->sendFrame(frame); client_->pd_func()->network_->sendFrame(frame);
} }
void ConnectionPrivate::closeOk() void ConnectionPrivate::closeOk()
{ {
QAMQP::Frame::Method frame(QAMQP::Frame::fcConnection, miCloseOk); QAMQP::Frame::Method frame(QAMQP::Frame::fcConnection, miCloseOk);
connected = false; connected = false;
client_->d_func()->network_->sendFrame(frame); client_->pd_func()->network_->sendFrame(frame);
} }
void ConnectionPrivate::closeOk( const QAMQP::Frame::Method & ) void ConnectionPrivate::closeOk( const QAMQP::Frame::Method & )
{ {
connected = false; connected = false;
QMetaObject::invokeMethod(q_func(), "disconnected"); QMetaObject::invokeMethod(pq_func(), "disconnected");
} }
@ -228,7 +230,7 @@ void ConnectionPrivate::setQOS( qint32 prefetchSize, quint16 prefetchCount, int
out << qint8(global ? 1 : 0); out << qint8(global ? 1 : 0);
frame.setArguments(arguments_); frame.setArguments(arguments_);
client_->d_func()->network_->sendFrame(frame); client_->pd_func()->network_->sendFrame(frame);
} }
@ -276,32 +278,18 @@ bool ConnectionPrivate::_q_method( const QAMQP::Frame::Method & frame )
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
Connection::Connection( Client * parent /*= 0*/ ) Connection::Connection( Client * parent /*= 0*/ )
: QObject(*new ConnectionPrivate, 0) : pd_ptr(new ConnectionPrivate(this))
{ {
QT_TRY { QT_TRY {
d_func()->init(parent); pd_func()->init(parent);
} QT_CATCH(...) { } QT_CATCH(...) {
ConnectionExceptionCleaner::cleanup(this, d_func()); ConnectionExceptionCleaner::cleanup(this, pd_func());
QT_RETHROW;
}
}
Connection::Connection(ConnectionPrivate &dd, Client* parent)
: QObject(dd, 0)
{
Q_D(QAMQP::Connection);
QT_TRY {
d->init(parent);
} QT_CATCH(...) {
ConnectionExceptionCleaner::cleanup(this, d_func());
QT_RETHROW; QT_RETHROW;
} }
} }
Connection::~Connection() Connection::~Connection()
{ {
QObjectPrivate::clearGuards(this);
QT_TRY { QT_TRY {
QEvent e(QEvent::Destroy); QEvent e(QEvent::Destroy);
QCoreApplication::sendEvent(this, &e); QCoreApplication::sendEvent(this, &e);
@ -312,32 +300,32 @@ Connection::~Connection()
void Connection::startOk() void Connection::startOk()
{ {
d_func()->startOk(); pd_func()->startOk();
} }
void Connection::secureOk() void Connection::secureOk()
{ {
d_func()->secureOk(); pd_func()->secureOk();
} }
void Connection::tuneOk() void Connection::tuneOk()
{ {
d_func()->tuneOk(); pd_func()->tuneOk();
} }
void Connection::open() void Connection::open()
{ {
d_func()->open(); pd_func()->open();
} }
void Connection::close(int code, const QString & text, int classId , int methodId) void Connection::close(int code, const QString & text, int classId , int methodId)
{ {
d_func()->close(code, text, classId, methodId); pd_func()->close(code, text, classId, methodId);
} }
void Connection::closeOk() void Connection::closeOk()
{ {
d_func()->closeOk(); pd_func()->closeOk();
emit disconnect(); emit disconnect();
} }
@ -348,11 +336,11 @@ void Connection::openOk()
bool Connection::isConnected() const bool Connection::isConnected() const
{ {
return d_func()->connected; return pd_func()->connected;
} }
void Connection::setQOS( qint32 prefetchSize, quint16 prefetchCount ) void Connection::setQOS( qint32 prefetchSize, quint16 prefetchCount )
{ {
d_func()->setQOS(prefetchSize, prefetchCount, 0, true); pd_func()->setQOS(prefetchSize, prefetchCount, 0, true);
} }

View File

@ -3,7 +3,7 @@
#include <QObject> #include <QObject>
#include "amqp_frame.h" #include "amqp_frame.h"
#include "qamqp_global.h" #include "amqp_global.h"
namespace QAMQP namespace QAMQP
{ {
@ -14,7 +14,7 @@ namespace QAMQP
class Connection : public QObject class Connection : public QObject
{ {
Q_OBJECT Q_OBJECT
Q_DECLARE_PRIVATE(QAMQP::Connection) P_DECLARE_PRIVATE(QAMQP::Connection)
Q_DISABLE_COPY(Connection) Q_DISABLE_COPY(Connection)
Connection(Client * parent = 0); Connection(Client * parent = 0);
public: public:
@ -35,12 +35,13 @@ namespace QAMQP
void disconnected(); void disconnected();
void connected(); void connected();
protected: protected:
Connection(ConnectionPrivate &dd, Client* parent); ConnectionPrivate * const pd_ptr;
private: private:
void openOk(); void openOk();
friend class ClientPrivate; friend class ClientPrivate;
friend class ChannelPrivate; friend class ChannelPrivate;
Q_PRIVATE_SLOT(d_func(), void _q_method(const QAMQP::Frame::Method & frame)) Q_PRIVATE_SLOT(pd_func(), void _q_method(const QAMQP::Frame::Method & frame))
}; };
} }

View File

@ -1,17 +1,17 @@
#ifndef amqp_connection_p_h__ #ifndef amqp_connection_p_h__
#define amqp_connection_p_h__ #define amqp_connection_p_h__
#include <QtCore/private/qobject_p.h>
#define METHOD_ID_ENUM(name, id) name = id, name ## Ok #define METHOD_ID_ENUM(name, id) name = id, name ## Ok
#include <QPointer>
namespace QAMQP namespace QAMQP
{ {
class Client; class Client;
class ClientPrivate; class ClientPrivate;
class ConnectionPrivate : public QObjectPrivate class ConnectionPrivate
{ {
Q_DECLARE_PUBLIC(QAMQP::Connection) P_DECLARE_PUBLIC(QAMQP::Connection)
public: public:
enum MethodId enum MethodId
{ {
@ -22,7 +22,7 @@ namespace QAMQP
METHOD_ID_ENUM(miClose, 50) METHOD_ID_ENUM(miClose, 50)
}; };
ConnectionPrivate(int version = QObjectPrivateVersion); ConnectionPrivate(Connection * q);
~ConnectionPrivate(); ~ConnectionPrivate();
void init(Client * parent); void init(Client * parent);
void startOk(); void startOk();
@ -45,6 +45,8 @@ namespace QAMQP
QPointer<Client> client_; QPointer<Client> client_;
bool closed_; bool closed_;
bool connected; bool connected;
Connection * const pq_ptr;
}; };
} }
#endif // amqp_connection_p_h__ #endif // amqp_connection_p_h__

View File

@ -29,12 +29,12 @@ namespace QAMQP
} }
Exchange::Exchange(int channelNumber, Client * parent /*= 0*/ ) Exchange::Exchange(int channelNumber, Client * parent /*= 0*/ )
: Channel(*new ExchangePrivate, 0) : Channel(new ExchangePrivate(this))
{ {
QT_TRY { QT_TRY {
d_func()->init(channelNumber, parent); pd_func()->init(channelNumber, parent);
} QT_CATCH(...) { } QT_CATCH(...) {
ExchangeExceptionCleaner::cleanup(this, d_func()); ExchangeExceptionCleaner::cleanup(this, pd_func());
QT_RETHROW; QT_RETHROW;
} }
} }
@ -46,7 +46,7 @@ Exchange::~Exchange()
void Exchange::onOpen() void Exchange::onOpen()
{ {
Q_D(Exchange); P_D(Exchange);
if(d->deleyedDeclare) if(d->deleyedDeclare)
{ {
d->declare(); d->declare();
@ -55,23 +55,23 @@ void Exchange::onOpen()
void Exchange::onClose() void Exchange::onClose()
{ {
d_func()->remove(true, true); pd_func()->remove(true, true);
} }
Exchange::ExchangeOptions Exchange::option() const Exchange::ExchangeOptions Exchange::option() const
{ {
return d_func()->options; return pd_func()->options;
} }
QString Exchange::type() const QString Exchange::type() const
{ {
return d_func()->type; return pd_func()->type;
} }
void Exchange::declare(const QString &type, ExchangeOptions option , const TableField & arg) void Exchange::declare(const QString &type, ExchangeOptions option , const TableField & arg)
{ {
Q_D(Exchange); P_D(Exchange);
d->options = option; d->options = option;
d->type = type; d->type = type;
d->arguments = arg; d->arguments = arg;
@ -80,13 +80,13 @@ void Exchange::declare(const QString &type, ExchangeOptions option , const Tabl
void Exchange::remove( bool ifUnused /*= true*/, bool noWait /*= true*/ ) void Exchange::remove( bool ifUnused /*= true*/, bool noWait /*= true*/ )
{ {
d_func()->remove(ifUnused, noWait); pd_func()->remove(ifUnused, noWait);
} }
void Exchange::bind( QAMQP::Queue * queue ) void Exchange::bind( QAMQP::Queue * queue )
{ {
queue->bind(this, d_func()->name); queue->bind(this, pd_func()->name);
} }
void Exchange::bind( const QString & queueName ) void Exchange::bind( const QString & queueName )
@ -104,21 +104,21 @@ void Exchange::bind( const QString & queueName, const QString &key )
void Exchange::publish( const QString & message, const QString & key ) void Exchange::publish( const QString & message, const QString & key )
{ {
d_func()->publish(message.toUtf8(), key); pd_func()->publish(message.toUtf8(), key);
} }
void Exchange::publish( const QByteArray & message, const QString & key, const QString &mimeType ) void Exchange::publish( const QByteArray & message, const QString & key, const QString &mimeType )
{ {
d_func()->publish(message, key, mimeType); pd_func()->publish(message, key, mimeType);
} }
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
ExchangePrivate::ExchangePrivate() ExchangePrivate::ExchangePrivate(Exchange * q)
:ChannelPrivate() :ChannelPrivate(q)
, deleyedDeclare(false) , deleyedDeclare(false)
, declared(false) , declared(false)
{ {
@ -157,14 +157,14 @@ void ExchangePrivate::declareOk( const QAMQP::Frame::Method & )
{ {
qDebug() << "Declared exchange: " << name; qDebug() << "Declared exchange: " << name;
declared = true; declared = true;
QMetaObject::invokeMethod(q_func(), "declared"); QMetaObject::invokeMethod(pq_func(), "declared");
} }
void ExchangePrivate::deleteOk( const QAMQP::Frame::Method & ) void ExchangePrivate::deleteOk( const QAMQP::Frame::Method & )
{ {
qDebug() << "Deleted exchange: " << name; qDebug() << "Deleted exchange: " << name;
declared = false; declared = false;
QMetaObject::invokeMethod(q_func(), "removed"); QMetaObject::invokeMethod(pq_func(), "removed");
} }
void ExchangePrivate::declare( ) void ExchangePrivate::declare( )

View File

@ -18,7 +18,7 @@ namespace QAMQP
Q_PROPERTY(QString type READ type); Q_PROPERTY(QString type READ type);
Q_PROPERTY(ExchangeOptions option READ option ); Q_PROPERTY(ExchangeOptions option READ option );
Q_DECLARE_PRIVATE(QAMQP::Exchange) P_DECLARE_PRIVATE(QAMQP::Exchange)
Q_DISABLE_COPY(Exchange); Q_DISABLE_COPY(Exchange);
friend class ClientPrivate; friend class ClientPrivate;
protected: protected:

View File

@ -6,7 +6,7 @@ namespace QAMQP
using namespace QAMQP::Frame; using namespace QAMQP::Frame;
class ExchangePrivate: public ChannelPrivate class ExchangePrivate: public ChannelPrivate
{ {
Q_DECLARE_PUBLIC(QAMQP::Exchange) P_DECLARE_PUBLIC(QAMQP::Exchange)
public: public:
enum MethodId enum MethodId
@ -15,7 +15,7 @@ namespace QAMQP
METHOD_ID_ENUM(miDelete, 20) METHOD_ID_ENUM(miDelete, 20)
}; };
ExchangePrivate(); ExchangePrivate(Exchange * q);
~ExchangePrivate(); ~ExchangePrivate();
void declare(); void declare();

View File

@ -1,20 +1,21 @@
#ifndef qamqp_amqp_p_h__ #ifndef qamqp_amqp_p_h__
#define qamqp_amqp_p_h__ #define qamqp_amqp_p_h__
#include <QtCore/private/qobject_p.h>
#include <QSharedPointer> #include <QSharedPointer>
#include "amqp_global.h"
#include "amqp_network.h" #include "amqp_network.h"
#include "amqp_connection.h" #include "amqp_connection.h"
#include "amqp_authenticator.h" #include "amqp_authenticator.h"
namespace QAMQP namespace QAMQP
{ {
class ClientPrivate : public QObjectPrivate class ClientPrivate
{ {
Q_DECLARE_PUBLIC(QAMQP::Client) P_DECLARE_PUBLIC(QAMQP::Client)
public: public:
ClientPrivate(int version = QObjectPrivateVersion); ClientPrivate(Client * q ) ;
~ClientPrivate(); ~ClientPrivate();
void init(QObject * parent); void init(QObject * parent);
@ -32,13 +33,14 @@ namespace QAMQP
quint32 port; quint32 port;
QString host; QString host;
QString virtualHost; QString virtualHost;
/*
QString user;
QString password;*/
QPointer<QAMQP::Network> network_; QPointer<QAMQP::Network> network_;
QPointer<QAMQP::Connection> connection_; QPointer<QAMQP::Connection> connection_;
QSharedPointer<Authenticator> auth_; QSharedPointer<Authenticator> auth_;
Client * const pq_ptr;
}; };
} }
#endif // amqp_p_h__ #endif // amqp_p_h__

View File

@ -30,12 +30,12 @@ namespace QAMQP
} }
Queue::Queue( int channelNumber, Client * parent /*= 0*/ ) Queue::Queue( int channelNumber, Client * parent /*= 0*/ )
: Channel(*new QueuePrivate, 0) : Channel(new QueuePrivate(this))
{ {
QT_TRY { QT_TRY {
d_func()->init(channelNumber, parent); pd_func()->init(channelNumber, parent);
} QT_CATCH(...) { } QT_CATCH(...) {
QueueExceptionCleaner::cleanup(this, d_func()); QueueExceptionCleaner::cleanup(this, pd_func());
QT_RETHROW; QT_RETHROW;
} }
} }
@ -47,7 +47,7 @@ Queue::~Queue()
void Queue::onOpen() void Queue::onOpen()
{ {
Q_D(Queue); P_D(Queue);
if(d->deleyedDeclare) if(d->deleyedDeclare)
{ {
d->declare(); d->declare();
@ -65,33 +65,33 @@ void Queue::onOpen()
void Queue::onClose() void Queue::onClose()
{ {
d_func()->remove(true, true); pd_func()->remove(true, true);
} }
Queue::QueueOptions Queue::option() const Queue::QueueOptions Queue::option() const
{ {
return d_func()->options; return pd_func()->options;
} }
void Queue::setNoAck( bool noAck ) void Queue::setNoAck( bool noAck )
{ {
d_func()->noAck = noAck; pd_func()->noAck = noAck;
} }
bool Queue::noAck() const bool Queue::noAck() const
{ {
return d_func()->noAck; return pd_func()->noAck;
} }
void Queue::declare() void Queue::declare()
{ {
Q_D(Queue); P_D(Queue);
declare(d->name, QueueOptions(Durable | AutoDelete)); declare(d->name, QueueOptions(Durable | AutoDelete));
} }
void Queue::declare( const QString &name, QueueOptions options ) void Queue::declare( const QString &name, QueueOptions options )
{ {
Q_D(Queue); P_D(Queue);
setName(name); setName(name);
d->options = options; d->options = options;
d->declare(); d->declare();
@ -99,85 +99,85 @@ void Queue::declare( const QString &name, QueueOptions options )
void Queue::remove( bool ifUnused /*= true*/, bool ifEmpty /*= true*/, bool noWait /*= true*/ ) void Queue::remove( bool ifUnused /*= true*/, bool ifEmpty /*= true*/, bool noWait /*= true*/ )
{ {
d_func()->remove(ifUnused, ifEmpty, noWait); pd_func()->remove(ifUnused, ifEmpty, noWait);
} }
void Queue::purge() void Queue::purge()
{ {
d_func()->purge(); pd_func()->purge();
} }
void Queue::bind( const QString & exchangeName, const QString & key ) void Queue::bind( const QString & exchangeName, const QString & key )
{ {
d_func()->bind(exchangeName, key); pd_func()->bind(exchangeName, key);
} }
void Queue::bind( Exchange * exchange, const QString & key ) void Queue::bind( Exchange * exchange, const QString & key )
{ {
if(exchange) if(exchange)
d_func()->bind(exchange->name(), key); pd_func()->bind(exchange->name(), key);
} }
void Queue::unbind( const QString & exchangeName, const QString & key ) void Queue::unbind( const QString & exchangeName, const QString & key )
{ {
d_func()->unbind(exchangeName, key); pd_func()->unbind(exchangeName, key);
} }
void Queue::unbind( Exchange * exchange, const QString & key ) void Queue::unbind( Exchange * exchange, const QString & key )
{ {
if(exchange) if(exchange)
d_func()->unbind(exchange->name(), key); pd_func()->unbind(exchange->name(), key);
} }
QAMQP::MessagePtr Queue::getMessage() QAMQP::MessagePtr Queue::getMessage()
{ {
return d_func()->messages_.dequeue(); return pd_func()->messages_.dequeue();
} }
bool Queue::hasMessage() const bool Queue::hasMessage() const
{ {
if(d_func()->messages_.isEmpty()) if(pd_func()->messages_.isEmpty())
{ {
return false; return false;
} }
const MessagePtr &q = d_func()->messages_.head(); const MessagePtr &q = pd_func()->messages_.head();
return q->leftSize == 0; return q->leftSize == 0;
} }
void Queue::consume(ConsumeOptions options) void Queue::consume(ConsumeOptions options)
{ {
d_func()->consume(options); pd_func()->consume(options);
} }
void Queue::setConsumerTag( const QString &consumerTag ) void Queue::setConsumerTag( const QString &consumerTag )
{ {
d_func()->consumerTag = consumerTag; pd_func()->consumerTag = consumerTag;
} }
QString Queue::consumerTag() const QString Queue::consumerTag() const
{ {
return d_func()->consumerTag; return pd_func()->consumerTag;
} }
void Queue::get() void Queue::get()
{ {
d_func()->get(); pd_func()->get();
} }
void Queue::ack( const MessagePtr & message ) void Queue::ack( const MessagePtr & message )
{ {
d_func()->ack(message); pd_func()->ack(message);
} }
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
QueuePrivate::QueuePrivate() QueuePrivate::QueuePrivate(Queue * q)
:ChannelPrivate() :ChannelPrivate(q)
, deleyedDeclare(false) , deleyedDeclare(false)
, declared(false) , declared(false)
, recievingMessage(false) , recievingMessage(false)
@ -236,7 +236,7 @@ bool QueuePrivate::_q_method( const QAMQP::Frame::Method & frame )
getOk(frame); getOk(frame);
break; break;
case bmGetEmpty: case bmGetEmpty:
QMetaObject::invokeMethod(q_func(), "empty"); QMetaObject::invokeMethod(pq_func(), "empty");
break; break;
default: default:
break; break;
@ -263,7 +263,7 @@ void QueuePrivate::declareOk( const QAMQP::Frame::Method & frame )
stream >> messageCount >> consumerCount; stream >> messageCount >> consumerCount;
qDebug("Message count %d\nConsumer count: %d", messageCount, consumerCount); qDebug("Message count %d\nConsumer count: %d", messageCount, consumerCount);
QMetaObject::invokeMethod(q_func(), "declared"); QMetaObject::invokeMethod(pq_func(), "declared");
} }
void QueuePrivate::deleteOk( const QAMQP::Frame::Method & frame ) void QueuePrivate::deleteOk( const QAMQP::Frame::Method & frame )
@ -276,20 +276,20 @@ void QueuePrivate::deleteOk( const QAMQP::Frame::Method & frame )
qint32 messageCount = 0; qint32 messageCount = 0;
stream >> messageCount; stream >> messageCount;
qDebug("Message count %d", messageCount); qDebug("Message count %d", messageCount);
QMetaObject::invokeMethod(q_func(), "removed"); QMetaObject::invokeMethod(pq_func(), "removed");
} }
void QueuePrivate::bindOk( const QAMQP::Frame::Method & ) void QueuePrivate::bindOk( const QAMQP::Frame::Method & )
{ {
qDebug() << "Binded to queue: " << name; qDebug() << "Binded to queue: " << name;
QMetaObject::invokeMethod(q_func(), "binded", Q_ARG(bool, true)); QMetaObject::invokeMethod(pq_func(), "binded", Q_ARG(bool, true));
} }
void QueuePrivate::unbindOk( const QAMQP::Frame::Method & ) void QueuePrivate::unbindOk( const QAMQP::Frame::Method & )
{ {
qDebug() << "Unbinded queue: " << name; qDebug() << "Unbinded queue: " << name;
QMetaObject::invokeMethod(q_func(), "binded", Q_ARG(bool, false)); QMetaObject::invokeMethod(pq_func(), "binded", Q_ARG(bool, false));
} }
void QueuePrivate::declare() void QueuePrivate::declare()
@ -562,6 +562,6 @@ void QueuePrivate::_q_body( int channeNumber, const QByteArray & body )
if(message->leftSize == 0 && messages_.size() == 1) if(message->leftSize == 0 && messages_.size() == 1)
{ {
QMetaObject::invokeMethod(q_func(), "messageRecieved"); QMetaObject::invokeMethod(pq_func(), "messageRecieved");
} }
} }

View File

@ -19,7 +19,7 @@ namespace QAMQP
Q_PROPERTY(QString consumerTag READ consumerTag WRITE setConsumerTag) Q_PROPERTY(QString consumerTag READ consumerTag WRITE setConsumerTag)
Q_PROPERTY(bool noAck READ noAck WRITE setNoAck) Q_PROPERTY(bool noAck READ noAck WRITE setNoAck)
Q_DECLARE_PRIVATE(QAMQP::Queue) P_DECLARE_PRIVATE(QAMQP::Queue)
Q_DISABLE_COPY(Queue); Q_DISABLE_COPY(Queue);
friend class ClientPrivate; friend class ClientPrivate;
@ -81,8 +81,8 @@ namespace QAMQP
void empty(); void empty();
private: private:
Q_PRIVATE_SLOT(d_func(), void _q_content(const QAMQP::Frame::Content & frame)) Q_PRIVATE_SLOT(pd_func(), void _q_content(const QAMQP::Frame::Content & frame))
Q_PRIVATE_SLOT(d_func(), void _q_body(int channeNumber, const QByteArray & body)) Q_PRIVATE_SLOT(pd_func(), void _q_body(int channeNumber, const QByteArray & body))
}; };
} }
#ifdef QAMQP_P_INCLUDE #ifdef QAMQP_P_INCLUDE

View File

@ -10,7 +10,7 @@ namespace QAMQP
using namespace QAMQP::Frame; using namespace QAMQP::Frame;
class QueuePrivate: public ChannelPrivate class QueuePrivate: public ChannelPrivate
{ {
Q_DECLARE_PUBLIC(QAMQP::Queue) P_DECLARE_PUBLIC(QAMQP::Queue)
public: public:
enum MethodId enum MethodId
@ -22,7 +22,7 @@ namespace QAMQP
METHOD_ID_ENUM(miDelete, 40) METHOD_ID_ENUM(miDelete, 40)
}; };
QueuePrivate(); QueuePrivate(Queue * q);
~QueuePrivate(); ~QueuePrivate();
void declare(); void declare();

View File

@ -1,18 +0,0 @@
#ifndef qamqp_global_h__
#define qamqp_global_h__
#include <QtCore/qglobal.h>
#define QAMQP_P_INCLUDE
#define AMQPSCHEME "amqp"
#define AMQPPORT 5672
#define AMQPHOST "localhost"
#define AMQPVHOST "/"
#define AMQPLOGIN "guest"
#define AMQPPSWD "guest"
#define FRAME_MAX 131072
#define AMQP_CONNECTION_FORCED 320
#endif // qamqp_global_h__