wiRedPanda
Logic Circuit Simulator
Loading...
Searching...
No Matches
HistoryHandler Class Reference

Handler for undo/redo commands. More...

#include <HistoryHandler.h>

Inheritance diagram for HistoryHandler:
[legend]

Public Member Functions

QJsonObject handleCommand (const QString &command, const QJsonObject &params, const QJsonValue &requestId) override
 HistoryHandler (MainWindow *mainWindow, const MCPValidator *validator)
Public Member Functions inherited from BaseHandler
QString availableInputPorts (GraphicElement *element) const
QString availableOutputPorts (GraphicElement *element) const
 BaseHandler (MainWindow *mainWindow, const MCPValidator *validator)
QJsonObject createErrorResponse (const QString &error, const QJsonValue &requestId=QJsonValue(), int code=JsonRpcError::InternalError) const
QJsonObject createSuccessResponse (const QJsonObject &result={}, const QJsonValue &requestId=QJsonValue()) const
Scene * currentScene ()
const Scene * currentScene () const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
bool inputPortByLabel (GraphicElement *element, const QString &label, int &portIndex, QString &errorMsg) const
bool outputPortByLabel (GraphicElement *element, const QString &label, int &portIndex, QString &errorMsg) const
template<typename Fn>
QJsonObject tryCommand (Fn &&fn, const QString &action, const QJsonValue &requestId=QJsonValue())
 Wraps fn in a try/catch, returning an error response on exception.
GraphicElement * validatedElement (const QJsonObject &params, const QString &paramName, QString &errorMsg)
 Validates paramName in params, looks up the element, and returns it.
bool validateElementId (int elementId, const QString &paramName, QString &errorMsg) const
bool validateNonEmptyString (const QJsonValue &value, const QString &paramName, QString &errorMsg) const
bool validateNonNegativeInteger (const QJsonValue &value, const QString &paramName, QString &errorMsg) const
bool validateNumeric (const QJsonValue &value, const QString &paramName, QString &errorMsg) const
bool validateParameters (const QJsonObject &params, const QStringList &required) const
bool validatePortRange (GraphicElement *element, int portIndex, bool isOutput, const QString &paramName, QString &errorMsg) const
bool validatePositiveInteger (const QJsonValue &value, const QString &paramName, QString &errorMsg) const
virtual ~BaseHandler ()=default

Additional Inherited Members

Protected Member Functions inherited from BaseHandler
QString availablePorts (GraphicElement *element, bool isOutput) const
Protected Attributes inherited from BaseHandler
MainWindow * m_mainWindow
const MCPValidator * m_validator

Detailed Description

Handler for undo/redo commands.

Handles the MCP commands that drive the active scene's undo stack: undo, redo, and querying the current undo/redo state.

Definition at line 15 of file HistoryHandler.h.

Constructor & Destructor Documentation

◆ HistoryHandler()

HistoryHandler::HistoryHandler ( MainWindow * mainWindow,
const MCPValidator * validator )
explicit

Definition at line 10 of file HistoryHandler.cpp.

References BaseHandler::BaseHandler().

Member Function Documentation

◆ handleCommand()

QJsonObject HistoryHandler::handleCommand ( const QString & command,
const QJsonObject & params,
const QJsonValue & requestId )
overridevirtual

Implements BaseHandler.

Definition at line 15 of file HistoryHandler.cpp.

References BaseHandler::createErrorResponse(), and JsonRpcError::MethodNotFound.


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