22template <
typename RoundtripType,
int kFullPrecision>
25 buffer.imbue(std::locale::classic());
32 if (
value != (RoundtripType)roundtripped && std::isfinite(
value)) {
35 buffer.precision(kFullPrecision);
39 "%.17g -> %s -> %.17g",
value,
text.c_str(), roundtripped);
51 return to_string_impl<float, 9>(
value);
55 return to_string_impl<double, 17>(
value);
59 std::string str(
s.data(),
s.size());
60 std::stringstream
buffer(str);
61 buffer.imbue(std::locale::classic());
70 char suffix =
s.back();
71 if (suffix ==
'u' || suffix ==
'U') {
75 const char* strEnd = str.data() + str.length();
78 unsigned long long result = strtoull(str.data(), &p, 0);
80 return p == strEnd && errno == 0 &&
result <= 0xFFFFFFFF;
100 #define BUFFER_SIZE 256
103 va_copy(reuse,
args);
106 str->append(
buffer, size);
108 auto newBuffer = std::unique_ptr<char[]>(
new char[size + 1]);
109 vsnprintf(newBuffer.get(), size + 1,
fmt, reuse);
110 str->append(newBuffer.get(), size);
#define SkASSERTF(cond, fmt,...)
static std::string to_string_impl(RoundtripType value)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
static const uint8_t buffer[]
std::string void void vappendf(std::string *str, const char *fmt, va_list va) SK_PRINTF_LIKE(2
std::string printf(const char *fmt,...) SK_PRINTF_LIKE(1
std::string void appendf(std::string *str, const char *fmt,...) SK_PRINTF_LIKE(2
bool stod(std::string_view s, SKSL_FLOAT *value)
bool stoi(std::string_view s, SKSL_INT *value)
std::string to_string(float value)
constexpr bool contains(std::string_view str, std::string_view needle)
static SkString fmt(SkColor4f c)