Merge branch 'save_ext' into jgrpp
# Conflicts: # src/lang/german.txt # src/lang/korean.txt # src/lang/traditional_chinese.txt # src/window.cpp
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#define STRING_FUNC_H
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <string>
|
||||
|
||||
#include "core/bitmath_func.hpp"
|
||||
#include "string_type.h"
|
||||
@@ -41,7 +42,27 @@ int CDECL vseprintf(char *str, const char *last, const char *format, va_list ap)
|
||||
char *CDECL str_fmt(const char *str, ...) WARN_FORMAT(1, 2);
|
||||
char *str_vfmt(const char *str, va_list ap);
|
||||
|
||||
void str_validate(char *str, const char *last, StringValidationSettings settings = SVS_REPLACE_WITH_QUESTION_MARK);
|
||||
char *str_validate_intl(char *str, const char *last, StringValidationSettings settings);
|
||||
|
||||
/**
|
||||
* Scans the string for valid characters and if it finds invalid ones,
|
||||
* replaces them with a question mark '?' (if not ignored)
|
||||
* @param str the string to validate
|
||||
* @param last the last valid character of str
|
||||
* @param settings the settings for the string validation.
|
||||
*/
|
||||
static inline void str_validate(char *str, const char *last, StringValidationSettings settings = SVS_REPLACE_WITH_QUESTION_MARK)
|
||||
{
|
||||
*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);
|
||||
|
Reference in New Issue
Block a user