// MassBuilderSaveTool // Copyright (C) 2021-2022 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . #include "Types/UnrealPropertyBase.h" #include "Types/ArrayProperty.h" #include "Types/SetProperty.h" #include "Types/StructProperty.h" #include "Types/GenericStructProperty.h" #include "Debug.h" Utility::Debug& operator<<(Utility::Debug& debug, const ArrayProperty* prop) { return debug << (*prop->name) << Utility::Debug::nospace << ":" << prop->propertyType << "of" << prop->items.size() << prop->itemType; } Utility::Debug& operator<<(Utility::Debug& debug, const SetProperty* prop) { return debug << (*prop->name) << Utility::Debug::nospace << ":" << prop->propertyType << "of" << prop->items.size() << prop->itemType; } Utility::Debug& operator<<(Utility::Debug& debug, const GenericStructProperty* prop) { debug << (*prop->name) << Utility::Debug::nospace << ":" << prop->structType << "(" << Utility::Debug::nospace << prop->propertyType << Utility::Debug::nospace << ") Contents:"; for(const auto& item : prop->properties) { debug << "\n " << Utility::Debug::nospace << item.get(); } return debug; } Utility::Debug& operator<<(Utility::Debug& debug, const StructProperty* prop) { auto cast = dynamic_cast(prop); if(cast) { return debug << cast; } return debug << (*prop->name) << Utility::Debug::nospace << ":" << prop->structType << "(" << Utility::Debug::nospace << prop->propertyType << Utility::Debug::nospace << ")"; } Utility::Debug& operator<<(Utility::Debug& debug, const UnrealPropertyBase* prop) { if(prop->propertyType == "ArrayProperty") { auto array_prop = dynamic_cast(prop); if(array_prop) { return debug << array_prop; } } else if(prop->propertyType == "SetProperty") { auto set_prop = dynamic_cast(prop); if(set_prop) { return debug << set_prop; } } else if(prop->propertyType == "StructProperty") { auto struct_prop = dynamic_cast(prop); if(struct_prop) { return debug << struct_prop; } } return debug << (*prop->name) << Utility::Debug::nospace << ":" << prop->propertyType; }