File indexing completed on 2024-04-28 11:20:47

0001 /*
0002     SPDX-License-Identifier: GPL-2.0-or-later
0003     SPDX-FileCopyrightText: 2019 Nikita Sirgienko <warquark@gmail.com>
0004 */
0005 
0006 #ifndef _MIMERESULT_H
0007 #define _MIMERESULT_H
0008 
0009 #include <QJsonObject>
0010 
0011 #include "result.h"
0012 #include "cantor_export.h"
0013 
0014 namespace Cantor
0015 {
0016 
0017 class MimeResultPrivate;
0018 
0019 /**
0020  * Class for Jupyter results, which can't be handeled by Cantor
0021  * So data of the results and their mime types stored in this result
0022  * for preventing loosing
0023  * This must be used only with Jupyter notebook results with unsupported mime type
0024  */
0025 class CANTOR_EXPORT MimeResult : public Result
0026 {
0027   public:
0028     enum { Type = 4 };
0029     MimeResult(const QJsonObject& mimeBundle);
0030     ~MimeResult() override;
0031 
0032     QString toHtml() override;
0033 
0034     QVariant data() override;
0035     QString plain();
0036 
0037     int type() override;
0038     QString mimeType() override;
0039 
0040     QDomElement toXml(QDomDocument& doc) override;
0041 
0042     QJsonValue toJupyterJson() override;
0043     void save(const QString& filename) override;
0044   private:
0045     MimeResultPrivate* d;
0046 };
0047 
0048 }
0049 
0050 #endif /* _MIMERESULT_H */