Added world creation menu

This commit is contained in:
MihailRis
2023-11-17 13:57:45 +03:00
parent 03a6ed0f96
commit 4e1f19c911
12 changed files with 227 additions and 52 deletions
+18
View File
@@ -131,4 +131,22 @@ bool util::is_integer(string text) {
return false;
}
return true;
}
bool util::is_integer(wstring text) {
for (wchar_t c : text) {
if (c < L'0' || c > L'9')
return false;
}
return true;
}
bool util::is_valid_filename(std::wstring name) {
for (wchar_t c : name) {
if (c < 31 || c == '/' || c == '\\' || c == '<' || c == '>' ||
c == ':' || c == '"' || c == '|' || c == '?' || c == '*'){
return false;
}
}
return true;
}
+2
View File
@@ -13,6 +13,8 @@ namespace util {
extern std::string wstr2str_utf8(const std::wstring ws);
extern std::wstring str2wstr_utf8(const std::string s);
extern bool is_integer(std::string text);
extern bool is_integer(std::wstring text);
extern bool is_valid_filename(std::wstring name);
}
#endif // UTIL_STRINGUTIL_H_