<commit_before>//
// Created by patryk on 14.07.16.
//

#include "SceneDao.hpp"

#include <QFile>
#include <QJsonDocument>
#include <QJsonArray>
#include <QJsonValue>
#include <QJsonObject>

#include <zinot-utils/Logger.hpp>
#include <zinot-engine/res/GpuProgram.hpp>
#include <zinot-engine/res/Shader.hpp>
#include <zinot-engine/scene/dao/ShaderDao.hpp>
#include <zinot-engine/scene/dao/ObjectDao.hpp>

namespace Zinot
{

bool SceneDao::loadFromJSON(const QString & filePath)
{
   QFile file(filePath);
   file.open(QIODevice::ReadOnly);
   QJsonParseError jsonParseError;
   QJsonDocument jsonDoc = QJsonDocument::fromJson(file.readAll(), &jsonParseError);
   file.close();

   Logger & log = Logger::getInstance();

   if (jsonParseError.error)
   {
      log.log("(ERROR): Parsing scene \"" + filePath + "\". Error string:\n" + jsonParseError.errorString());
      return false;
   }

   if (jsonDoc.isEmpty())
   {
      log.log("(ERROR): SceneDao .json document \"" + filePath + "\" is empty.");
      return false;<commit_msg>Removing include res/Shader.hpp<commit_after>//
// Created by patryk on 14.07.16.
//

#include "SceneDao.hpp"

#include <QFile>
#include <QJsonDocument>
#include <QJsonArray>
#include <QJsonValue>
#include <QJsonObject>

#include <zinot-utils/Logger.hpp>
#include <zinot-engine/res/GpuProgram.hpp>
#include <zinot-engine/scene/dao/ShaderDao.hpp>
#include <zinot-engine/scene/dao/ObjectDao.hpp>

namespace Zinot
{

bool SceneDao::loadFromJSON(const QString & filePath)
{
   QFile file(filePath);
   file.open(QIODevice::ReadOnly);
   QJsonParseError jsonParseError;
   QJsonDocument jsonDoc = QJsonDocument::fromJson(file.readAll(), &jsonParseError);
   file.close();

   Logger & log = Logger::getInstance();

   if (jsonParseError.error)
   {
      log.log("(ERROR): Parsing scene \"" + filePath + "\". Error string:\n" + jsonParseError.errorString());
      return false;
   }

   if (jsonDoc.isEmpty())
   {
      log.log("(ERROR): SceneDao .json document \"" + filePath + "\" is empty.");
      return false;
{'fraction_non_alphanumeric': 0.15599022004889976, 'fraction_numerical': 0.0058679706601467, 'mean_word_length': 4.12781954887218, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4932658', 'n_tokens_mistral': 717, 'n_tokens_neox': 711, 'n_words': 137}