Added unneeded unrelated changes just in case

This commit is contained in:
Alexey Milovidov 2020-03-10 17:39:44 +03:00
parent 1224866ea9
commit 27d60c6fe4

View File

@ -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,