mirror of
https://github.com/love2d/love.git
synced 2026-08-17 11:00:31 +02:00
Use std::stringstream when building deprecation text.
This commit is contained in:
+13
-12
@@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
namespace love
|
namespace love
|
||||||
{
|
{
|
||||||
@@ -97,32 +98,32 @@ bool isDeprecationOutputEnabled()
|
|||||||
|
|
||||||
std::string getDeprecationNotice(const DeprecationInfo &info, bool usewhere)
|
std::string getDeprecationNotice(const DeprecationInfo &info, bool usewhere)
|
||||||
{
|
{
|
||||||
std::string notice;
|
std::stringstream notice;
|
||||||
|
|
||||||
if (usewhere)
|
if (usewhere)
|
||||||
notice += info.where;
|
notice << info.where;
|
||||||
|
|
||||||
notice += "Using deprecated ";
|
notice << "Using deprecated ";
|
||||||
|
|
||||||
if (info.apiType == API_FUNCTION)
|
if (info.apiType == API_FUNCTION)
|
||||||
notice += "function ";
|
notice << "function ";
|
||||||
else if (info.apiType == API_METHOD)
|
else if (info.apiType == API_METHOD)
|
||||||
notice += "method ";
|
notice << "method ";
|
||||||
else if (info.apiType == API_CALLBACK)
|
else if (info.apiType == API_CALLBACK)
|
||||||
notice += "callback ";
|
notice << "callback ";
|
||||||
else if (info.apiType == API_FIELD)
|
else if (info.apiType == API_FIELD)
|
||||||
notice += "field ";
|
notice << "field ";
|
||||||
else if (info.apiType == API_CONSTANT)
|
else if (info.apiType == API_CONSTANT)
|
||||||
notice += "constant ";
|
notice << "constant ";
|
||||||
|
|
||||||
notice += info.name;
|
notice << info.name;
|
||||||
|
|
||||||
if (info.type == DEPRECATED_REPLACED && !info.replacement.empty())
|
if (info.type == DEPRECATED_REPLACED && !info.replacement.empty())
|
||||||
notice += " (replaced by " + info.replacement + ")";
|
notice << " (replaced by " << info.replacement << ")";
|
||||||
else if (info.type == DEPRECATED_RENAMED && !info.replacement.empty())
|
else if (info.type == DEPRECATED_RENAMED && !info.replacement.empty())
|
||||||
notice += " (renamed to " + info.replacement + ")";
|
notice << " (renamed to " << info.replacement << ")";
|
||||||
|
|
||||||
return notice;
|
return notice.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
GetDeprecated::GetDeprecated()
|
GetDeprecated::GetDeprecated()
|
||||||
|
|||||||
Reference in New Issue
Block a user