From 1a9f124d42d8363adf7e62c009d7f9a0d48832a8 Mon Sep 17 00:00:00 2001 From: Nathan Osman Date: Sat, 29 Jun 2013 12:04:01 -0700 Subject: [PATCH] Added private class for Client and created template for Command class. --- include/qredis/client.h | 29 ++++++++++++++++++++++++++++- include/qredis/command.h | 16 ++++++++++++++++ src/client.cpp | 12 +++++++++++- src/client_p.h | 16 ++++++++++++++++ 4 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 include/qredis/command.h create mode 100644 src/client_p.h diff --git a/include/qredis/client.h b/include/qredis/client.h index a0b49a0..f6296a2 100644 --- a/include/qredis/client.h +++ b/include/qredis/client.h @@ -2,20 +2,47 @@ #define QREDIS_CLIENT_H #include +#include +#include #include "qredis_export.h" namespace QRedis { + class QREDIS_EXPORT ClientPrivate; + + /** + * @brief Provides access to a Redis server. + */ class QREDIS_EXPORT Client : public QObject { Q_OBJECT public: + /** + * @brief Connects to a Redis server. + */ Client(); + + /** + * @brief Disconnects from the Redis server. + */ virtual ~Client(); + + void connectToHost(); + void disconnectFromHost(); + + Command * sendCommand(); + + signals: + + void connected(); + + private: + + const QScopedPointer d; }; } -#endif // QREDIS_CLIENT_H \ No newline at end of file +#endif // QREDIS_CLIENT_H diff --git a/include/qredis/command.h b/include/qredis/command.h new file mode 100644 index 0000000..e120a2c --- /dev/null +++ b/include/qredis/command.h @@ -0,0 +1,16 @@ +#ifndef QREDIS_COMMAND_H +#define QREDIS_COMMAND_H + +#include "qredis_export.h" + +namespace QRedis +{ + class QREDIS_EXPORT Command + { + public: + + //... + }; +} + +#endif // QREDIS_COMMAND_H diff --git a/src/client.cpp b/src/client.cpp index 88b2e8a..1bb96e1 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -1,11 +1,21 @@ #include +#include "client_p.h" using namespace QRedis; Client::Client() + : d(new ClientPrivate) { } Client::~Client() { -} \ No newline at end of file +} + +void Client::connectToHost() +{ +} + +void Client::disconnectFromHost() +{ +} diff --git a/src/client_p.h b/src/client_p.h new file mode 100644 index 0000000..712430a --- /dev/null +++ b/src/client_p.h @@ -0,0 +1,16 @@ +#ifndef QREDIS_CLIENT_P_H +#define QREDIS_CLIENT_P_H + +#include + +namespace QRedis +{ + class ClientPrivate + { + public: + + QTcpSocket socket; + }; +} + +#endif // QREDIS_CLIENT_H