mirror of
https://gitlab.com/theadib/JSonRPCPlugin.git
synced 2026-08-29 23:50:27 +08:00
Syntax update to conform to CC coding standards + compilation with Visual Studio 2017
This commit is contained in:
+23
-12
@@ -1,24 +1,37 @@
|
||||
#ifndef JSONRPCSERVER_H
|
||||
#define JSONRPCSERVER_H
|
||||
#pragma once
|
||||
|
||||
//Qt
|
||||
#include <QWebSocketServer>
|
||||
#include <QWebSocket>
|
||||
#include <QObject>
|
||||
#include <QMap>
|
||||
//STL
|
||||
#include <functional>
|
||||
#include "ccStdPluginInterface.h"
|
||||
|
||||
class JsonRPCResult {
|
||||
public:
|
||||
static JsonRPCResult error(int code, QString message) {
|
||||
JsonRPCResult result = { .isError = true, .error_code = code, .error_message = message };
|
||||
struct JsonRPCResult
|
||||
{
|
||||
static JsonRPCResult error(int code, QString message)
|
||||
{
|
||||
JsonRPCResult result;
|
||||
{
|
||||
result.isError = true;
|
||||
result.error_code = code;
|
||||
result.error_message = message;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
static JsonRPCResult success(QVariant value) {
|
||||
JsonRPCResult result = { .isError = false, .result = value };
|
||||
|
||||
static JsonRPCResult success(QVariant value)
|
||||
{
|
||||
JsonRPCResult result;
|
||||
{
|
||||
result.isError = false;
|
||||
result.result = value;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
bool isError{true};
|
||||
|
||||
bool isError{true};
|
||||
int error_code{-32601};
|
||||
QString error_message = "Method not found";
|
||||
QVariant result;
|
||||
@@ -48,5 +61,3 @@ private:
|
||||
QWebSocketServer *ws_server{nullptr};
|
||||
QList<QWebSocket * > connections;
|
||||
};
|
||||
|
||||
#endif // JSONRPCSERVER_H
|
||||
|
||||
Reference in New Issue
Block a user