1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-22 22:13:35 +02:00
vcmi/lib/modding/ModIncompatibility.h

58 lines
1.2 KiB
C++
Raw Normal View History

/*
* ModIncompatibility.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#pragma once
VCMI_LIB_NAMESPACE_BEGIN
class DLL_LINKAGE ModIncompatibility: public std::exception
{
public:
2023-09-23 01:10:45 +02:00
using ModList = std::vector<std::string>;
2024-04-16 15:30:22 +02:00
ModIncompatibility(const ModList & _missingMods)
{
std::ostringstream _ss;
2023-09-23 00:32:48 +02:00
for(const auto & m : _missingMods)
2024-04-16 15:30:22 +02:00
_ss << m << std::endl;
2023-09-23 00:32:48 +02:00
messageMissingMods = _ss.str();
}
2023-09-23 00:32:48 +02:00
ModIncompatibility(const ModList & _missingMods, const ModList & _excessiveMods)
2023-09-23 00:32:48 +02:00
: ModIncompatibility(_missingMods)
{
std::ostringstream _ss;
for(const auto & m : _excessiveMods)
_ss << m << std::endl;
messageExcessiveMods = _ss.str();
}
const char * what() const noexcept override
{
2023-09-23 00:32:48 +02:00
static const std::string w("Mod incompatibility exception");
return w.c_str();
}
const std::string & whatMissing() const noexcept
{
return messageMissingMods;
}
const std::string & whatExcessive() const noexcept
{
return messageExcessiveMods;
}
private:
std::string messageMissingMods;
std::string messageExcessiveMods;
};
VCMI_LIB_NAMESPACE_END