logic: added "serialize" method for indexer commands

This commit is contained in:
mlangkabel
2018-06-05 11:45:03 +02:00
parent 3cc51e0d01
commit 31920972eb
12 changed files with 150 additions and 9 deletions
@@ -1,5 +1,8 @@
#include "data/indexer/IndexerCommandJava.h"
#include <QJsonArray>
#include <QJsonObject>
#include "utility/utilityString.h"
IndexerCommandType IndexerCommandJava::getStaticIndexerCommandType()
@@ -49,3 +52,22 @@ std::vector<FilePath> IndexerCommandJava::getClassPath() const
{
return m_classPath;
}
QJsonObject IndexerCommandJava::doSerialize() const
{
QJsonObject jsonObject = IndexerCommand::doSerialize();
{
QJsonArray classPathArray;
for (const FilePath& classPath : m_classPath)
{
classPathArray.append(QString::fromStdWString(classPath.wstr()));
}
jsonObject["class_path"] = classPathArray;
}
{
jsonObject["language_standard"] = QString::fromStdString(m_languageStandard);
}
return jsonObject;
}
@@ -27,6 +27,9 @@ public:
void setClassPath(std::vector<FilePath> classPath);
std::vector<FilePath> getClassPath() const;
protected:
QJsonObject doSerialize() const override;
private:
const std::string m_languageStandard;
std::vector<FilePath> m_classPath;