<commit_before>// Copyright 2016 <NAME>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Precompiled header file
#include "stdafx.h"

namespace Intrinsic
{
namespace Core
{
namespace Settings
{
// Static members
_INTR_STRING Manager::_initialWorld = "Default.world.json";
_INTR_STRING Manager::_assetMeshPath =
    "../../Intrinsic_Assets/app/assets/meshes";
_INTR_STRING Manager::_assetTexturePath =
    "../../Intrinsic_Assets/app/assets/textures";
uint32_t Manager::_rendererFlags = 0u;
float Manager::_targetFrameRate = 0.016f;
WindowMode::Enum Manager::_windowMode = WindowMode::kWindowed;
uint32_t Manager::_screenResolutionWidth = 1280u;
uint32_t Manager::_screenResolutionHeight = 720u;

namespace
{
template <typename T>
_INTR_INLINE void readSetting(rapidjson::Document& p_Doc, const Name& p_Name,
                              T& p_Target)
{
  if (p_Doc.HasMember(p_Name._string.c_str()))
  {
    p_Target = p_Doc[p_Name._string.c_str()].Get<T>();
    _INTR_LOG_INFO("%s = '%s'", p_Name._string.c_str(),
                   StringUtil::toString(p_Target).c_str());
  }
}

template <>
_INTR_INLINE void readSetting(rapidjson::Document& p_Doc, const Name& p_Name,
                              _INTR_STRING& p_Target)
{
  if (p_Doc.HasMember(p_Name._string.c_str()))
  {
    p_Target = p_Doc[p_Name._string.c_str()].GetString();
    _INTR_LOG_INFO("%s = '%s'", p_Name._string.c_str(),
                   StringUtil::toString(p_Target).c_str());
  }
}
}

// <-

void Manager::loadSettings()
{
  FILE* fp = fopen("settings.json", "rb");

  if (fp == nullptr)
  {
    _INTR_LOG_WARNING("No settings file available - using default values...");
    return;
  }<commit_msg>Unnecessary "toString" call<commit_after>// Copyright 2016 <NAME>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Precompiled header file
#include "stdafx.h"

namespace Intrinsic
{
namespace Core
{
namespace Settings
{
// Static members
_INTR_STRING Manager::_initialWorld = "Default.world.json";
_INTR_STRING Manager::_assetMeshPath =
    "../../Intrinsic_Assets/app/assets/meshes";
_INTR_STRING Manager::_assetTexturePath =
    "../../Intrinsic_Assets/app/assets/textures";
uint32_t Manager::_rendererFlags = 0u;
float Manager::_targetFrameRate = 0.016f;
WindowMode::Enum Manager::_windowMode = WindowMode::kWindowed;
uint32_t Manager::_screenResolutionWidth = 1280u;
uint32_t Manager::_screenResolutionHeight = 720u;

namespace
{
template <typename T>
_INTR_INLINE void readSetting(rapidjson::Document& p_Doc, const Name& p_Name,
                              T& p_Target)
{
  if (p_Doc.HasMember(p_Name._string.c_str()))
  {
    p_Target = p_Doc[p_Name._string.c_str()].Get<T>();
    _INTR_LOG_INFO("%s = '%s'", p_Name._string.c_str(),
                   StringUtil::toString(p_Target).c_str());
  }
}

template <>
_INTR_INLINE void readSetting(rapidjson::Document& p_Doc, const Name& p_Name,
                              _INTR_STRING& p_Target)
{
  if (p_Doc.HasMember(p_Name._string.c_str()))
  {
    p_Target = p_Doc[p_Name._string.c_str()].GetString();
    _INTR_LOG_INFO("%s = '%s'", p_Name._string.c_str(), p_Target.c_str());
  }
}
}

// <-

void Manager::loadSettings()
{
  FILE* fp = fopen("settings.json", "rb");

  if (fp == nullptr)
  {
    _INTR_LOG_WARNING("No settings file available - using default values...");
    return;
  }
{'fraction_non_alphanumeric': 0.13066482631700024, 'fraction_numerical': 0.01196227283183805, 'mean_word_length': 3.685344827586207, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '129097', 'n_tokens_mistral': 1422, 'n_tokens_neox': 1371, 'n_words': 352}