#include "savemng.h" #include #include #include #include using namespace std; bool replace(string &str, const string &from, const string &to); string decodeXMLEscapeLine(string xmlString); template auto string_format(const string &format, Args... args) -> string { int size_s = snprintf(nullptr, 0, format.c_str(), args...) + 1; // Extra space for '\0' if (size_s <= 0) { throw runtime_error("Error during formatting."); } auto size = static_cast(size_s); unique_ptr buf(new char[size]); snprintf(buf.get(), size, format.c_str(), args...); return string(buf.get(), buf.get() + size - 1); // We don't want the '\0' inside }