diff --git a/src/myx/redis/client.hpp b/src/myx/redis/client.hpp index e154707..255b88f 100644 --- a/src/myx/redis/client.hpp +++ b/src/myx/redis/client.hpp @@ -33,7 +33,7 @@ public: /** * @brief Destroys the client */ - virtual ~Client() = default; + ~Client() override = default; /* * Note: we specifically avoid an overload of connectToHost that diff --git a/src/myx/redis/client_p.hpp b/src/myx/redis/client_p.hpp index 56192bc..21786f8 100644 --- a/src/myx/redis/client_p.hpp +++ b/src/myx/redis/client_p.hpp @@ -1,16 +1,16 @@ #ifndef MYX_REDIS_CLIENT_P_HPP_ #define MYX_REDIS_CLIENT_P_HPP_ +#include +#include +#include +#include +#include + #include #include #include -#include -#include -#include -#include -#include - namespace myx { namespace redis { @@ -20,7 +20,7 @@ class ClientPrivate : public QObject Q_OBJECT public: - ClientPrivate( Client* ); + explicit ClientPrivate( Client* = nullptr ); QTcpSocket socket; QQueue< Request* > queue; diff --git a/src/myx/redis/lexer-inl.hpp b/src/myx/redis/lexer-inl.hpp index 62ddd52..12048e3 100644 --- a/src/myx/redis/lexer-inl.hpp +++ b/src/myx/redis/lexer-inl.hpp @@ -14,7 +14,7 @@ namespace redis { Lexer::Lexer( QIODevice* device, QObject* parent ) : QObject ( parent ), m_device( device ), - m_state ( DoingNothing ), + m_state ( kDoingNothing ), m_crlf ( 0 ), m_length( 0 ) { @@ -28,27 +28,27 @@ void Lexer::readData() while ( true ) { - if ( ( m_state == DoingNothing ) && !readCharacter() ) + if ( ( m_state == kDoingNothing ) && !readCharacter() ) { break; } switch ( m_state ) { - case ReadingLength: - case ReadingUnsafeString: + case kReadingLength: + case kReadingUnsafeString: if ( !readUnsafeString() ) { return; } break; - case ReadingSafeString: + case kReadingSafeString: if ( !readSafeString() ) { return; } break; - case DoingNothing: + case kDoingNothing: break; } - if ( m_state != ReadingSafeString ) + if ( m_state != kReadingSafeString ) { - m_state = DoingNothing; + m_state = kDoingNothing; } } } // Lexer::readData @@ -70,9 +70,9 @@ bool Lexer::readCharacter() case '-': case ':': case '*': - m_state = ReadingUnsafeString; break; + m_state = kReadingUnsafeString; break; case '$': - m_state = ReadingLength; break; + m_state = kReadingLength; break; } Q_EMIT character( c ); @@ -92,10 +92,10 @@ bool Lexer::readUnsafeString() QString s = m_buffer.mid( 0, m_crlf ); m_buffer.remove( 0, m_crlf + 2 ); - if ( m_state == ReadingLength ) + if ( m_state == kReadingLength ) { m_length = s.toInt(); - m_state = ReadingSafeString; + m_state = kReadingSafeString; } else { @@ -119,7 +119,7 @@ bool Lexer::readSafeString() Q_EMIT safeString( d ); - m_state = DoingNothing; + m_state = kDoingNothing; return( true ); } diff --git a/src/myx/redis/lexer.hpp b/src/myx/redis/lexer.hpp index a3cf1cc..a5e164c 100644 --- a/src/myx/redis/lexer.hpp +++ b/src/myx/redis/lexer.hpp @@ -17,8 +17,8 @@ class Lexer : public QObject public: - Lexer( QIODevice*, QObject* = nullptr ); - virtual ~Lexer() = default; + explicit Lexer( QIODevice*, QObject* = nullptr ); + ~Lexer() override = default; Q_SIGNAL void character( char ); Q_SIGNAL void unsafeString( const QString& ); @@ -38,10 +38,10 @@ private: enum { - DoingNothing, - ReadingLength, - ReadingUnsafeString, - ReadingSafeString + kDoingNothing, + kReadingLength, + kReadingUnsafeString, + kReadingSafeString } m_state; int m_crlf; diff --git a/src/myx/redis/parser.hpp b/src/myx/redis/parser.hpp index 7379171..a533836 100644 --- a/src/myx/redis/parser.hpp +++ b/src/myx/redis/parser.hpp @@ -5,8 +5,8 @@ #include #include -#include #include +#include #include #include @@ -21,17 +21,16 @@ class Parser : public QObject Q_OBJECT public: - Parser( Lexer*, QObject* = nullptr ); - virtual ~Parser() = default; + explicit Parser( Lexer*, QObject* = nullptr ); + ~Parser() override = default; Q_SIGNAL void reply( const myx::redis::Reply& ); private: - Q_SLOT void readCharacter( const char ); + Q_SLOT void readCharacter( char ); Q_SLOT void readUnsafeString( const QString& ); Q_SLOT void readSafeString( const QByteArray& ); -private: void descend(); QList< ParserTaskPrivate > m_stack; diff --git a/src/myx/redis/reply.hpp b/src/myx/redis/reply.hpp index a92d008..8b49690 100644 --- a/src/myx/redis/reply.hpp +++ b/src/myx/redis/reply.hpp @@ -75,14 +75,13 @@ public: /** * @brief Creates an empty reply */ - Reply() : - m_type( Invalid ) {} + Reply() = default; /** * @brief Initializes the reply * @param type the type of the reply */ - Reply( Type type ) : + explicit Reply( Type type ) : m_type( type ) {} /** @@ -99,7 +98,7 @@ public: private: - Type m_type; + Type m_type { Invalid }; QVariant m_value; }; // class Reply diff --git a/src/myx/redis/request.hpp b/src/myx/redis/request.hpp index 5db6709..7e30c28 100644 --- a/src/myx/redis/request.hpp +++ b/src/myx/redis/request.hpp @@ -33,7 +33,7 @@ public: /** * @brief Destroys the request */ - virtual ~Request() = default; + ~Request() override = default; /** * @brief Waits for the reply to be received