Move std::string str_validate to separate header

This is to fix compilation of squirrel on MacOS/clang, as squirrel
defines macros which clash with including <string>
This commit is contained in:
Jonathan G Rennison
2017-04-11 18:39:27 +01:00
parent 86d1a00ba6
commit cb9ffe1bd9
4 changed files with 25 additions and 8 deletions

View File

@@ -27,7 +27,6 @@
#define STRING_FUNC_H
#include <stdarg.h>
#include <string>
#include "core/bitmath_func.hpp"
#include "string_type.h"
@@ -56,13 +55,6 @@ static inline void str_validate(char *str, const char *last, StringValidationSet
*str_validate_intl(str, last, settings) = '\0';
}
static inline void str_validate(std::string &str, StringValidationSettings settings = SVS_REPLACE_WITH_QUESTION_MARK)
{
if (str.empty()) return;
char *buf = const_cast<char *>(str.c_str());
str.resize(str_validate_intl(buf, buf + str.size(), settings) - buf);
}
void ValidateString(const char *str);
void str_fix_scc_encoded(char *str, const char *last);