File indexing completed on 2024-04-28 05:48:20

0001 #pragma once
0002 
0003 #include "ce_endpoints.h"
0004 #include <QObject>
0005 #include <QtNetwork/QNetworkAccessManager>
0006 
0007 class CompilerExplorerSvc : public QObject
0008 {
0009     Q_OBJECT
0010 public:
0011     static CompilerExplorerSvc *instance();
0012     void sendRequest(CompilerExplorer::Endpoints endpoint, const QString &additional = QString());
0013     void compileRequest(const QString &endpoint, const QByteArray &obj);
0014     QNetworkReply *tooltipRequest(const QString &asmWord);
0015 
0016     ~CompilerExplorerSvc() override;
0017 
0018     static QJsonDocument getCompilationOptions(const QString &source,
0019                                                const QString &userArgs,
0020                                                bool isIntel,
0021                                                bool demangle,
0022                                                bool stripUnusedLabels,
0023                                                bool stripComments,
0024                                                bool stripLibFuncs);
0025 
0026     void changeUrl(const QString &newUrl);
0027 
0028 private Q_SLOTS:
0029     void slotNetworkReply(QNetworkReply *reply);
0030 
0031 Q_SIGNALS:
0032     void languages(const QByteArray &data);
0033     void compilers(const QByteArray &data);
0034     void asmResult(const QByteArray &data);
0035 
0036 private:
0037     explicit CompilerExplorerSvc(QObject *parent = nullptr);
0038     QNetworkAccessManager *mgr;
0039     QString url;
0040 };