MNE-CPP  beta 1.0
Public Types | Signals | Public Member Functions | Public Attributes | List of all members
RTCOMMANDLIB::Command Class Reference

Command. More...

#include <command.h>

Inheritance diagram for RTCOMMANDLIB::Command:
ICommand

Public Types

typedef QSharedPointer< CommandSPtr
 
typedef QSharedPointer< const CommandConstSPtr
 
- Public Types inherited from ICommand
typedef QSharedPointer< ICommandSPtr
 
typedef QSharedPointer< const ICommandConstSPtr
 

Signals

void executed (Command p_command)
 

Public Member Functions

 Command (bool p_bIsJson=true, QObject *parent=0)
 
 Command (const QString &p_sCommand, const QJsonObject &p_qCommandContent, bool p_bIsJson=true, QObject *parent=0)
 
 Command (const QString &p_sCommand, const QString &p_sDescription, bool p_bIsJson=true, QObject *parent=0)
 
 Command (const QString &p_sCommand, const QString &p_sDescription, const QStringList &p_qListParamNames, const QList< QVariant > &p_qListParamValues, bool p_bIsJson=true, QObject *parent=0)
 
 Command (const QString &p_sCommand, const QString &p_sDescription, const QStringList &p_qListParamNames, const QList< QVariant > &p_qListParamValues, const QStringList &p_vecParameterDescriptions, bool p_bIsJson=true, QObject *parent=0)
 
 Command (const Command &p_Command)
 
virtual ~Command ()
 
QString command () const
 
quint32 count () const
 
QString description () const
 
virtual void execute ()
 
bool & isJson ()
 
QList< QString > pDescriptions () const
 
QList< QString > pNames () const
 
QList< QVariant > & pValues ()
 
void reply (const QString &p_sReply)
 
void send ()
 
QJsonObject toJsonObject () const
 
QStringList toStringList () const
 
QString toStringReadySend () const
 
Commandoperator= (const Command &rhs)
 
QVariant & operator[] (const QString &key)
 
QVariant & operator[] (qint32 idx)
 
const QVariant operator[] (const QString &key) const
 
- Public Member Functions inherited from ICommand
virtual ~ICommand ()
 

Public Attributes

QString m_sCommand
 
QString m_sDescription
 
QStringList m_qListParamNames
 
QList< QVariant > m_qListParamValues
 
QStringList m_qListParamDescriptions
 
bool m_bIsJson
 

Detailed Description

Command.

Command, which includes beside command name also command parameters

Definition at line 82 of file command.h.

Constructor & Destructor Documentation

Command::Command ( bool  p_bIsJson = true,
QObject *  parent = 0 
)
explicit

Constructs a Command

Parameters
[in]p_bIsJsonIf is received/should be send as JSON (optional, default true)
[in]parentParent QObject (optional)

Definition at line 34 of file command.cpp.

Command::Command ( const QString &  p_sCommand,
const QJsonObject &  p_qCommandContent,
bool  p_bIsJson = true,
QObject *  parent = 0 
)
explicit

Constructor which parses a command stored in a json object

Parameters
[in]p_sCommandCommand
[in]p_qCommandContentContent encapsulated in a JsonObject
[in]p_bIsJsonIf is received/should be send as JSON (optional, default true)
[in]parentParent QObject (optional)

Definition at line 46 of file command.cpp.

Command::Command ( const QString &  p_sCommand,
const QString &  p_sDescription,
bool  p_bIsJson = true,
QObject *  parent = 0 
)
explicit

Constructs a command without parameters

Parameters
[in]p_sCommandCommand
[in]p_sDescriptionCommand description
[in]p_bIsJsonIf is received/should be send as JSON (optional, default true)
[in]parentParent QObject (optional)

Definition at line 71 of file command.cpp.

Command::Command ( const QString &  p_sCommand,
const QString &  p_sDescription,
const QStringList &  p_qListParamNames,
const QList< QVariant > &  p_qListParamValues,
bool  p_bIsJson = true,
QObject *  parent = 0 
)
explicit

Constructor which assembles a command from single parts

Parameters
[in]p_sCommandCommand
[in]p_sDescriptionCommand description
[in]p_qListParamNamesParameter names
[in]p_qListParamValuesParameter values/types.
[in]p_bIsJsonIf is received/should be send as JSON (optional, default true)
[in]parentParent QObject (optional)

Definition at line 83 of file command.cpp.

Command::Command ( const QString &  p_sCommand,
const QString &  p_sDescription,
const QStringList &  p_qListParamNames,
const QList< QVariant > &  p_qListParamValues,
const QStringList &  p_vecParameterDescriptions,
bool  p_bIsJson = true,
QObject *  parent = 0 
)
explicit

Constructor which assembles a command from single parts

Parameters
[in]p_sCommandCommand
[in]p_sDescriptionCommand description
[in]p_qListParamNamesParameter names
[in]p_qListParamValuesParameter values/types.
[in]p_vecParameterDescriptionsParameter descriptions;

Definition at line 100 of file command.cpp.

Command::Command ( const Command p_Command)

Copy constructor.

Parameters
[in]p_CommandCommand to be copied

Definition at line 126 of file command.cpp.

Command::~Command ( )
virtual

Destroys the command

Definition at line 141 of file command.cpp.

Member Function Documentation

QString RTCOMMANDLIB::Command::command ( ) const
inline

Short command for this request

Returns
Short command representation.

Definition at line 324 of file command.h.

quint32 RTCOMMANDLIB::Command::count ( ) const
inline

Returns the number of parameters.

Returns
number of parameters.

Definition at line 332 of file command.h.

QString RTCOMMANDLIB::Command::description ( ) const
inline

Gets the help text or description of this command.

Returns
Help text.

Definition at line 340 of file command.h.

void Command::execute ( )
virtual

Inherited by ICommand

Returns
emits received

Implements ICommand.

Definition at line 148 of file command.cpp.

void RTCOMMANDLIB::Command::executed ( Command  p_command)
signal

Signal which is emitted when command patterns execute method is processed.

Parameters
[in]p_commandthe executed command.
bool & RTCOMMANDLIB::Command::isJson ( )
inline

If received command was Json fomratted or triggered command should be Json formatted.

Returns
Json formatted.

Definition at line 348 of file command.h.

Command & Command::operator= ( const Command rhs)

Assignment Operator

Parameters
[in]rhsCommand which should be assigned.

Definition at line 243 of file command.cpp.

QVariant & Command::operator[] ( const QString &  key)

Subscript operator [] to access parameter values by name

Parameters
[in]keythe parameter name.
Returns
Parameter value related to the parameter name.

Definition at line 260 of file command.cpp.

QVariant & Command::operator[] ( qint32  idx)

Subscript operator [] to access parameter values by index

Parameters
[in]idxthe parameter index.
Returns
Parameter value related to the parameter index.

Definition at line 271 of file command.cpp.

const QVariant Command::operator[] ( const QString &  key) const

Subscript operator []

Parameters
[in]keythe parameter name.
Returns
Parameter value related to the parameter name.

Definition at line 282 of file command.cpp.

QList< QString > RTCOMMANDLIB::Command::pDescriptions ( ) const
inline

Get parameter descriptions

Returns
parameter descriptions

Definition at line 356 of file command.h.

QList< QString > RTCOMMANDLIB::Command::pNames ( ) const
inline

Get parameter names

Returns
parameter names

Definition at line 363 of file command.h.

QList< QVariant > & RTCOMMANDLIB::Command::pValues ( )
inline

Returns parameter values

Returns
parameter values

Definition at line 370 of file command.h.

void Command::reply ( const QString &  p_sReply)

Inherited command reply channel.

Parameters
[in]p_sReplycommand reply

Definition at line 156 of file command.cpp.

void Command::send ( )

Sender slot which emmits triggered signal

Definition at line 167 of file command.cpp.

QJsonObject Command::toJsonObject ( ) const

Creates a JSON Command Object

Returns
Command converted to a JSON Object.

Definition at line 177 of file command.cpp.

QStringList Command::toStringList ( ) const

Creates a StringList with three items. First item is the command, second the parameter list and thrid the description.

Returns
Command as a StringList.

Definition at line 198 of file command.cpp.

QString Command::toStringReadySend ( ) const

Creates a string JSON formatted ready send command.

Returns
Command as a JSON formatted string which contains parameter values too.

Definition at line 221 of file command.cpp.


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