Skip to main content

CommandParser

Namespace: COMLIB  ·  Library: Communication Library

#include <com/command_parser.h>

class COMLIB::CommandParser

Observer-pattern subject that decodes JSON or CLI command strings into RawCommand and notifies attached managers.

Single entry point parse() accepts either dialect, builds a RawCommand, and broadcasts it to every attached CommandManager; the response signal carries replies back from whichever manager handled the request so the caller (typically a RtCmdClient) can forward them to the originating socket.

Inheritance​


Public Methods​

CommandParser(parent)​

Default constructor.

Parameters:

  • parent : *QObject ** Parent QObject (optional).

exists(p_sCommand)​

Checks if a command exists.

Parameters:

  • p_sCommand : const QString & Command to check.

Returns:

  • bool — true if command exists, false otherwise.

parse(p_sInput, p_qListCommandsParsed)​

Parses a CLI command or JSON command (list) and notifies all attached observers (command managers).

Parameters:

  • p_sInput : const QString & Input to parse.

  • p_qListCommandsParsed : QStringList & List of parsed commands.

Returns:

  • bool — false if the input is empty, malformed JSON or an unknown CLI command, true otherwise.

getRawCommand()​

Returns the stored RawCommand.

Returns:


Authors of this file​