#ifndef OPENMW_UTILS_HPP #define OPENMW_UTILS_HPP #include #include #include #include #include #include #include #if (!defined(DEBUG_PRINTF) && defined(DEBUG)) #define DEBUG_PRINTF(...) LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, __VA_ARGS__) #else #define DEBUG_PRINTF(...) #endif namespace Utils { const std::vector split(const std::string &str, int delimiter); ESM::Cell getCellFromDescription(std::string cellDescription); void getArguments(std::vector ¶ms, va_list args, const std::string &def); template constexpr unsigned int hash(const char(&str)[N], size_t I = N) { return (I == 1 ? ((2166136261u ^ str[0]) * 16777619u) : ((hash(str, I - 1) ^ str[I - 1]) * 16777619u)); } inline unsigned int hash(const char *str, std::size_t I) { return (I == 1 ? ((2166136261u ^ str[0]) * 16777619u) : ((hash(str, I - 1) ^ str[I - 1]) * 16777619u)); } template struct is_static_castable : std::false_type { }; template struct is_static_castable(std::declval()))>::type> : std::true_type { }; template inline static typename std::enable_if::value, T *>::type static_or_dynamic_cast( F *from) { return static_cast(from); } template inline static typename std::enable_if::value, T *>::type static_or_dynamic_cast( F *from) { return dynamic_cast(from); } } #endif //OPENMW_UTILS_HPP