51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef UTIL_STRING_HEADER
-#define UTIL_STRING_HEADER
+#pragma once
#include "irrlichttypes_bloated.h"
-#include "cpp11_container.h"
-#include <stdlib.h>
+#include <cstdlib>
#include <string>
#include <cstring>
#include <vector>
#include <sstream>
#include <iomanip>
#include <cctype>
+#include <unordered_map>
#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
(((unsigned char)(x) < 0xe0) ? 2 : \
(((unsigned char)(x) < 0xf0) ? 3 : 4))
-typedef UNORDERED_MAP<std::string, std::string> StringMap;
+typedef std::unordered_map<std::string, std::string> StringMap;
struct FlagDesc {
const char *name;
*/
inline std::string lowercase(const std::string &str)
{
- std::string s2 = "";
+ std::string s2;
s2.reserve(str.size());
- for (size_t i = 0; i < str.size(); i++)
- s2 += tolower(str[i]);
+ for (char i : str)
+ s2 += tolower(i);
return s2;
}
*/
inline bool is_number(const std::string &to_check)
{
- for (size_t i = 0; i < to_check.size(); i++)
- if (!std::isdigit(to_check[i]))
+ for (char i : to_check)
+ if (!std::isdigit(i))
return false;
return !to_check.empty();
return ss.str();
}
-
-
-#endif