From 44466b80de6107b406639f62620a05fa4d9b376a Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Mon, 30 Mar 2020 12:42:41 +0300 Subject: [PATCH] =?UTF-8?q?=D0=90=D0=B4=D0=B0=D0=BF=D1=82=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=B1=D0=B8=D0=B1=D0=BB=D0=B8=D0=BE=D1=82=D0=B5?= =?UTF-8?q?=D0=BA=D0=B8=20=D0=B4=D0=BB=D1=8F=20Redis?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/myx/redis/client.cpp | 8 +++++++- src/myx/redis/client.hpp | 21 ++++++++++++--------- src/myx/redis/client_p.hpp | 16 +++++++++------- src/myx/redis/config.hpp | 10 +++++----- src/myx/redis/config_flags.hpp.in | 1 - src/myx/redis/lexer.cpp | 8 +++++++- src/myx/redis/lexer.hpp | 15 +++++++++------ src/myx/redis/parser.cpp | 8 +++++++- src/myx/redis/parser.hpp | 17 ++++++++++------- src/myx/redis/reply.hpp | 21 ++++++++++++--------- src/myx/redis/request.cpp | 8 +++++++- src/myx/redis/request.hpp | 23 +++++++++++++---------- src/myx/redis/request_p.hpp | 14 ++++++++------ 13 files changed, 106 insertions(+), 64 deletions(-) diff --git a/src/myx/redis/client.cpp b/src/myx/redis/client.cpp index b1e2ce7..eff63e4 100644 --- a/src/myx/redis/client.cpp +++ b/src/myx/redis/client.cpp @@ -1,7 +1,9 @@ #include #include -using namespace qxredis; +namespace myx { + +namespace redis { ClientPrivate::ClientPrivate( Client* client ) : lexer ( &socket ), @@ -64,3 +66,7 @@ bool Client::waitForDisconnected( int msecs ) { return( d->socket.waitForDisconnected( msecs ) ); } + +} // namespace redis + +} // namespace myx diff --git a/src/myx/redis/client.hpp b/src/myx/redis/client.hpp index 966e65f..58fb4de 100644 --- a/src/myx/redis/client.hpp +++ b/src/myx/redis/client.hpp @@ -1,5 +1,5 @@ -#ifndef QXREDIS_CLIENT_HPP_ -#define QXREDIS_CLIENT_HPP_ +#ifndef MYX_REDIS_CLIENT_HPP_ +#define MYX_REDIS_CLIENT_HPP_ #include #include @@ -7,15 +7,16 @@ #include #include -namespace qxredis -{ +namespace myx { -class QXREDIS_EXPORT ClientPrivate; +namespace redis { + +class MYX_REDIS_EXPORT ClientPrivate; /** * @brief Provides access to a Redis server */ -class QXREDIS_EXPORT Client : public QObject +class MYX_REDIS_EXPORT Client : public QObject { Q_OBJECT @@ -103,8 +104,10 @@ public: private: const QScopedPointer< ClientPrivate > d; -}; // class QXREDIS_EXPORT +}; // class MYX_REDIS_EXPORT -} // namespace QXRedis +} // namespace redis -#endif // QXREDIS_CLIENT_HPP_ +} // namespace myx + +#endif // MYX_REDIS_CLIENT_HPP_ diff --git a/src/myx/redis/client_p.hpp b/src/myx/redis/client_p.hpp index f8da808..a09adfc 100644 --- a/src/myx/redis/client_p.hpp +++ b/src/myx/redis/client_p.hpp @@ -1,5 +1,5 @@ -#ifndef QREDIS_CLIENT_P_H -#define QREDIS_CLIENT_P_H +#ifndef MYX_REDIS_CLIENT_P_HPP_ +#define MYX_REDIS_CLIENT_P_HPP_ #include #include @@ -11,8 +11,9 @@ #include #include -namespace qxredis -{ +namespace myx { + +namespace redis { class ClientPrivate : public QObject { @@ -28,9 +29,10 @@ public: Parser parser; private: - Q_SLOT void sendReply(const qxredis::Reply & ); + Q_SLOT void sendReply(const myx::redis::Reply & ); }; // class ClientPrivate -} // namespace QRedis +} +} -#endif // QREDIS_CLIENT_H +#endif // MYX_REDIS_CLIENT_P_HPP_ diff --git a/src/myx/redis/config.hpp b/src/myx/redis/config.hpp index d59ca21..f64ae2e 100644 --- a/src/myx/redis/config.hpp +++ b/src/myx/redis/config.hpp @@ -1,14 +1,14 @@ -#ifndef QXREDIS_CONFIG_HPP_ -#define QXREDIS_CONFIG_HPP_ +#ifndef MYX_REDIS_CONFIG_HPP_ +#define MYX_REDIS_CONFIG_HPP_ #include // #if defined( qredis_EXPORTS ) - #define QXREDIS_EXPORT Q_DECL_EXPORT + #define MYX_REDIS_EXPORT Q_DECL_EXPORT // #else -// #define QXREDIS_EXPORT Q_DECL_IMPORT +// #define MYX_REDIS_EXPORT Q_DECL_IMPORT // #endif #include "config_flags.hpp" -#endif // QXREDIS_CONFIG_HPP_ +#endif // MYX_REDIS_CONFIG_HPP_ diff --git a/src/myx/redis/config_flags.hpp.in b/src/myx/redis/config_flags.hpp.in index 8f19958..2a1bcff 100644 --- a/src/myx/redis/config_flags.hpp.in +++ b/src/myx/redis/config_flags.hpp.in @@ -4,4 +4,3 @@ // #cmakedefine #endif /* @CMLIB_PROJECT_NAME_CANONICAL@_CONFIG_FLAGS_HPP_ */ - diff --git a/src/myx/redis/lexer.cpp b/src/myx/redis/lexer.cpp index 56c80c0..e338bf1 100644 --- a/src/myx/redis/lexer.cpp +++ b/src/myx/redis/lexer.cpp @@ -1,6 +1,8 @@ #include "lexer.hpp" -using namespace qxredis; +namespace myx { + +namespace redis { Lexer::Lexer( QIODevice* device, QObject* parent ) : QObject ( parent ), @@ -113,3 +115,7 @@ bool Lexer::readSafeString() m_state = DoingNothing; return( true ); } + +} // namespace redis + +} // namespace myx diff --git a/src/myx/redis/lexer.hpp b/src/myx/redis/lexer.hpp index 5cc8169..d041ca1 100644 --- a/src/myx/redis/lexer.hpp +++ b/src/myx/redis/lexer.hpp @@ -1,11 +1,12 @@ -#ifndef QXREDIS_LEXER_HPP_ -#define QXREDIS_LEXER_HPP_ +#ifndef MYX_REDIS_LEXER_HPP_ +#define MYX_REDIS_LEXER_HPP_ #include #include -namespace qxredis -{ +namespace myx { + +namespace redis { class Lexer : public QObject { @@ -46,6 +47,8 @@ private: int m_length; }; // class Lexer -} // namespace QRedis +} // namespace redis -#endif // QREDIS_LEXER_H +} // namespace myx + +#endif // MYX_REDIS_LEXER_HPP_ diff --git a/src/myx/redis/parser.cpp b/src/myx/redis/parser.cpp index f74699b..a3a881d 100644 --- a/src/myx/redis/parser.cpp +++ b/src/myx/redis/parser.cpp @@ -1,6 +1,8 @@ #include "parser.hpp" -using namespace qxredis; +namespace myx { + +namespace redis { Parser::Parser( Lexer* lexer, QObject* parent ) : QObject( parent ) @@ -74,3 +76,7 @@ void Parser::descend() tos().reply.value().toList().append( QVariant::fromValue( r ) ); } } + +} // namespace redis + +} // namespace myx diff --git a/src/myx/redis/parser.hpp b/src/myx/redis/parser.hpp index 1f027ec..6891453 100644 --- a/src/myx/redis/parser.hpp +++ b/src/myx/redis/parser.hpp @@ -1,5 +1,5 @@ -#ifndef QREDIS_PARSER_H -#define QREDIS_PARSER_H +#ifndef MYX_REDIS_PARSER_HPP_ +#define MYX_REDIS_PARSER_HPP_ #include #include @@ -9,8 +9,9 @@ #include #include -namespace qxredis -{ +namespace myx { + +namespace redis { class Parser : public QObject { @@ -20,7 +21,7 @@ public: Parser( Lexer*, QObject* = nullptr ); virtual ~Parser() = default; - Q_SIGNAL void reply( const qxredis::Reply& ); + Q_SIGNAL void reply( const myx::redis::Reply& ); private: Q_SLOT void readCharacter( const char ); @@ -49,6 +50,8 @@ public: Task& tos() { return( stack.last() ); } }; // class Parser -} // namespace QRedis +} // namespace redis -#endif // QREDIS_PARSER_H +} // namespace myx + +#endif // MYX_REDIS_PARSER_HPP_ diff --git a/src/myx/redis/reply.hpp b/src/myx/redis/reply.hpp index 37d502f..847bbd8 100644 --- a/src/myx/redis/reply.hpp +++ b/src/myx/redis/reply.hpp @@ -1,17 +1,18 @@ -#ifndef QXREDIS_REPLY_HPP_ -#define QXREDIS_REPLY_HPP_ +#ifndef MYX_REDIS_REPLY_HPP_ +#define MYX_REDIS_REPLY_HPP_ #include #include -namespace qxredis -{ +namespace myx { + +namespace redis { /** * @brief Represents a Redis reply */ -class QXREDIS_EXPORT Reply +class MYX_REDIS_EXPORT Reply { public: @@ -98,10 +99,12 @@ private: Type _type; QVariant _value; -}; // class QXREDIS_EXPORT Reply +}; // class MYX_REDIS_EXPORT Reply -} // namespace qxredis +} // namespace redis -Q_DECLARE_METATYPE( qxredis::Reply ) +} // namespace myx -#endif // QXREDIS_REPLY_HPP_ +Q_DECLARE_METATYPE( myx::redis::Reply ) + +#endif // MYX_REDIS_REPLY_HPP_ diff --git a/src/myx/redis/request.cpp b/src/myx/redis/request.cpp index 468218c..9cb037f 100644 --- a/src/myx/redis/request.cpp +++ b/src/myx/redis/request.cpp @@ -3,7 +3,9 @@ #include #include -using namespace qxredis; +namespace myx { + +namespace redis { void RequestPrivate::quitEventLoop() { @@ -34,3 +36,7 @@ bool Request::waitForReply( int msecs ) */ return( ( d->loop.exec( QEventLoop::ExcludeUserInputEvents ) != 0 ) ); } + +} // namespace redis + +} // namespace myx diff --git a/src/myx/redis/request.hpp b/src/myx/redis/request.hpp index 9f2d7d7..cbd1bfe 100644 --- a/src/myx/redis/request.hpp +++ b/src/myx/redis/request.hpp @@ -1,5 +1,5 @@ -#ifndef QREDIS_REQUEST_H -#define QREDIS_REQUEST_H +#ifndef MYX_REDIS_REQUEST_HPP_ +#define MYX_REDIS_REQUEST_HPP_ #include #include @@ -7,15 +7,16 @@ #include #include -namespace qxredis -{ +namespace myx { -class QXREDIS_EXPORT RequestPrivate; +namespace redis { + +class MYX_REDIS_EXPORT RequestPrivate; /** * @brief Represents a Redis command and its response */ -class QXREDIS_EXPORT Request : public QObject +class MYX_REDIS_EXPORT Request : public QObject { Q_OBJECT @@ -43,13 +44,15 @@ public: * @brief Emitted when a reply is received * @param reply the reply received */ - Q_SIGNAL void reply( const qxredis::Reply& reply ); + Q_SIGNAL void reply( const myx::redis::Reply& reply ); private: const QScopedPointer< RequestPrivate > d; -}; // class QXREDIS_EXPORT +}; // class MYX_REDIS_EXPORT -} // namespace QRedis +} // namespace redis -#endif // QREDIS_REQUEST_H +} // namespace myx + +#endif // MYX_REDIS_REQUEST_HPP_ diff --git a/src/myx/redis/request_p.hpp b/src/myx/redis/request_p.hpp index 8a6f896..ff54df9 100644 --- a/src/myx/redis/request_p.hpp +++ b/src/myx/redis/request_p.hpp @@ -1,11 +1,12 @@ -#ifndef QREDIS_REQUEST_P_H -#define QREDIS_REQUEST_P_H +#ifndef MYX_REDIS_REQUEST_P_HPP_ +#define MYX_REDIS_REQUEST_P_HPP_ #include #include -namespace qxredis -{ +namespace myx { + +namespace redis { class RequestPrivate : public QObject { @@ -18,6 +19,7 @@ public: Q_SLOT void quitEventLoop(); }; -} // namespace QRedis +} -#endif // QREDIS_REQUEST_P_H +} +#endif // MYX_REDIS_REQUEST_P_HPP_