[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [akonadi/dev/binary-protocol] src/private: Start moving Protocol details to PIMPL
From: Dan_Vrátil <dvratil () redhat ! com>
Date: 2015-05-29 17:39:19
Message-ID: E1YyOFb-0000Az-Q3 () scm ! kde ! org
[Download RAW message or body]
Git commit 922042e195ad244efca1eb1f68be0bc56e7bd00e by Dan Vrátil.
Committed on 29/05/2015 at 17:39.
Pushed by dvratil into branch 'dev/binary-protocol'.
Start moving Protocol details to PIMPL
Turns out there will be more copying of the serializer classes than I expected,
so we need to use PIMPL and QSharedDataPointers
M +1346 -188 src/private/protocol.cpp
M +285 -793 src/private/protocol_p.h
http://commits.kde.org/akonadi/922042e195ad244efca1eb1f68be0bc56e7bd00e
diff --git a/src/private/protocol.cpp b/src/private/protocol.cpp
index 5433215..0a05b07 100644
--- a/src/private/protocol.cpp
+++ b/src/private/protocol.cpp
@@ -25,8 +25,41 @@
#include <QGlobalStatic>
#include <QHash>
-using namespace Akonadi;
-using namespace Akonadi::Protocol;
+
+// Generic code for effective streaming of enums
+template<typename T>
+typename std::enable_if<std::is_enum<T>::value, QDataStream>::type
+&operator<<(QDataStream &stream, T val)
+{
+ return stream << static_cast<typename std::underlying_type<T>::type>(val);
+}
+
+template<typename T>
+typename std::enable_if<std::is_enum<T>::value, QDataStream>::type
+&operator>>(QDataStream &stream, T &val)
+{
+ typename std::underlying_type<T>::type tmp;
+ stream >> tmp;
+ val = static_cast<T>(tmp);
+ return stream;
+}
+
+template<typename T>
+typename std::enable_if<std::is_enum<T>::value, QDataStream>::type
+&operator>>(QDataStream &stream, QFlags<T> &flags)
+{
+ typename std::underlying_type<T>::type t;
+ stream >> t;
+ flags = QFlags<T>(t);
+ return stream;
+}
+
+
+namespace Akonadi
+{
+namespace Protocol
+{
+
class FactoryPrivate
{
@@ -110,263 +143,1419 @@ private:
Q_GLOBAL_STATIC(FactoryPrivate, sFactoryPrivate)
-Command Factory::command(Command::Type type)
+Command Factory::command(Command::Type type)
+{
+ auto iter = sFactoryPrivate->registrar.constFind(type);
+ if (iter == sFactoryPrivate->registrar.constEnd()) {
+ Q_ASSERT_X(iter != sFactoryPrivate->registrar.constEnd(),
+ "Aknadi::Protocol::Factory::command()", "Invalid command");
+ }
+ return iter.value().first();
+}
+
+Response Factory::response(Command::Type type)
+{
+ auto iter = sFactoryPrivate->registrar.constFind(type);
+ if (iter == sFactoryPrivate->registrar.constEnd()) {
+ Q_ASSERT_X(iter != sFactoryPrivate->registrar.constEnd(),
+ "Akonadi::Protocol::Factory::response()", "Invalid response");
+ }
+ return iter.value().second();
+}
+
+
+
+
+/******************************************************************************/
+
+
+
+class CommandPrivate : public QSharedData
+{
+public:
+ CommandPrivate(Command::Type type)
+ : commandType(type)
+ {}
+
+
+ Command::Type commandType;
+};
+
+Command::Command(CommandPrivate *dd)
+ : d_ptr(dd)
+{
+}
+
+Command& Command::Command(Command &&other)
+{
+ d_ptr.swap(other.d_ptr);
+ return *this;
+}
+
+Command& Command::Command(const Command &other)
+{
+ d_ptr = other.d_ptr;
+ return *this;
+}
+
+Command::~Command()
+{
+}
+
+Command& Command::operator=(Command &&other)
+{
+ d_ptr.swap(other.d_ptr);
+ return *this;
+}
+
+Command& Command::operator=(const Command &other)
+{
+ d_ptr = other.d_ptr;
+ return *this;
+}
+
+Command::Type Command::type() const
+{
+ Q_D(Command);
+ return d->commandType;
+}
+
+bool Command::isValid() const
+{
+ Q_D(Command);
+ return d->commandType != Invalid;
+}
+
+QDataStream &operator<<(QDataStream &stream, Command::Type type)
+{
+ return stream << static_cast<typename \
std::underlying_type<Command::Type>::type>(type); +}
+
+QDataStream &operator>>(QDataStream &stream, Command::Type &type)
+{
+ typename std::underlying_type<Command::Type>::type tmp;
+ stream >> tmp;
+ type = static_cast<Command::Type>(tmp);
+ return stream;
+}
+
+QDataStream &operator<<(QDataStream &stream, const Command &command)
+{
+ return stream << command.d_func()->commandType;
+}
+
+QDataStream &operator>>(QDataStream &stream, Command &command)
+{
+ return stream >> command.d_func()->commandType;
+}
+
+
+
+/******************************************************************************/
+
+
+
+class FetchScopePrivate : public QSharedData
+{
+public:
+ FetchScopePrivate()
+ : fetchFlags(FetchScope::None)
+ {}
+
+ QVector<QByteArray> requestedParts;
+ QStringList requestedPayloads;
+ QDateTime changedSince;
+ QVector<QByteArray> tagFetchScope;
+ int ancestorDepth;
+ FetchScope::FetchFlags fetchFlags;
+};
+
+FetchScope::FetchScope()
+ : d(new FetchScopePrivate)
+{
+}
+
+FetchScope::FetchScope(FetchScope &&other)
+{
+ d.swap(other.d);
+}
+
+FetchScope::FetchScope(const FetchScope &other)
+{
+ d = other.d;
+}
+
+FetchScope::~FetchScope()
+{
+}
+
+FetchScope &FetchScope::operator=(FetchScope &&other)
+{
+ d.swap(other.d);
+ return *this;
+}
+
+FetchScope &FetchScope::operator=(const FetchScope &other)
+{
+ d = other.d;
+ return *this;
+}
+
+void FetchScope::setRequestedParts(const QVector<QByteArray> &requestedParts)
+{
+ d->requestedParts = requestedParts;
+}
+
+QVector<QByteArray> FetchScope::requestedParts() const
+{
+ return d->requestedParts;
+}
+
+void FetchScope::setRequestedPayloads(const QStringList &requestedPayloads)
+{
+ d->requestedPayloads = requestedPayloads;
+}
+
+QStringList FetchScope::requestedPayloads() const
+{
+ return d->requestedPayloads;
+}
+
+void FetchScope::setChangedSince(const QDateTime &changedSince)
+{
+ d->changedSince = changedSince;
+}
+
+QDateTime FetchScope::changedSince() const
+{
+ return d->changedSince;
+}
+
+void FetchScope::setTagFetchScope(const QVector<QByteArray> &tagFetchScope)
+{
+ d->tagFetchScope = tagFetchScope;
+}
+
+QVector<QByteArray> FetchScope::tagFetchScope() const
+{
+ return d->tagFetchScope;
+}
+
+void FetchScope::setAncestorDepth(int depth)
+{
+ d->ancestorDepth = depth;
+}
+
+int FetchScope::ancestorDepth() const
+{
+ return d->ancestorDepth;
+}
+
+bool FetchScope::cacheOnly() const
+{
+ return d->fetchFlags & CacheOnly;
+}
+
+bool FetchScope::checkCachedPayloadPartsOnly() const
+{
+ return d->fetchFlags & CheckCachedPayloadPartsOnly;
+}
+bool FetchScope::fullPayload() const
+{
+ return d->fetchFlags & FullPayload;
+}
+bool FetchScope::allAttributes() const
+{
+ return d->fetchFlags & AllAttributes;
+}
+bool FetchScope::fetchSize() const
+{
+ return d->fetchFlags & Size;
+}
+bool FetchScope::fetchMTime() const
+{
+ return d->fetchFlags & MTime;
+}
+bool FetchScope::fetchRemoteRevision() const
+{
+ return d->fetchFlags & RemoteRevision;
+}
+bool FetchScope::ignoreErrors() const
+{
+ return d->fetchFlags & IgnoreErrors;
+}
+bool FetchScope::fetchFlags() const
+{
+ return d->fetchFlags & Flags;
+}
+bool FetchScope::fetchRemoteId() const
+{
+ return d->fetchFlags & RemoteID;
+}
+bool FetchScope::fetchGID() const
+{
+ return d->fetchFlags & GID;
+}
+bool FetchScope::fetchTags() const
+{
+ return d->fetchFlags & Tags;
+}
+bool FetchScope::fetchRelations() const
+{
+ return d->fetchFlags & Relations;
+}
+bool FetchScope::fetchVirtualReferences() const
+{
+ return d->fetchFlags & VirtReferences;
+}
+
+void FetchScope::setFetch(FetchFlags attributes, bool fetch)
+{
+ if (fetch) {
+ d->fetchFlags |= attributes;
+ } else {
+ d->fetchFlags &= ~attributes;
+ }
+}
+
+bool FetchScope::fetch(FetchFlags flags)
+{
+ return d->fetchFlags & flags;
+}
+
+QDataStream &operator<<(QDataStream &stream, const FetchScope &scope)
+{
+ return stream << scope.d->requestedParts
+ << scope.d->requestedPayloads
+ << scope.d->changedSince
+ << scope.d->tagFetchScope
+ << scope.d->ancestorDepth
+ << scope.d->fetchFlags;
+}
+
+QDataStream &operator>>(QDataStream &stream, FetchScope &scope)
+{
+ return stream >> scope.d->requestedParts
+ >> scope.d->requestedPayloads
+ >> scope.d->changedSince
+ >> scope.d->tagFetchScope
+ >> scope.d->ancestorDepth
+ >> scope.d->fetchFlags;
+}
+
+
+
+/******************************************************************************/
+
+
+
+
+class PartMetaDataPrivate : public QSharedData
+{
+public:
+ PartMetaDataPrivate()
+ : size(0)
+ , version(0)
+ {}
+
+ QByteArray name;
+ qint64 size;
+ int version;
+};
+
+PartMetaData::PartMetaData()
+ : d(new PartMetaDataPrivate)
+{
+}
+
+PartMetaData::PartMetaData(PartMetaData &&other)
+{
+ d.swap(other.d);
+}
+
+PartMetaData::PartMetaData(const PartMetaData &other)
+{
+ d = other.d;
+}
+
+PartMetaData::~PartMetaData()
+{
+}
+
+PartMetaData &PartMetaData::operator=(PartMetaData &&other)
+{
+ d.swap(other.d);
+ return *this;
+}
+
+PartMetaData &PartMetaData::operator=(const PartMetaData &other)
+{
+ d = other.d;
+ return *this;
+}
+
+bool PartMetaData::operator<(const PartMetaData &other)
+{
+ return d->name < other.d->name;
+}
+
+void PartMetaData::setName(const QByteArray &name)
+{
+ d->name = name;
+}
+QByteArray PartMetaData::name() const
+{
+ return d->name;
+}
+
+void PartMetaData::setSize(qint64 size)
+{
+ d->size = size;
+}
+qint64 PartMetaData::size() const
+{
+ return d->size;
+}
+
+void PartMetaData::setVersion(int version)
+{
+ d->version = version;
+}
+int PartMetaData::version() const
+{
+ return d->version;
+}
+
+QDataStream &operator<<(QDataStream &stream, const PartMetaData &part)
+{
+ return stream << part.d->name
+ << part.d->size
+ << part.d->version;
+}
+
+QDataStream &operator>>(QDataStream &stream, PartMetaData &part)
+{
+ return stream >> part.d->name
+ >> part.d->size
+ >> part.d->version;
+}
+
+
+
+/******************************************************************************/
+
+
+
+
+class CachePolicyPrivate : public QSharedData
+{
+public:
+ CachePolicyPrivate()
+ : interval(-1)
+ , cacheTimeout(-1)
+ , syncOnDemand(false)
+ , inherit(true)
+ {}
+
+ QStringList localParts;
+ int interval;
+ int cacheTimeout;
+ bool syncOnDemand;
+ bool inherit;
+};
+
+CachePolicy::CachePolicy()
+ : d(new CachePolicyPrivate)
+{
+}
+
+CachePolicy::CachePolicy(CachePolicy &&other)
+{
+ d.swap(other.d);
+}
+
+CachePolicy::CachePolicy(const CachePolicy &other)
+{
+ d = other.d;
+}
+
+CachePolicy &CachePolicy::operator=(CachePolicy &&other)
+{
+ d.swap(other.d);
+ return *this;
+}
+
+CachePolicy &CachePolicy::operator=(const CachePolicy &other)
+{
+ d = other.d;
+ return *this;
+}
+
+void CachePolicy::setInherit(bool inherit)
+{
+ d->inherit = inherit;
+}
+bool CachePolicy::inherit() const
+{
+ return d->inherit;
+}
+
+void CachePolicy::setCheckInterval(int interval)
+{
+ d->interval = interval;
+}
+int CachePolicy::checkInterval() const
+{
+ return d->interval;
+}
+
+void CachePolicy::setCacheTimeout(int timeout)
+{
+ d->cacheTimeout = timeout;
+}
+int CachePolicy::cacheTimeout() const
+{
+ return d->cacheTimeout;
+}
+
+void CachePolicy::setSyncOnDemand(bool onDemand)
+{
+ d->syncOnDemand = onDemand;
+}
+bool CachePolicy::syncOnDemand() const
+{
+ return d->syncOnDemand;
+}
+
+void CachePolicy::setLocalParts(const QStringList &localParts)
+{
+ d->localParts = localParts;
+}
+QStringList CachePolicy::localParts() const
+{
+ return d->localParts;
+}
+
+
+QDataStream &operator<<(QDataStream &stream, const CachePolicy &policy)
+{
+ return stream << policy.d->inherit
+ << policy.d->interval
+ << policy.d->cacheTimeout
+ << policy.d->syncOnDemand
+ << policy.d->localParts;
+}
+
+QDataStream &operator>>(QDataStream &stream, CachePolicy &policy)
+{
+ return stream >> policy.d->inherit
+ >> policy.d->interval
+ >> policy.d->cacheTimeout
+ >> policy.d->syncOnDemand
+ >> policy.d->localParts;
+}
+
+
+
+/******************************************************************************/
+
+
+
+
+class AncestorPrivate : public QSharedData
+{
+public:
+ AncestorPrivate()
+ : id(-1)
+ {}
+ AncestorPrivate(qint64 id)
+ : id(id)
+ {}
+
+ qint64 id;
+ QString remoteId;
+ QMap<QByteArrayDataPtr, QByteArray> attrs;
+};
+
+Ancestor::Ancestor()
+ : d(new AncestorPrivate)
+{
+}
+
+Ancestor::Ancestor(qint64 id)
+ : d(new AncestorPrivate(id)
+{
+}
+
+Ancestor::Ancestor(Ancestor &&other)
+{
+ d.swap(other.d);
+}
+
+Ancestor::Ancestor(const Ancestor &other)
+{
+ d = other.d;
+}
+
+Ancestor::~Ancestor()
+{
+}
+
+Ancestor &Ancestor::operator=(Ancestor &&other)
+{
+ d.swap(other.d);
+ return *this;
+}
+
+Ancestor &Ancestor::operator=(const Ancestor &other)
+{
+ d = other.d;
+ return *this;
+}
+
+void Ancestor::setId(qint64 id)
+{
+ d->id = id;
+}
+qint64 Ancestor::id() const
+{
+ return d->id;
+}
+
+void Ancestor::setRemoteId(const QString &remoteId)
+{
+ d->remoteId = remoteId;
+}
+QString Ancestor::remoteId() const
+{
+ return d->remoteId;
+}
+
+void Ancestor::setAttributes(const QMap<QByteArray, QByteArray> &attributes)
+{
+ d->attrs = attributes;
+}
+QMap<QByteArray, QByteArray> Ancestor::attributes() const
+{
+ return d->attrs;
+}
+
+
+QDataStream &operator<<(QDataStream &stream, const Ancestor &ancestor)
+{
+ return stream << ancestor.d->id
+ << ancestor.d->remoteId
+ << ancestor.d->attrs;
+}
+
+QDataStream &operator>>(QDataStream &stream, Ancestor &ancestor)
+{
+ return stream >> ancestor.d->id
+ >> ancestor.d->remoteId
+ >> ancestor.d->attrs;
+}
+
+
+
+
+/******************************************************************************/
+
+
+
+
+
+class ResponsePrivate : public CommandPrivate
+{
+public:
+ ResponsePrivate(Command::Type type)
+ : CommandPrivate(type)
+ , errorCode(0)
+ {
+ }
+
+ QString errorMsg;
+ int errorCode;
+};
+
+Response::Response(ResponsePrivate *dd)
+ : Command(dd)
+{
+}
+
+void Response::setError(int code, const QString &message)
+{
+ Q_D(Response);
+ d->errorCode = code;
+ d->errorMsg = message;
+}
+
+bool Response::isError() const
+{
+ return d_func()->errorCode;
+}
+
+int Response::errorCode() const
+{
+ return d_func()->errorCode;
+}
+
+QString Response::errorMessage() const
+{
+ return d_func()->errorMsg;
+}
+
+QDataStream &operator<<(QDataStream &stream, const Response &command)
+{
+ return stream << command.d_func()->errorCode
+ << command.d_func()->errorMsg;
+}
+
+QDataStream &operator>>(QDataStream &stream, Response &command)
+{
+ return stream >> command.d_func()->errorCode
+ >> command.d_func()->errorMsg;
+}
+
+
+
+
+/******************************************************************************/
+
+
+
+
+
+class HelloResponsePrivate : public ResponsePrivate
+{
+public:
+ HelloResponsePrivate()
+ : ResponsePrivate(Command::Hello)
+ , protocol(0)
+ {}
+ HelloResponsePrivate(const QString &server, const QString &message, int \
protocol) + : ResponsePrivate(Command::Hello)
+ , server(server)
+ , message(message)
+ , protocol(protocol)
+ {}
+
+ QString server;
+ QString message;
+ int protocol;
+};
+
+HelloResponse::HelloResponse(const QString &server, const QString &message, int \
protocol) + : Response(new HelloResponsePrivate(server, message, protocol))
+{
+}
+
+HelloResponse::HelloResponse()
+ : Response(new HelloResponsePrivate)
+{
+}
+
+HelloResponse::~HelloResponse()
+{
+}
+
+QString HelloResponse::serverName() const
+{
+ return d_func()->server;
+}
+
+QString HelloResponse::message() const
+{
+ return d_func()->message;
+}
+
+int HelloResponse::protocolVersion() const
+{
+ return d_func()->protocol;
+}
+
+QDataStream &operator<<(QDataStream &stream, const HelloResponse &command)
+{
+ return stream << command.d_func()->server
+ << command.d_func()->message
+ << command.d_func()->protocol;
+}
+
+QDataStream &operator>>(QDataStream &stream, HelloResponse &command)
+{
+ return stream >> command.d_func()->server
+ >> command.d_func()->message
+ >> command.d_func()->protocol;
+}
+
+
+
+
+/******************************************************************************/
+
+
+
+
+class LoginCommandPrivate : public CommandPrivate
+{
+public:
+ LoginCommandPrivate()
+ : CommandPrivate(Command::Login)
+ {}
+ LoginCommandPrivate(const QByteArray &sessionId)
+ : CommandPrivate(Command::Login)
+ , sessionId(sessionId)
+ {}
+
+ QByteArray sessionId;
+};
+
+LoginCommand::LoginCommand()
+ : Command(new LoginCommandPrivate)
+{
+}
+
+LoginCommand::LoginCommand(const QByteArray &sessionId)
+ : Command(new LoginCommandPrivate(sessionId))
+{
+}
+
+QByteArray LoginCommand::sessionId() const
+{
+ return d_func()->sessionId;
+}
+
+QDataStream &operator<<(QDataStream &stream, const LoginCommand &command)
+{
+ return stream << command.d_func()->sessionId;
+}
+
+QDataStream &operator>>(QDataStream &stream, LoginCommand &command)
+{
+ return stream >> command.d_func()->sessionId;
+}
+
+
+
+
+/******************************************************************************/
+
+
+
+
+LoginResponse::LoginResponse()
+ : Response(new ResponsePrivate(Command::Login))
+{
+}
+
+
+
+
+/******************************************************************************/
+
+
+
+
+LogoutCommand::LogoutCommand()
+ : Command(new CommandPrivate(Command::Logout))
+{
+}
+
+
+
+/******************************************************************************/
+
+
+
+LogoutResponse::LogoutResponse()
+ : Response(new ResponsePrivate(Command::Logout))
+{
+}
+
+
+
+
+/******************************************************************************/
+
+class TransactionCommandPrivate : public CommandPrivate
+{
+ TransactionCommandPrivate(TransactionCommand::Mode mode = \
TransactionCommand::Invalid) + : CommandPrivate(Command::Transaction)
+ , mode(mode)
+ {}
+
+ TransactionCommand::Mode mode;
+};
+
+TransactionCommand::TransactionCommand()
+ : Command(new TransactionCommandPrivate)
+{
+}
+
+TransactionCommand::TransactionCommand(TransactionCommand::Mode mode)
+ : Command(new TransactionCommandPrivate(mode)
+{
+}
+
+TransactionCommand::Mode TransactionCommand::mode() const
+{
+ return d_func()->mode;
+}
+
+QDataStream &operator<<(QDataStream &stream, const TransactionCommand &command)
+{
+ return stream << command.d_func()->mode;
+}
+
+QDataStream &operator>>(QDataStream &stream, TransactionCommand &command)
+{
+ return stream >> command.d_func()->mode;
+}
+
+
+
+/******************************************************************************/
+
+
+
+
+TransactionResponse::TransactionResponse()
+ : Response(new ResponsePrivate(Command::Transaction))
+{
+}
+
+
+
+/******************************************************************************/
+
+
+
+
+
+class CreateItemCommandPrivate : public CommandPrivate
+{
+public:
+ CreateItemCommandPrivate()
+ : CommandPrivate(Command::CreateItem)
+ , mergeMode(CreateItemCommand::None)
+ , itemSize(0)
+ {}
+
+ Scope collection;
+ QString mimeType;
+ QString gid;
+ QString remoteId;
+ QString remoteRev;
+ QDateTime dateTime;
+ Scope tags;
+ Scope addedTags;
+ Scope removedTags;
+ QVector<QByteArray> flags;
+ QVector<QByteArray> addedFlags;
+ QVector<QByteArray> removedFlags;
+ QVector<QByteArray> removedParts;
+ QVector<PartMetaData> parts;
+ CreateItemCommand::MergeModes mergeMode;
+ qint64 itemSize;
+};
+
+CreateItemCommand::CreateItemCommand()
+ : Command(new CreateItemCommandPrivate)
+{
+}
+
+void CreateItemCommand::setMergeMode(MergeModes mode)
+{
+ d_func()->mergeMode = mode;
+}
+CreateItemCommand::MergeModes CreateItemCommand::mergeModes() const
+{
+ return d_func()->mergeMode;
+}
+
+void CreateItemCommand::setCollection(const Scope &collection)
+{
+ d_func()->collection = collection;
+}
+Scope CreateItemCommand::collection() const
+{
+ return d_func()->collection;
+}
+
+void CreateItemCommand::setItemSize(qint64 size)
+{
+ d_func()->itemSize = size;
+}
+qint64 CreateItemCommand::itemSize() const
+{
+ return d_func()->itemSize;
+}
+
+void CreateItemCommand::setMimeType(const QString &mimeType)
{
- auto iter = sFactoryPrivate->registrar.constFind(type);
- if (iter == sFactoryPrivate->registrar.constEnd()) {
- Q_ASSERT_X(iter != sFactoryPrivate->registrar.constEnd(),
- "Aknadi::Protocol::Factory::command()", "Invalid command");
- }
- return iter.value().first();
+ d_func()->mimeType = mimeType;
+}
+QString CreateItemCommand::mimeType() const
+{
+ return d_func()->mimeType;
}
-Response Factory::response(Command::Type type)
+void CreateItemCommand::setGID(const QString &gid)
{
- auto iter = sFactoryPrivate->registrar.constFind(type);
- if (iter == sFactoryPrivate->registrar.constEnd()) {
- Q_ASSERT_X(iter != sFactoryPrivate->registrar.constEnd(),
- "Akonadi::Protocol::Factory::response()", "Invalid response");
- }
- return iter.value().second();
+ d_func()->gid = gid;
+}
+QString CreateItemCommand::gid() const
+{
+ return d_func()->gid;
}
+void CreateItemCommand::setRemoteId(const QString &remoteId)
+{
+ d_func()->remoteId = remoteId;
+}
+QString CreateItemCommand::remoteId() const
+{
+ return d_func()->remoteId;
+}
+void CreateItemCommand::setRemoteRevision(const QString &remoteRevision)
+{
+ d_func()->remoteRev = remoteRevision;
+}
-// Generic code for effective streaming of enums
-template<typename T>
-typename std::enable_if<std::is_enum<T>::value, QDataStream>::type
-&operator<<(QDataStream &stream, T val)
+QString CreateItemCommand::remoteRevision() const
{
- return stream << static_cast<typename std::underlying_type<T>::type>(val);
+ return d_func()->remoteRev;
}
-template<typename T>
-typename std::enable_if<std::is_enum<T>::value, QDataStream>::type
-&operator>>(QDataStream &stream, T &val)
+void CreateItemCommand::setDateTime(const QDateTime &dateTime)
{
- typename std::underlying_type<T>::type tmp;
- stream >> tmp;
- val = static_cast<T>(tmp);
- return stream;
+ d_func()->dateTime = dateTime;
+}
+QDateTime CreateItemCommand::dateTime() const
+{
+ return d_func()->dateTime;
}
-template<typename T>
-typename std::enable_if<std::is_enum<T>::value, QDataStream>::type
-&operator>>(QDataStream &stream, QFlags<T> &flags)
+void CreateItemCommand::setFlags(const QVector<QByteArray> &flags)
{
- typename std::underlying_type<T>::type t;
- stream >> t;
- flags = QFlags<T>(t);
- return stream;
+ d_func()->flags = flags;
+}
+QVector<QByteArray> CreateItemCommand::flags() const
+{
+ return d_func()->flags;
+}
+void CreateItemCommand::setAddedFlags(const QVector<QByteArray> &flags)
+{
+ d_func()->addedFlags = flags;
+}
+QVector<QByteArray> CreateItemCommand::addedFlags() const
+{
+ return d_func()->addedFlags;
+}
+void CreateItemCommand::setRemovedFlags(const QVector<QByteArray> &flags)
+{
+ d_func()->removedFlags = flags;
+}
+QVector<QByteArray> CreateItemCommand::removedFlags() const
+{
+ return d_func()->removedFlags;
}
-QDataStream &operator<<(QDataStream &stream, Command::Type type)
+void CreateItemCommand::setTags(const Scope &tags)
{
- return stream << static_cast<typename \
std::underlying_type<Command::Type>::type>(type); + d_func()->tags = tags;
+}
+Scope CreateItemCommand::tags() const
+{
+ return d_func()->tags;
+}
+void CreateItemCommand::setAddedTags(const Scope &tags)
+{
+ d_func()->addedTags = tags;
+}
+Scope CreateItemCommand::addedTags() const
+{
+ return d_func()->addedTags;
+}
+void CreateItemCommand::setRemovedTags(const Scope &tags)
+{
+ d_func()->removedTags = tags;
+}
+Scope CreateItemCommand::removedTags() const
+{
+ return d_func()->removedTags;
}
-QDataStream &operator>>(QDataStream &stream, Command::Type &type)
+void CreateItemCommand::setRemovedParts(const QVector<QByteArray> &removedParts)
{
- typename std::underlying_type<Command::Type>::type tmp;
- stream >> tmp;
- type = static_cast<Command::Type>(tmp);
- return stream;
+ d_func()->removedParts = removedParts;
+}
+QVector<QByteArray> CreateItemCommand::removedParts() const
+{
+ return d_func()->removedParts;
+}
+void CreateItemCommand::setParts(const QVector<PartMetaData> &parts)
+{
+ d_func()->parts = parts;
+}
+QVector<PartMetaData> CreateItemCommand::parts() const
+{
+ return d_func()->parts;
}
-QDataStream &operator<<(QDataStream &stream, const FetchScope &scope)
+QDataStream &operator<<(QDataStream &stream, const CreateItemCommand &command)
{
- return stream << scope.mRequestedParts
- << scope.mRequestedPayloads
- << scope.mChangedSince
- << scope.mTagFetchScope
- << scope.mAncestorDepth
- << scope.mFetchFlags;
+ return stream << command.d_func()->mergeMode
+ << command.d_func()->collection
+ << command.d_func()->itemSize
+ << command.d_func()->mimeType
+ << command.d_func()->gid
+ << command.d_func()->remoteId
+ << command.d_func()->remoteRev
+ << command.d_func()->dateTime
+ << command.d_func()->flags
+ << command.d_func()->addedFlags
+ << command.d_func()->removedFlags
+ << command.d_func()->tags
+ << command.d_func()->addedTags
+ << command.d_func()->removedTags
+ << command.d_func()->removedParts
+ << command.d_func()->parts;
}
-QDataStream &operator>>(QDataStream &stream, FetchScope &scope)
+QDataStream &operator>>(QDataStream &stream, CreateItemCommand &command)
{
- return stream >> scope.mRequestedParts
- >> scope.mRequestedPayloads
- >> scope.mChangedSince
- >> scope.mTagFetchScope
- >> scope.mAncestorDepth
- >> scope.mFetchFlags;
+ return stream >> command.d_func()->mergeMode
+ >> command.d_func()->collection
+ >> command.d_func()->itemSize
+ >> command.d_func()->mimeType
+ >> command.d_func()->gid
+ >> command.d_func()->remoteId
+ >> command.d_func()->remoteRev
+ >> command.d_func()->dateTime
+ >> command.d_func()->flags
+ >> command.d_func()->addedFlags
+ >> command.d_func()->removedFlags
+ >> command.d_func()->tags
+ >> command.d_func()->addedTags
+ >> command.d_func()->removedTags
+ >> command.d_func()->removedParts
+ >> command.d_func()->parts;
}
-QDataStream &operator<<(QDataStream &stream, const PartMetaData &part)
+
+
+/******************************************************************************/
+
+
+
+
+CreateItemResponse::CreateItemResponse()
+ : Response(new ResponsePrivate(Command::CreateItem))
{
- return stream << part.mName
- << part.mSize
- << part.mVersion;
}
-QDataStream &operator>>(QDataStream &stream, PartMetaData &part)
+
+
+
+/******************************************************************************/
+
+
+
+
+class CopyItemsCommandPrivate : public CommandPrivate
{
- return stream >> part.mName
- >> part.mSize
- >> part.mVersion;
-}
+public:
+ CopyItemsCommandPrivate()
+ : CommandPrivate(Command::CopyItems)
+ {}
+ CopyItemsCommandPrivate(const Scope &items, const Scope &dest)
+ : CommandPrivate(Command::CopyItems)
+ , items(items)
+ , dest(dest)
+ {}
+
+ Scope items;
+ Scope dest;
+};
+CopyItemsCommand::CopyItemsCommand()
+ : Command(new CopyItemsCommandPrivate)
+{
+}
-QDataStream &operator<<(QDataStream &stream, const CachePolicy &policy)
+CopyItemsCommand::CopyItemsCommand(const Scope &items, const Scope &dest)
+ : Command(new CopyItemsCommandPrivate(items, dest))
{
- return stream << policy.mInherit
- << policy.mInterval
- << policy.mCacheTimeout
- << policy.mSyncOnDemand
- << policy.mLocalParts;
}
-QDataStream &operator>>(QDataStream &stream, CachePolicy &policy)
+Scope CopyItemsCommand::items() const
{
- return stream >> policy.mInherit
- >> policy.mInterval
- >> policy.mCacheTimeout
- >> policy.mSyncOnDemand
- >> policy.mLocalParts;
+ return d_func()->items;
}
-QDataStream &operator<<(QDataStream &stream, const Ancestor &ancestor)
+Scope CopyItemsCommand::destination() const
{
- return stream << ancestor.mId
- << ancestor.mRemoteId
- << ancestor.mAttributes;
+ return d_func()->dest;
}
-QDataStream &operator>>(QDataStream &stream, Ancestor &ancestor)
+QDataStream &operator<<(QDataStream &stream, const CopyItemsCommand &command)
{
- return stream >> ancestor.mId
- >> ancestor.mRemoteId
- >> ancestor.mAttributes;
+ return stream << command.d_func()->items
+ << command.d_func()->dest;
}
-QDataStream &operator<<(QDataStream &stream, const Command &command)
+QDataStream &operator>>(QDataStream &stream, CopyItemsCommand &command)
{
- return stream << command.mCommandType;
+ return stream >> command.d_func()->items
+ >> command.d_func()->dest;
}
-QDataStream &operator>>(QDataStream &stream, Command &command)
+
+
+
+/******************************************************************************/
+
+
+
+
+CopyItemsResponse::CopyItemsResponse()
+ : Response(new ResponsePrivate(Command::CopyItems))
{
- return stream >> command.mCommandType;
}
-QDataStream &operator<<(QDataStream &stream, const Response &command)
+
+/******************************************************************************/
+
+
+
+
+class DeleteItemsCommandPrivate : public CommandPrivate
+{
+public:
+ DeleteItemsCommandPrivate()
+ : CommandPrivate(Command::DeleteItems)
+ {}
+ DeleteItemsCommandPrivate(const Scope &items)
+ : CommandPrivate(Command::DeleteItems)
+ , items(items)
+ {}
+
+ Scope items;
+};
+
+DeleteItemsCommand::DeleteItemsCommand()
+ : Command(new DeleteItemsCommandPrivate)
{
- return stream << command.mErrorCode
- << command.mErrorMsg;
}
-QDataStream &operator>>(QDataStream &stream, Response &command)
+DeleteItemsCommand::DeleteItemsCommand(const Scope &items)
+ : Command(new DeleteItemsCommandPrivate(items))
{
- return stream >> command.mErrorCode
- >> command.mErrorMsg;
}
+Scope DeleteItemsCommand::items() const
+{
+ return d_func()->items;
+}
-QDataStream &operator<<(QDataStream &stream, const HelloResponse &command)
+QDataStream &operator<<(QDataStream &stream, const DeleteItemsCommand &command)
{
- return stream << command.mServer
- << command.mMessage
- << command.mVersion;
+ return stream << command.d_func()->items;
}
-QDataStream &operator>>(QDataStream &stream, HelloResponse &command)
+QDataStream &operator>>(QDataStream &stream, DeleteItemsCommand &command)
{
- return stream >> command.mServer
- >> command.mMessage
- >> command.mVersion;
+ return stream >> command.d_func()->items;
}
-QDataStream &operator<<(QDataStream &stream, const LoginCommand &command)
+
+
+/******************************************************************************/
+
+
+
+
+DeleteItemsResponse::DeleteItemsResponse()
+ : Response(new ResponsePrivate(Command::DeleteItems))
{
- return stream << command.mSession;
}
-QDataStream &operator>>(QDataStream &stream, LoginCommand &command)
+
+
+
+/******************************************************************************/
+
+
+
+
+
+class FetchRelationsCommandPrivate : public CommandPrivate
+{
+public:
+ FetchRelationsCommandPrivate()
+ : CommandPrivate(Command::FetchRelations)
+ , left(-1)
+ , right(-1)
+ , side(-1)
+ {}
+
+ qint64 left;
+ qint64 right;
+ qint64 side;
+ QString type;
+ QString resource;
+};
+
+FetchRelationsCommand::FetchRelationsCommand()
+ : Command(new FetchRelationsCommandPrivate)
{
- return stream >> command.mSession;
}
+void FetchRelationsCommand::setLeft(qint64 left)
+{
+ d_func()->left = left;
+}
+qint64 FetchRelationsCommand::left() const
+{
+ return d_func()->left;
+}
-QDataStream &operator<<(QDataStream &stream, const TransactionCommand &command)
+void FetchRelationsCommand::setRight(qint64 right)
{
- return stream << command.mMode;
+ d_func()->right = right;
+}
+qint64 FetchRelationsCommand::right() const
+{
+ return d_func()->right;
}
-QDataStream &operator>>(QDataStream &stream, TransactionCommand &command)
+void FetchRelationsCommand::setSide(qint64 side)
+{
+ d_func()->side = side;
+}
+qint64 FetchRelationsCommand::side() const
{
- return stream >> command.mMode;
+ return d_func()->side;
}
+void FetchRelationsCommand::setType(const QString &type)
+{
+ d_func()->type = type;
+}
+QString FetchRelationsCommand::type() const
+{
+ return d_func()->type;
+}
-QDataStream &operator<<(QDataStream &stream, const CreateItemCommand &command)
+void FetchRelationsCommand::setResource(const QString &resource)
{
- return stream << command.mMergeMode
- << command.mCollection
- << command.mItemSize
- << command.mMimeType
- << command.mGid
- << command.mRemoteId
- << command.mRemoteRev
- << command.mDateTime
- << command.mFlags
- << command.mAddedFlags
- << command.mRemovedFlags
- << command.mTags
- << command.mAddedTags
- << command.mRemovedTags
- << command.mRemovedParts
- << command.mParts;
+ d_func()->resource = resource;
+}
+QString FetchRelationsCommand::resource() const
+{
+ return d_func()->resource;
}
-QDataStream &operator>>(QDataStream &stream, CreateItemCommand &command)
+QDataStream &operator<<(QDataStream &stream, const FetchRelationsCommand &command)
{
- return stream >> command.mMergeMode
- >> command.mCollection
- >> command.mItemSize
- >> command.mMimeType
- >> command.mGid
- >> command.mRemoteId
- >> command.mRemoteRev
- >> command.mDateTime
- >> command.mFlags
- >> command.mAddedFlags
- >> command.mRemovedFlags
- >> command.mTags
- >> command.mAddedTags
- >> command.mRemovedTags
- >> command.mRemovedParts
- >> command.mParts;
+ return stream << command.d_func()->left
+ << command.d_func()->right
+ << command.d_func()->side
+ << command.d_func()->type
+ << command.d_func()->resource;
+}
+
+QDataStream &operator>>(QDataStream &stream, FetchRelationsCommand &command)
+{
+ return stream >> command.d_func()->left
+ >> command.d_func()->right
+ >> command.d_func()->side
+ >> command.d_func()->type
+ >> command.d_func()->resource;
}
-QDataStream &operator<<(QDataStream &stream, const CopyItemsCommand &command)
+
+
+/*****************************************************************************/
+
+
+
+
+class FetchRelationsResponsePrivate : public ResponsePrivate
+{
+public:
+ FetchRelationsResponsePrivate(qint64 left = -1, qint64 right = -1, const QString \
&type = QString()) + : ResponsePrivate(Command::FetchRelations)
+ , left(left)
+ , right(right)
+ , type(type)
+ {}
+
+ qint64 left;
+ qint64 right;
+ QString type;
+ QString remoteId;
+};
+
+FetchRelationsResponse::FetchRelationsResponse()
+ : Response(new FetchRelationsResponsePrivate)
{
- return stream << command.mScope
- << command.mDest;
}
-QDataStream &operator>>(QDataStream &stream, CopyItemsCommand &command)
+FetchRelationsResponse::FetchRelationsResponse(qint64 left, qint64 right, const \
QString &type) + : Response(new FetchRelationsResponsePrivate(left, right, type))
{
- return stream >> command.mScope
- >> command.mDest;
}
+qint64 FetchRelationsResponse::left() const
+{
+ return d_func()->left;
+}
+qint64 FetchRelationsResponse::right() const
+{
+ return d_func()->right;
+}
+QString FetchRelationsResponse::type() const
+{
+ return d_func()->type;
+}
+void FetchRelationsResponse::setRemoteId(const QString &remoteId)
+{
+ d_func()->remoteId = remoteId;
+}
+QString FetchRelationsResponse::remoteId() const
+{
+ return d_func()->remoteId;
+}
-QDataStream &operator<<(QDataStream &stream, const DeleteItemsCommand &command)
+QDataStream &operator<<(QDataStream &stream, const FetchRelationsResponse &command)
{
- return stream << command.mScope;
+ return stream << command.d_func()->left
+ << command.d_func()->right
+ << command.d_func()->type
+ << command.d_func()->remoteId;
}
-QDataStream &operator>>(QDataStream &stream, DeleteItemsCommand &command)
+QDataStream &operator>>(QDataStream &stream, FetchRelationsResponse &command)
{
- return stream >> command.mScope;
+ return stream >> command.d_func()->left
+ >> command.d_func()->right
+ >> command.d_func()->type
+ >> command.d_func()->remoteId;
}
+
+
+/******************************************************************************/
+
+
+
QDataStream &operator<<(QDataStream &stream, const FetchItemsCommand &command)
{
return stream << command.mScope
@@ -1006,41 +2195,9 @@ QDataStream &operator>>(QDataStream &stream, ModifyTagCommand \
&command) }
-QDataStream &operator<<(QDataStream &stream, const FetchRelationsCommand &command)
-{
- return stream << command.mLeft
- << command.mRight
- << command.mSide
- << command.mType
- << command.mResource;
-}
-
-QDataStream &operator>>(QDataStream &stream, FetchRelationsCommand &command)
-{
- return stream >> command.mLeft
- >> command.mRight
- >> command.mSide
- >> command.mType
- >> command.mResource;
-}
-
-QDataStream &operator<<(QDataStream &stream, const FetchRelationsResponse &command)
-{
- return stream << command.mLeft
- << command.mRight
- << command.mType
- << command.mRemoteId;
-}
-QDataStream &operator>>(QDataStream &stream, FetchRelationsResponse &command)
-{
- return stream >> command.mLeft
- >> command.mRight
- >> command.mType
- >> command.mRemoteId;
-}
QDataStream &operator<<(QDataStream &stream, const ModifyRelationCommand &command)
@@ -1113,4 +2270,5 @@ QDataStream &operator>>(QDataStream &stream, \
StreamPayloadResponse &command) >> command.mData;
}
-
+} // namespace Protocol
+} // namespace Akonadi
\ No newline at end of file
diff --git a/src/private/protocol_p.h b/src/private/protocol_p.h
index 1609370..1c7c58a 100644
--- a/src/private/protocol_p.h
+++ b/src/private/protocol_p.h
@@ -104,173 +104,6 @@ class QDataStream;
#define AKONADI_CMD_X_AKLIST "X-AKLIST"
#define AKONADI_CMD_X_AKLSUB "X-AKLSUB"
-namespace Akonadi
-{
-namespace Protocol
-{
-class FetchScope;
-class PartMetaData;
-class CachePolicy;
-class Ancestor;
-
-class Command;
-class Response;
-class HelloResponse;
-class LoginCommand;
-class LoginResponse;
-class TransactionCommand;
-class TransactionResponse;
-class CreateItemCommand;
-class CreateItemResponse;
-class CopyItemsCommand;
-class CopyItemsResponse;
-class DeleteItemsCommand;
-class DeleteItemsResponse;
-class FetchRelationsCommand;
-class FetchRelationsResponse;
-class FetchTagsCommand;
-class FetchTagsResponse;
-class FetchItemsCommand;
-class FetchItemsResponse;
-class LinkItemsCommand;
-class LinkItemsResponse;
-class ModifyItemsCommand;
-class ModifyItemsResponse;
-class MoveItemsCommand;
-class MoveItemsResponse;
-class CreateCollectionCommand;
-class CreateCollectionResponse;
-class CopyCollectionCommand;
-class CopyCollectionResponse;
-class DeleteCollectionCommand;
-class DeleteCollectionResponse;
-class FetchCollectionStatsCommand;
-class FetchCollectionStatsResponse;
-class FetchCollectionsCommand;
-class FetchCollectionsResponse;
-class ModifyCollectionCommand;
-class ModifyCollectionResponse;
-class MoveCollectionCommand;
-class MoveCollectionResponse;
-class SelectCollectionCommand;
-class SelectCollectionResponse;
-class SearchCommand;
-class SearchResponse;
-class SearchResultCommand;
-class SearchResultResponse;
-class StoreSearchCommand;
-class StoreSearchResponse;
-class CreateTagCommand;
-class CreateTagResponse;
-class DeleteTagCommand;
-class DeleteTagResponse;
-class ModifyTagCommand;
-class ModifyTagResponse;
-class ModifyRelationCommand;
-class ModifyRelationResponse;
-class RemoveRelationsCommand;
-class RemoveRelationsResponse;
-class SelectResourceCommand;
-class SelectResourceResponse;
-class StreamPayloadCommand;
-class StreamPayloadResponse;
-}
-}
-QDataStream &operator<<(QDataStream &stream, const Akonadi::Protocol::FetchScope \
&scope);
-QDataStream &operator>>(QDataStream &stream, Akonadi::Protocol::FetchScope &scope);
-QDataStream &operator<<(QDataStream &stream, const Akonadi::Protocol::PartMetaData \
&part);
-QDataStream &operator>>(QDataStream &stream, Akonadi::Protocol::PartMetaData &part);
-QDataStream &operator<<(QDataStream &stream, const Akonadi::Protocol::CachePolicy \
&policy);
-QDataStream &operator>>(QDataStream &stream, Akonadi::Protocol::CachePolicy \
&policy);
-QDataStream &operator<<(QDataStream &stream, const Akonadi::Protocol::Ancestor \
&ancestor);
-QDataStream &operator>>(QDataStream &stream, Akonadi::Protocol::Ancestor &ancestor);
-
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::FetchScope &scope);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::FetchScope &scope);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::PartMetaData &part);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::PartMetaData &part);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::CachePolicy &policy);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::CachePolicy &policy);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::Ancestor &ancestor);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::Ancestor &ancestor);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::Command &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::Command &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::Response &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::Response &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::HelloResponse &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::HelloResponse &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::LoginCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::LoginCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::TransactionCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::TransactionCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::CreateItemCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::CreateItemCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::CopyItemsCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::CopyItemsCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::DeleteItemsCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::DeleteItemsCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::FetchRelationsCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::FetchRelationsCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::FetchRelationsResponse &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::FetchRelationsResponse &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::FetchTagsCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::FetchTagsCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::FetchTagsResponse &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::FetchTagsResponse &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::FetchItemsCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::FetchItemsCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::FetchItemsResponse &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::FetchItemsResponse &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::LinkItemsCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::LinkItemsCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::ModifyItemsCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::ModifyItemsCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::ModifyItemsResponse &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::ModifyItemsResponse &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::MoveItemsCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::MoveItemsCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::CreateCollectionCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::CreateCollectionCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::CopyCollectionCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::CopyCollectionCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::DeleteCollectionCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::DeleteCollectionCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::FetchCollectionStatsCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::FetchCollectionStatsCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::FetchCollectionStatsResponse &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::FetchCollectionStatsResponse &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::FetchCollectionsCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::FetchCollectionsCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::FetchCollectionsResponse &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::FetchCollectionsResponse &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::ModifyCollectionCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::ModifyCollectionCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::MoveCollectionCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::MoveCollectionCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::SelectCollectionCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::SelectCollectionCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::SearchCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::SearchCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::SearchResultCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::SearchResultCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::StoreSearchCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::StoreSearchCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::CreateTagCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::CreateTagCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::DeleteTagCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::DeleteTagCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::ModifyTagCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::ModifyTagCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::ModifyRelationCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::ModifyRelationCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::RemoveRelationsCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::RemoveRelationsCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::SelectResourceCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::SelectResourceCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::StreamPayloadCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::StreamPayloadCommand &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::StreamPayloadResponse &command);
-AKONADIPRIVATE_EXPORT QDataStream &operator>>(QDataStream &stream, \
Akonadi::Protocol::StreamPayloadResponse &command);
namespace Akonadi
{
@@ -278,6 +111,8 @@ namespace Akonadi
namespace Protocol
{
+
+class CommandPrivate;
class AKONADIPRIVATE_EXPORT Command
{
public:
@@ -334,31 +169,33 @@ public:
StreamPayload = 100
};
- virtual ~Command()
- {}
+ Command(Command &&other);
+ Command(const Command &other);
- Type type() const
- {
- return mCommandType;
- }
+ Command& operator=(Command &&other);
+ Command& operator=(const Command &other);
- bool isValid() const
- {
- return mCommandType != Invalid;
- }
+ virtual ~Command();
+
+ Type type() const;
+ bool isValid() const;
protected:
- Command(Type type)
- : mCommandType(type)
- {}
+ Command(CommandPrivate *dd);
+
+ QSharedDataPointer<CommandPrivate> d_ptr;
+ Q_DECLARE_PRIVATE(Command)
private:
- friend QDataStream &::operator<<(QDataStream &stream, const \
Akonadi::Protocol::Command &command);
- friend QDataStream &::operator>>(QDataStream &stream, Akonadi::Protocol::Command \
&command); + friend QDataStream &operator<<(QDataStream &stream, const \
Akonadi::Protocol::Command &command); + friend QDataStream &operator>>(QDataStream \
&stream, Akonadi::Protocol::Command &command);
- Type mCommandType;
};
+
+
+
+
class AKONADIPRIVATE_EXPORT Factory
{
public:
@@ -368,6 +205,8 @@ public:
+
+class FetchScopePrivate;
class AKONADIPRIVATE_EXPORT FetchScope
{
public:
@@ -390,291 +229,152 @@ public:
};
Q_DECLARE_FLAGS(FetchFlags, FetchFlag)
- FetchScope()
- : mFetchFlags(None)
- {}
+ explicit FetchScope();
+ FetchScope(FetchScope &&other);
+ FetchScope(const FetchScope &other);
+ ~FetchScope();
- void setRequestedParts(const QVector<QByteArray> &requestedParts)
- {
- mRequestedParts = requestedParts;
- }
- QVector<QByteArray> requestedParts() const
- {
- return mRequestedParts;
- }
- void setRequestedPayloads(const QStringList &requestedPayloads)
- {
- mRequestedPayloads = requestedPayloads;
- }
- QStringList requestedPayloads() const
- {
- return mRequestedPayloads;
- }
- void setChangedSince(const QDateTime &changedSince)
- {
- mChangedSince = changedSince;
- }
- QDateTime changedSince() const
- {
- return mChangedSince;
- }
- void setTagFetchScope(const QVector<QByteArray> &tagFetchScope)
- {
- mTagFetchScope = tagFetchScope;
- }
- QVector<QByteArray> tagFetchScope() const
- {
- return mTagFetchScope;
- }
- void setAncestorDepth(int depth)
- {
- mAncestorDepth = depth;
- }
- int ancestorDepth() const
- {
- return mAncestorDepth;
- }
+ FetchScope &operator=(FetchScope &&other);
+ FetchScope &operator=(const FetchScope &other);
- bool cacheOnly() const
- {
- return mFetchFlags & CacheOnly;
- }
- bool checkCachedPayloadPartsOnly() const
- {
- return mFetchFlags & CheckCachedPayloadPartsOnly;
- }
- bool fullPayload() const
- {
- return mFetchFlags & FullPayload;
- }
- bool allAttributes() const
- {
- return mFetchFlags & AllAttributes;
- }
- bool fetchSize() const
- {
- return mFetchFlags & Size;
- }
- bool fetchMTime() const
- {
- return mFetchFlags & MTime;
- }
- bool fetchRemoteRevision() const
- {
- return mFetchFlags & RemoteRevision;
- }
- bool ignoreErrors() const
- {
- return mFetchFlags & IgnoreErrors;
- }
- bool fetchFlags() const
- {
- return mFetchFlags & Flags;
- }
- bool fetchRemoteId() const
- {
- return mFetchFlags & RemoteID;
- }
- bool fetchGID() const
- {
- return mFetchFlags & GID;
- }
- bool fetchTags() const
- {
- return mFetchFlags & Tags;
- }
- bool fetchRelations() const
- {
- return mFetchFlags & Relations;
- }
- bool fetchVirtualReferences() const
- {
- return mFetchFlags & VirtReferences;
- }
+ void setRequestedParts(const QVector<QByteArray> &requestedParts);
+ QVector<QByteArray> requestedParts() const;
- void setFetch(FetchFlags attributes, bool fetch = true)
- {
- if (fetch) {
- mFetchFlags |= attributes;
- } else {
- mFetchFlags &= ~attributes;
- }
- }
+ void setRequestedPayloads(const QStringList &requestedPayloads);
+ QStringList requestedPayloads() const;
- bool fetch(FetchFlag flag) const
- {
- return mFetchFlags & flag;
- }
+ void setChangedSince(const QDateTime &changedSince);
+ QDateTime changedSince() const;
+
+ void setTagFetchScope(const QVector<QByteArray> &tagFetchScope);
+ QVector<QByteArray> tagFetchScope() const;
+
+ void setAncestorDepth(int depth);
+ int ancestorDepth() const;
+
+ bool cacheOnly() const;
+ bool checkCachedPayloadPartsOnly() const;
+ bool fullPayload() const;
+ bool allAttributes() const;
+ bool fetchSize() const;
+ bool fetchMTime() const;
+ bool fetchRemoteRevision() const;
+ bool ignoreErrors() const;
+ bool fetchFlags() const;
+ bool fetchRemoteId() const;
+ bool fetchGID() const;
+ bool fetchTags() const;
+ bool fetchRelations() const;
+ bool fetchVirtualReferences() const;
+
+ void setFetch(FetchFlags attributes, bool fetch = true);
+ bool fetch(FetchFlags flags) const;
private:
- QVector<QByteArray> mRequestedParts;
- QStringList mRequestedPayloads;
- QDateTime mChangedSince;
- QVector<QByteArray> mTagFetchScope;
- int mAncestorDepth;
- FetchFlags mFetchFlags;
+ QSharedDataPointer<FetchScopePrivate> d;
friend QDataStream &::operator<<(QDataStream &stream, const \
Akonadi::Protocol::FetchScope &scope);
friend QDataStream &::operator>>(QDataStream &stream, \
Akonadi::Protocol::FetchScope &scope); };
+
+
+
+class PartMetaDataPrivate;
class AKONADIPRIVATE_EXPORT PartMetaData
{
public:
- PartMetaData()
- : mSize(0)
- , mVersion(0)
- {}
+ explicit PartMetaData();
+ PartMetaData(PartMetaData &&other);
+ PartMetaData(const PartMetaData &other);
+ ~PartMetaData();
- void setName(const QByteArray &name)
- {
- mName = name;
- }
- QByteArray name() const
- {
- return mName;
- }
+ PartMetaData &operator=(PartMetaData &&other);
+ PartMetaData &operator=(const PartMetaData &other);
- void setSize(qint64 size)
- {
- mSize = size;
- }
- qint64 size() const
- {
- return mSize;
- }
+ bool operator<(const PartMetaData &other) const;
- void setVersion(int version)
- {
- mVersion = version;
- }
- int version() const
- {
- return mVersion;
- }
+ void setName(const QByteArray &name);
+ QByteArray name() const;
+
+ void setSize(qint64 size);
+ qint64 size() const;
+
+ void setVersion(int version);
+ int version() const;
- bool operator<(const PartMetaData &other) const
- {
- return mName < other.mName;
- }
private:
- QByteArray mName;
- qint64 mSize;
- int mVersion;
+ QSharedDataPointer<PartMetaDataPrivate> d;
friend QDataStream &::operator<<(QDataStream &stream, const \
Akonadi::Protocol::PartMetaData &part);
friend QDataStream &::operator>>(QDataStream &stream, \
Akonadi::Protocol::PartMetaData &part); };
+
+
+
+class CachePolicyPrivate;
class AKONADIPRIVATE_EXPORT CachePolicy
{
public:
- CachePolicy()
- : mInterval(-1)
- , mCacheTimeout(-1)
- , mSyncOnDemand(false)
- , mInherit(true)
- {}
+ explicit CachePolicy();
+ CachePolicy(CachePolicy &&other);
+ CachePolicy(const CachePolicy &other);
+ ~CachePolicy();
- void setInherit(bool inherit)
- {
- mInherit = inherit;
- }
- bool inherit() const
- {
- return mInherit;
- }
+ CachePolicy &operator=(CachePolicy &&other);
+ CachePolicy &operator=(const CachePolicy &other);
- void setCheckInterval(int interval)
- {
- mInterval = interval;
- }
- int checkInterval() const
- {
- return mInterval;
- }
+ void setInherit(bool inherit);
+ bool inherit() const;
- void setCacheTimeout(int timeout)
- {
- mCacheTimeout = timeout;
- }
- int cacheTimeout() const
- {
- return mCacheTimeout;
- }
+ void setCheckInterval(int interval);
+ int checkInterval() const;
- void setSyncOnDemand(bool onDemand)
- {
- mSyncOnDemand = onDemand;
- }
- bool syncOnDemand() const
- {
- return mSyncOnDemand;
- }
+ void setCacheTimeout(int timeout);
+ int cacheTimeout() const;
- void setLocalParts(const QStringList &parts)
- {
- mLocalParts = parts;
- }
- QStringList localParts() const
- {
- return mLocalParts;
- }
+ void setSyncOnDemand(bool onDemand);
+ bool syncOnDemand() const;
+
+ void setLocalParts(const QStringList &parts);
+ QStringList localParts() const;
private:
- QStringList mLocalParts;
- int mInterval;
- int mCacheTimeout;
- bool mSyncOnDemand;
- bool mInherit;
+ QSharedDataPointer<CachePolicyPrivate> d;
friend QDataStream &::operator<<(QDataStream &stream, const \
Akonadi::Protocol::CachePolicy &policy);
friend QDataStream &::operator>>(QDataStream &stream, \
Akonadi::Protocol::CachePolicy &policy); };
+
+
+
+
+class AncestorPrivate;
class AKONADIPRIVATE_EXPORT Ancestor
{
public:
- Ancestor()
- : mId(-1)
- {}
+ explicit Ancestor();
+ explicit Ancestor(qint64 id);
+ Ancestor(Ancestor &&other);
+ Ancestor(const Ancestor &other);
+ ~Ancestor();
- Ancestor(qint64 id)
- : mId(id)
- {
- }
+ Ancestor &operator=(Ancestor &&other);
+ Ancestor &operator=(const Ancestor &other);
- void setId(qint64 id)
- {
- mId = id;
- }
- qint64 id() const
- {
- return mId;
- }
+ void setId(qint64 id);
+ qint64 id() const;
- void setRemoteId(const QString &remoteId)
- {
- mRemoteId = remoteId;
- }
- QString remoteId() const
- {
- return mRemoteId;
- }
+ void setRemoteId(const QString &remoteId);
+ QString remoteId() const;
- void setAttributes(const QMap<QByteArray, QByteArray> &attrs)
- {
- mAttributes = attrs;
- }
- QMap<QByteArray, QByteArray> attributes() const
- {
- return mAttributes;
- }
+ void setAttributes(const QMap<QByteArray, QByteArray> &attrs);
+ QMap<QByteArray, QByteArray> attributes() const;
private:
- qint64 mId;
- QString mRemoteId;
- QMap<QByteArray, QByteArray> mAttributes;
+ QSharedDataPointer<AncestorPrivate> d;
friend QDataStream &::operator<<(QDataStream &stream, const \
Akonadi::Protocol::Ancestor &ancestor);
friend QDataStream &::operator>>(QDataStream &stream, \
Akonadi::Protocol::Ancestor &ancestor); @@ -682,127 +382,103 @@ private:
+
+
class AKONADIPRIVATE_EXPORT Response : public Command
{
public:
- void setError(int code, const QString &message)
- {
- mErrorCode = code;
- mErrorMsg = message;
- }
+ virtual ~Response() Q_DECL_OVERRIDE;
- bool isError() const
- {
- return mErrorCode;
- }
- int errorCode() const
- {
- return mErrorCode;
- }
- QString errorMessage() const
- {
- return mErrorMsg;
- }
+ void setError(int code, const QString &message);
+ bool isError() const;
+
+ int errorCode() const;
+ QString errorMessage() const;
protected:
- Response(Command::Type type)
- : Command(type)
- , mErrorCode(0)
- {
- }
+ explicit Response(ResponsePrivate *dd);
+
private:
+ Q_DECLARE_PRIVATE(Response)
+
friend QDataStream &::operator<<(QDataStream &stream, const \
Akonadi::Protocol::Response &command);
friend QDataStream &::operator>>(QDataStream &stream, \
Akonadi::Protocol::Response &command);
-
- int mErrorCode;
- QString mErrorMsg;
};
+
+
+
+
class AKONADIPRIVATE_EXPORT HelloResponse : public Response
{
public:
- HelloResponse(const QString &server, const QString &message, int protocol)
- : Response(Hello)
- , mServer(server)
- , mMessage(message)
- , mVersion(protocol)
- {}
+ explicit HelloResponse();
+ HelloResponse(const QString &server, const QString &message, int protocol);
- HelloResponse()
- : Response(Hello)
- , mVersion(0)
- {}
-
- QString serverName() const
- {
- return mServer;
- }
- QString message() const
- {
- return mMessage;
- }
- int protocolVersion() const
- {
- return mVersion;
- }
+ QString serverName() const;
+ QString message() const;
+ int protocolVersion() const;
private:
+ Q_DECLARE_PRIVATE(HelloResponse);
+
friend QDataStream &::operator<<(QDataStream &stream, const \
Akonadi::Protocol::HelloResponse &command);
friend QDataStream &::operator>>(QDataStream &stream, \
Akonadi::Protocol::HelloResponse &command);
-
- QString mServer;
- QString mMessage;
- int mVersion;
};
+
+
+
+
class AKONADIPRIVATE_EXPORT LoginCommand : public Command
{
public:
- LoginCommand(const QByteArray &sessionId)
- : Command(Login)
- , mSession(sessionId)
- {}
- LoginCommand()
- : Command(Login)
- {}
+ explicit LoginCommand();
+ explicit LoginCommand(const QByteArray &sessionId);
- QByteArray sessionId() const
- {
- return mSession;
- }
+ QByteArray sessionId() const;
private:
+ Q_DECLARE_PRIVATE(LoginCommand)
+
friend QDataStream &::operator<<(QDataStream &stream, const \
Akonadi::Protocol::LoginCommand &command);
friend QDataStream &::operator>>(QDataStream &stream, \
Akonadi::Protocol::LoginCommand &command);
-
- QByteArray mSession;
};
+
+
+
+
class AKONADIPRIVATE_EXPORT LoginResponse : public Response
{
public:
- LoginResponse()
- : Response(Login)
- {}
+ explicit LoginResponse();
};
+
+
+
class AKONADIPRIVATE_EXPORT LogoutCommand : public Command
{
public:
- LogoutCommand()
- : Command(Logout)
- {}
+ explicit LogoutCommand();
};
+
+
+
+
class AKONADIPRIVATE_EXPORT LogoutResponse : public Response
{
public:
- LogoutResponse()
- : Response(Logout)
- {}
+ explicit LogoutResponse();
};
+
+
+
+
class AKONADIPRIVATE_EXPORT TransactionCommand : public Command
{
public:
@@ -813,36 +489,32 @@ public:
Rollback
};
- TransactionCommand()
- : Command(Transaction)
- , mMode(Invalid)
- {}
-
- TransactionCommand(Mode mode)
- : Command(Transaction)
- , mMode(mode)
- {}
+ explicit TransactionCommand();
+ explicit TransactionCommand(Mode mode);
- Mode mode() const
- {
- return mMode;
- }
+ Mode mode() const;
private:
+ Q_DECLARE_PRIVATE(TransactionCommand);
+
friend QDataStream &::operator<<(QDataStream &stream, const \
Akonadi::Protocol::TransactionCommand &command);
friend QDataStream &::operator>>(QDataStream &stream, \
Akonadi::Protocol::TransactionCommand &command);
-
- Mode mMode;
};
+
+
+
+
class AKONADIPRIVATE_EXPORT TransactionResponse : public Response
{
public:
- TransactionResponse()
- : Response(Transaction)
- {}
+ explicit TransactionResponse();
};
+
+
+
+class CreateItemCommandPrivate;
class AKONADIPRIVATE_EXPORT CreateItemCommand : public Command
{
public:
@@ -854,359 +526,179 @@ public:
};
Q_DECLARE_FLAGS(MergeModes, MergeMode);
- CreateItemCommand()
- : Command(CreateItem)
- , mMergeMode(None)
- , mItemSize(-1)
- {}
+ explicit CreateItemCommand();
- void setMergeMode(const MergeModes &mode)
- {
- mMergeMode = mode;
- }
- MergeModes mergeMode() const
- {
- return mMergeMode;
- }
+ void setMergeMode(const MergeModes &mode);
+ MergeModes mergeMode() const;
- void setCollection(const Scope &collection)
- {
- mCollection = collection;
- }
- Scope collection() const
- {
- return mCollection;
- }
+ void setCollection(const Scope &collection);
+ Scope collection() const;
- void setItemSize(qint64 size)
- {
- mItemSize = size;
- }
- qint64 itemSize() const
- {
- return mItemSize;
- }
+ void setItemSize(qint64 size);
+ qint64 itemSize() const;
- void setMimeType(const QString &mimeType)
- {
- mMimeType = mimeType;
- }
- QString mimeType() const
- {
- return mMimeType;
- }
+ void setMimeType(const QString &mimeType);
+ QString mimeType() const;
- void setGID(const QString &gid)
- {
- mGid = gid;
- }
- QString gid() const
- {
- return mGid;
- }
+ void setGID(const QString &gid);
+ QString gid() const;
- void setRemoteId(const QString &remoteId)
- {
- mRemoteId = remoteId;
- }
- QString remoteId() const
- {
- return mRemoteId;
- }
+ void setRemoteId(const QString &remoteId);
+ QString remoteId() const;
- void setRemoteRevision(const QString &remoteRevision)
- {
- mRemoteRev = remoteRevision;
- }
+ void setRemoteRevision(const QString &remoteRevision);
+ QString remoteRevision() const;
- QString remoteRevision() const
- {
- return mRemoteRev;
- }
+ void setDateTime(const QDateTime &dateTime);
+ QDateTime dateTime() const;
- void setDateTime(const QDateTime &dateTime)
- {
- mDateTime = dateTime;
- }
- QDateTime dateTime() const
- {
- return mDateTime;
- }
+ void setFlags(const QVector<QByteArray> &flags);
+ QVector<QByteArray> flags() const;
+ void setAddedFlags(const QVector<QByteArray> &flags);
+ QVector<QByteArray> addedFlags() const;
+ void setRemovedFlags(const QVector<QByteArray> &flags);
+ QVector<QByteArray> removedFlags() const;
- void setFlags(const QVector<QByteArray> &flags)
- {
- mFlags = flags;
- }
- QVector<QByteArray> flags() const
- {
- return mFlags;
- }
- void setAddedFlags(const QVector<QByteArray> &flags)
- {
- mAddedFlags = flags;
- }
- QVector<QByteArray> addedFlags() const
- {
- return mAddedFlags;
- }
- void setRemovedFlags(const QVector<QByteArray> &flags)
- {
- mRemovedFlags = flags;
- }
- QVector<QByteArray> removedFlags() const
- {
- return mRemovedFlags;
- }
+ void setTags(const Scope &tags);
+ Scope tags() const;
+ void setAddedTags(const Scope &tags);
+ Scope addedTags() const;
+ void setRemovedTags(const Scope &tags);
+ Scope removedTags() const;
- void setTags(const Scope &tags)
- {
- mTags = tags;
- }
- Scope tags() const
- {
- return mTags;
- }
- void setAddedTags(const Scope &tags)
- {
- mAddedTags = tags;
- }
- Scope addedTags() const
- {
- return mAddedTags;
- }
- void setRemovedTags(const Scope &tags)
- {
- mRemovedTags = tags;
- }
- Scope removedTags() const
- {
- return mRemovedTags;
- }
- void setRemovedParts(const QVector<QByteArray> &removedParts)
- {
- mRemovedParts = removedParts;
- }
- QVector<QByteArray> removedParts() const
- {
- return mRemovedParts;
- }
- void setParts(const QVector<PartMetaData> &parts)
- {
- mParts = parts;
- }
- QVector<PartMetaData> parts() const
- {
- return mParts;
- }
+ void setRemovedParts(const QVector<QByteArray> &removedParts);
+ QVector<QByteArray> removedParts() const;
+ void setParts(const QVector<PartMetaData> &parts);
+ QVector<PartMetaData> parts() const;
private:
+ Q_DECLARE_PRIVATE(CreateItemCommand)
+
friend QDataStream &::operator<<(QDataStream &stream, const \
Akonadi::Protocol::CreateItemCommand &command);
friend QDataStream &::operator>>(QDataStream &stream, \
Akonadi::Protocol::CreateItemCommand &command);
-
- Scope mCollection;
- QString mMimeType;
- QString mGid;
- QString mRemoteId;
- QString mRemoteRev;
- QDateTime mDateTime;
- Scope mTags;
- Scope mAddedTags;
- Scope mRemovedTags;
- QVector<QByteArray> mFlags;
- QVector<QByteArray> mAddedFlags;
- QVector<QByteArray> mRemovedFlags;
- QVector<QByteArray> mRemovedParts;
- QVector<PartMetaData> mParts;
- MergeModes mMergeMode;
- qint64 mItemSize;
};
+
+
+
class AKONADIPRIVATE_EXPORT CreateItemResponse : public Response
{
public:
- CreateItemResponse()
- : Response(CreateItem)
- {}
+ explicit CreateItemResponse();
};
+
+
+
class AKONADIPRIVATE_EXPORT CopyItemsCommand : public Command
{
public:
- CopyItemsCommand()
- : Command(CopyItems)
- {}
-
- CopyItemsCommand(const Scope &items, const Scope &destination)
- : Command(CopyItems)
- , mScope(items)
- , mDest(destination)
- {}
+ explicit CopyItemsCommand();
+ explicit CopyItemsCommand(const Scope &items, const Scope &destination);
- Scope items() const
- {
- return mScope;
- }
- Scope destination() const
- {
- return mDest;
- }
+ Scope items() const;
+ Scope destination() const;
private:
+ Q_DECLARE_PRIVATE(CopyItemsCommand)
+
friend QDataStream &::operator<<(QDataStream &stream, const \
Akonadi::Protocol::CopyItemsCommand &command);
friend QDataStream &::operator>>(QDataStream &stream, \
Akonadi::Protocol::CopyItemsCommand &command);
-
- Scope mScope;
- Scope mDest;
};
+
+
+
+
class AKONADIPRIVATE_EXPORT CopyItemsResponse : public Response
{
public:
- CopyItemsResponse()
- : Response(CopyItems)
- {}
+ explicit CopyItemsResponse();
};
+
+
+
+
class AKONADIPRIVATE_EXPORT DeleteItemsCommand : public Command
{
public:
- DeleteItemsCommand()
- : Command(DeleteItems)
- {}
+ explicit DeleteItemsCommand();
+ explicit DeleteItemsCommand(const Scope &scope);
- DeleteItemsCommand(const Scope &scope)
- : Command(DeleteItems)
- , mScope(scope)
- {}
-
- Scope scope() const
- {
- return mScope;
- }
+ Scope scope() const;
private:
+ Q_DECLARE_PRIVATE(DeleteItemsCommand);
+
friend QDataStream &::operator<<(QDataStream &stream, const \
Akonadi::Protocol::DeleteItemsCommand &command);
friend QDataStream &::operator>>(QDataStream &stream, \
Akonadi::Protocol::DeleteItemsCommand &command);
-
- Scope mScope;
};
+
+
+
+
class AKONADIPRIVATE_EXPORT DeleteItemsResponse : public Response
{
public:
- DeleteItemsResponse()
- : Response(DeleteItems)
- {}
+ explicit DeleteItemsResponse();
};
+
+
+
+
class AKONADIPRIVATE_EXPORT FetchRelationsCommand : public Command
{
public:
- FetchRelationsCommand()
- : Command(FetchRelations)
- , mLeft(-1)
- , mRight(-1)
- , mSide(-1)
- {}
+ explicit FetchRelationsCommand();
- void setLeft(qint64 left)
- {
- mLeft = left;
- }
- qint64 left() const
- {
- return mLeft;
- }
- void setRight(qint64 right)
- {
- mRight = right;
- }
- qint64 right() const
- {
- return mRight;
- }
- void setSide(qint64 side)
- {
- mSide = side;
- }
- qint64 side() const
- {
- return mSide;
- }
- void setType(const QString &type)
- {
- mType = type;
- }
- QString type() const
- {
- return mType;
- }
- void setResource(const QString &resource)
- {
- mResource = resource;
- }
- QString resource() const
- {
- return mResource;
- }
+ void setLeft(qint64 left);
+ qint64 left() const;
+
+ void setRight(qint64 right);
+ qint64 right() const;
+
+ void setSide(qint64 side);
+ qint64 side() const;
+
+ void setType(const QString &type);
+ QString type() const;
+
+ void setResource(const QString &resource);
+ QString resource() const;
private:
+ Q_DECLARE_PRIVATE(FetchRelationsCommand)
+
friend QDataStream &::operator<<(QDataStream &stream, const \
Akonadi::Protocol::FetchRelationsCommand &command);
friend QDataStream &::operator>>(QDataStream &stream, \
Akonadi::Protocol::FetchRelationsCommand &command);
-
- qint64 mLeft;
- qint64 mRight;
- qint64 mSide;
- QString mType;
- QString mResource;
};
+
+
+
+
class AKONADIPRIVATE_EXPORT FetchRelationsResponse : public Response
{
public:
- FetchRelationsResponse()
- : Response(FetchRelations)
- , mLeft(-1)
- , mRight(-1)
- {}
+ explicit FetchRelationsResponse();
+ explicit FetchRelationsResponse(qint64 left, qint64 right, const QString &type);
- FetchRelationsResponse(qint64 left, qint64 right, const QString &type)
- : Response(FetchRelations)
- , mLeft(left)
- , mRight(right)
- , mType(type)
- {}
+ qint64 left() const;
+ qint64 right() const;
+ QString type() const;
- qint64 left() const
- {
- return mLeft;
- }
- qint64 right() const
- {
- return mRight;
- }
- QString type() const
- {
- return mType;
- }
- void setRemoteId(const QString &remoteId)
- {
- mRemoteId = remoteId;
- }
- QString remoteId()
- {
- return mRemoteId;
- }
+ void setRemoteId(const QString &remoteId);
+ QString remoteId();
private:
+ Q_DECLARE_PRIVATE(FetchRelationsResponse)
+
friend QDataStream &::operator<<(QDataStream &stream, const \
Akonadi::Protocol::FetchRelationsResponse &command);
friend QDataStream &::operator>>(QDataStream &stream, \
Akonadi::Protocol::FetchRelationsResponse &command);
-
- qint64 mLeft;
- qint64 mRight;
- QString mType;
- QString mRemoteId;
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic