MCPcopy Create free account
hub / github.com/couchbase/fleece / to_string

Method to_string

Fleece/Support/diff_match_patch.hh:2382–2394  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2380 */
2381 private:
2382 static string_t to_string(ssize_t n) {
2383 string_t str;
2384 bool negative = false;
2385 size_t l = 0;
2386 if (n < 0) {n = -n; ++l; negative = true;}
2387 ssize_t n_ = n; do { ++l; } while ((n_ /= 10) > 0);
2388 str.resize(l);
2389 typename string_t::iterator s = str.end();
2390 const wchar_t digits[] = L"0123456789";
2391 do { *--s = traits::from_wchar(digits[n % 10]); } while ((n /= 10) > 0);
2392 if (negative) *--s = traits::from_wchar(L'-');
2393 return str;
2394 }
2395
2396 static ssize_t to_int(const string_t& str) { return traits::to_int(str.c_str()); }
2397

Callers

nothing calls this directly

Calls 2

resizeMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected