/************************************************************************************//*! \file ReflectionUtilities.h++ \author Tng Kah Wei, kahwei.tng, 390009620 \par email: kahwei.tng\@digipen.edu \date Sep 16, 2022 \brief Contains the definition of the template functions of the managed ReflectionUtilities static class. Note: This file is written in C++17/CLI. Copyright (C) 2022 DigiPen Institute of Technology. Reproduction or disclosure of this file or its contents without the prior written consent of DigiPen Institute of Technology is prohibited. *//*************************************************************************************/ #pragma once // Primary Header #include "ReflectionUtilities.hxx" namespace SHADE { /*---------------------------------------------------------------------------------*/ /* Serialization Helper Functions */ /*---------------------------------------------------------------------------------*/ template bool ReflectionUtilities::fieldInsertYaml(System::Reflection::FieldInfo^ fieldInfo, System::Object^ object, YAML::Emitter& emitter) { if (fieldInfo->FieldType == FieldType::typeid) { emitter << safe_cast(fieldInfo->GetValue(object)); return true; } return false; } template bool ReflectionUtilities::fieldAssignYaml(System::Reflection::FieldInfo^ fieldInfo, Object^ object, YAML::Node& node) { return fieldAssignYaml(fieldInfo, object, node); } template bool ReflectionUtilities::fieldAssignYaml(System::Reflection::FieldInfo^ fieldInfo, Object^ object, YAML::Node& node) { if (fieldInfo->FieldType == FieldType::typeid) { fieldInfo->SetValue(object, node.as()); return true; } return false; } }