提交 27d60c6f 编写于 作者: A Alexey Milovidov

Added unneeded unrelated changes just in case

上级 1224866e
......@@ -768,10 +768,18 @@ template <typename T>
inline std::enable_if_t<is_integral_v<T>, void>
readText(T & x, ReadBuffer & buf) { readIntText(x, buf); }
template <typename T>
inline std::enable_if_t<is_integral_v<T>, bool>
tryReadText(T & x, ReadBuffer & buf) { return tryReadIntText(x, buf); }
template <typename T>
inline std::enable_if_t<std::is_floating_point_v<T>, void>
readText(T & x, ReadBuffer & buf) { readFloatText(x, buf); }
template <typename T>
inline std::enable_if_t<std::is_floating_point_v<T>, bool>
tryReadText(T & x, ReadBuffer & buf) { return tryReadFloatText(x, buf); }
inline void readText(bool & x, ReadBuffer & buf) { readBoolText(x, buf); }
inline void readText(String & x, ReadBuffer & buf) { readEscapedString(x, buf); }
inline void readText(LocalDate & x, ReadBuffer & buf) { readDateText(x, buf); }
......@@ -972,6 +980,13 @@ inline T parse(const char * data, size_t size)
return res;
}
template <typename T>
inline bool tryParse(T & res, const char * data, size_t size)
{
ReadBufferFromMemory buf(data, size);
return tryReadText(res, buf);
}
template <typename T>
inline std::enable_if_t<!is_integral_v<T>, void>
readTextWithSizeSuffix(T & x, ReadBuffer & buf) { readText(x, buf); }
......@@ -1058,6 +1073,18 @@ inline T parse(const String & s)
return parse<T>(s.data(), s.size());
}
template <typename T>
inline bool tryParse(T & res, const char * data)
{
return tryParse(res, data, strlen(data));
}
template <typename T>
inline bool tryParse(T & res, const String & s)
{
return tryParse(res, s.data(), s.size());
}
/** Skip UTF-8 BOM if it is under cursor.
* As BOM is usually located at start of stream, and buffer size is usually larger than three bytes,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册