diff --git a/MaterialLib/MPL/PropertyType.cpp b/MaterialLib/MPL/PropertyType.cpp new file mode 100644 index 0000000000000000000000000000000000000000..64e39af3a8917d2dc698bbcc9eb4c09d20acb403 --- /dev/null +++ b/MaterialLib/MPL/PropertyType.cpp @@ -0,0 +1,33 @@ +/** + * \file + * \copyright + * Copyright (c) 2012-2021, OpenGeoSys Community (http://www.opengeosys.org) + * Distributed under a Modified BSD License. + * See accompanying file LICENSE.txt or + * http://www.opengeosys.org/project/license + */ + +#include "PropertyType.h" + +#include <boost/algorithm/string/predicate.hpp> + +#include "BaseLib/Error.h" + +namespace MaterialPropertyLib +{ +PropertyType convertStringToProperty(std::string const& string) +{ + for (int i = 0; i < static_cast<int>(PropertyType::number_of_properties); + ++i) + { + if (boost::iequals(string, property_enum_to_string[i])) + { + return static_cast<PropertyType>(i); + } + } + + OGS_FATAL( + "The property name '{:s}' does not correspond to any known property", + string); +} +} // namespace MaterialPropertyLib diff --git a/MaterialLib/MPL/PropertyType.h b/MaterialLib/MPL/PropertyType.h index 6d8744ac2863b9f64d0a88402da747fbfdc37352..4976baa9373999f579c89255aae36506a8c65d15 100644 --- a/MaterialLib/MPL/PropertyType.h +++ b/MaterialLib/MPL/PropertyType.h @@ -13,12 +13,9 @@ #pragma once #include <array> -#include <boost/algorithm/string/predicate.hpp> #include <memory> #include <string> -#include "BaseLib/Error.h" - namespace MaterialPropertyLib { class Property; @@ -167,21 +164,7 @@ static const std::array<std::string, PropertyType::number_of_properties> /// This function converts a string (e.g. a string from the configuration-tree) /// into one of the entries of the PropertyType enumerator. -inline PropertyType convertStringToProperty(std::string const& string) -{ - for (int i = 0; i < static_cast<int>(PropertyType::number_of_properties); - ++i) - { - if (boost::iequals(string, property_enum_to_string[i])) - { - return static_cast<PropertyType>(i); - } - } - - OGS_FATAL( - "The property name '{:s}' does not correspond to any known property", - string); -} +PropertyType convertStringToProperty(std::string const& string); /// This data type is based on a std::array. It can hold pointers to objects of /// class Property or its inheritors. The size of this array is determined by