qredisclient
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
RedisClient::Command Class Reference

The Command class. More...

#include <command.h>

Public Types

typedef std::function< void(Response, QString)> Callback
 

Public Member Functions

 Command ()
 Constructs empty command.
 
 Command (const QList< QByteArray > &cmd, int db=-1)
 Constructs command with out callback. More...
 
 Command (const QList< QByteArray > &cmd, QObject *context, Callback callback, int db=-1)
 Constructs command with callback. More...
 
virtual ~Command ()
 ~Command
 
Commandappend (const QByteArray &part)
 Append additional arg/part to command ("SET 1" + "2") More...
 
QByteArray getByteRepresentation () const
 Get command in RESP format. More...
 
QByteArray getRawString (int limit=200) const
 Get source command as single string. More...
 
QList< QByteArray > getSplitedRepresentattion () const
 Get source command as list of args. More...
 
QString getPartAsString (int i)
 Get specific argument/part of the command. More...
 
int getDbIndex () const
 Get database index where this command should be executed. More...
 
bool hasDbIndex () const
 hasDbIndex More...
 
QObject * getOwner () const
 Get callback context. More...
 
void setCallBack (QObject *context, Callback callback)
 Set context and callback. More...
 
Callback getCallBack () const
 getCallBack More...
 
bool hasCallback () const
 hasCallback More...
 
void markAsHiPriorityCommand ()
 Mark this command as High Priority command. Command will be added to the begining of the Connection queue instead of end.
 
bool isHiPriorityCommand () const
 isHiPriorityCommand More...
 
bool isValid () const
 isValid More...
 
bool isEmpty () const
 
bool isScanCommand () const
 
bool isSelectCommand () const
 
bool isSubscriptionCommand () const
 
bool isUnSubscriptionCommand () const
 

Static Public Member Functions

static QList< QByteArray > splitCommandString (const QString &)
 Parse command from raw string. Useful for CLI clients. More...
 

Protected Attributes

QObject * m_owner
 
QList< QByteArray > m_commandWithArguments
 
int m_dbIndex
 
bool m_hiPriorityCommand
 
Callback m_callback
 

Detailed Description

The Command class.

This class is part of Public API but should be used directly only for advanced cases.

Inheritance diagram for RedisClient::Command:
RedisClient::ScanCommand

Constructor & Destructor Documentation

RedisClient::Command::Command ( const QList< QByteArray > &  cmd,
int  db = -1 
)

Constructs command with out callback.

Parameters
cmd- Command parts
db- Database index where this command should be executed
RedisClient::Command::Command ( const QList< QByteArray > &  cmd,
QObject *  context,
Callback  callback,
int  db = -1 
)

Constructs command with callback.

Parameters
cmd- Command parts
context- QObject, command will be canceled if this object destroyed
callback- Callback for response processing
db- Database index where this command should be executed

Member Function Documentation

RedisClient::Command & RedisClient::Command::append ( const QByteArray &  part)

Append additional arg/part to command ("SET 1" + "2")

Parameters
part
Returns
Reference to current object
QByteArray RedisClient::Command::getByteRepresentation ( ) const

Get command in RESP format.

Returns
QByteArray
RedisClient::Command::Callback RedisClient::Command::getCallBack ( ) const

getCallBack

Returns
int RedisClient::Command::getDbIndex ( ) const

Get database index where this command should be executed.

Returns
QObject * RedisClient::Command::getOwner ( ) const

Get callback context.

Returns
QString RedisClient::Command::getPartAsString ( int  i)

Get specific argument/part of the command.

Parameters
i
Returns
QByteArray RedisClient::Command::getRawString ( int  limit = 200) const

Get source command as single string.

Returns
QList< QByteArray > RedisClient::Command::getSplitedRepresentattion ( ) const

Get source command as list of args.

Returns
bool RedisClient::Command::hasCallback ( ) const

hasCallback

Returns
bool RedisClient::Command::hasDbIndex ( ) const

hasDbIndex

Returns
bool RedisClient::Command::isHiPriorityCommand ( ) const

isHiPriorityCommand

Returns
bool RedisClient::Command::isValid ( ) const

isValid

Returns
void RedisClient::Command::setCallBack ( QObject *  context,
Callback  callback 
)

Set context and callback.

Parameters
context
callback
QList< QByteArray > RedisClient::Command::splitCommandString ( const QString &  rawCommand)
static

Parse command from raw string. Useful for CLI clients.

Returns
Command parts as list.

The documentation for this class was generated from the following files: