bool str_touint64(const char* str, uint64& value) { int64 temp; if (!str_toint64(str, temp)) { return false; } value = (uint64) temp; return true; }
inline bool str_touint32(const char* str, uint32& value) { int64 temp; if (str_toint64(str, temp)) { if (temp < 0 || temp > 0xffffffff) { return false; } value = static_cast<uint32>(temp); return true; } return false; }
inline bool str_toint32(const char* str, int32& value) { int64 temp; if (str_toint64(str, temp)) { if (temp > INT_MAX || temp < INT_MIN) { return false; } value = static_cast<int32>(temp); return true; } return false; }
inline bool string_toint64(const std::string& str, int64& value) { return str_toint64(str.c_str(), value); }