Syntax update to conform to CC coding standards + compilation with Visual Studio 2017

This commit is contained in:
Daniel Girardeau-Montaut
2020-10-30 20:35:42 +01:00
parent e0307e5555
commit 0c76203c43
3 changed files with 74 additions and 86 deletions
+23 -12
View File
@@ -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