summaryrefslogtreecommitdiff
path: root/src/loot.h
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2019-11-23 22:08:53 -0500
committerisanae <14251494+isanae@users.noreply.github.com>2019-11-23 22:08:53 -0500
commit5c9de17b6376ce94b1cdff4f4edbba798e9bfd08 (patch)
tree6da4bc1dc844dd7c3e7b7378765bb1a6b13a7c17 /src/loot.h
parent237825f5b6c77969376198ed60d81c26a6a8aded (diff)
rewrite of json report parsing
added json.h with some utilities
Diffstat (limited to 'src/loot.h')
-rw-r--r--src/loot.h28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/loot.h b/src/loot.h
index 54fc6fd1..95dbbe50 100644
--- a/src/loot.h
+++ b/src/loot.h
@@ -33,6 +33,14 @@ signals:
void finished();
private:
+ struct Report;
+ struct Stats;
+ struct Message;
+ struct Plugin;
+ struct Dirty;
+ struct File;
+ class BadReport {};
+
std::unique_ptr<QThread> m_thread;
std::atomic<bool> m_cancel;
std::atomic<bool> m_result;
@@ -50,20 +58,16 @@ private:
void processMessage(const lootcli::Message& m);
void processOutputFile();
- bool processMessages(const QJsonArray& messages);
- bool processMessage(const QJsonObject& message);
- bool processPlugins(const QJsonArray& plugins);
- bool processPlugin(const QJsonObject& plugin);
- bool processPluginDirty(const QString& name, const QJsonObject& plugin);
+ Report createReport(const QJsonDocument& doc) const;
+ Message reportMessage(const QJsonObject& message) const;
+ std::vector<Plugin> reportPlugins(const QJsonArray& plugins) const;
+ Loot::Plugin reportPlugin(const QJsonObject& plugin) const;
- template <class Format, class... Args>
- void logJsonError(Format&& f, Args&&... args)
- {
- MOBase::log::error(
- std::string("loot output file '{}': ") + f,
- m_outPath, std::forward<Args>(args)...);
- };
+ std::vector<Message> reportMessages(const QJsonArray& array) const;
+ std::vector<Loot::File> reportFiles(const QJsonArray& array) const;
+ std::vector<Loot::Dirty> reportDirty(const QJsonArray& array) const;
+ std::vector<QString> reportStringArray(const QJsonArray& array) const;
};