From 52f066110e301e3f6dee3ad2556a1367f16c2d17 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov <github@naumov.de> Date: Thu, 27 May 2021 10:17:04 +0200 Subject: [PATCH] [MPL] Move implementation in own TU. --- MaterialLib/MPL/PropertyType.cpp | 33 ++++++++++++++++++++++++++++++++ MaterialLib/MPL/PropertyType.h | 19 +----------------- 2 files changed, 34 insertions(+), 18 deletions(-) create mode 100644 MaterialLib/MPL/PropertyType.cpp diff --git a/MaterialLib/MPL/PropertyType.cpp b/MaterialLib/MPL/PropertyType.cpp new file mode 100644 index 00000000000..64e39af3a89 --- /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 6d8744ac286..4976baa9373 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 -- GitLab