MCPcopy Create free account
hub / github.com/ablab/spades / write_str

Method write_str

ext/include/cppformat/format.h:1650–1671  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1648template <typename Char>
1649template <typename StrChar>
1650typename BasicWriter<Char>::CharPtr BasicWriter<Char>::write_str(
1651 const StrChar *s, std::size_t size, const FormatSpec &spec) {
1652 CharPtr out = CharPtr();
1653 if (size > spec.precision())
1654 size = spec.precision();
1655 if (spec.width() > size) {
1656 out = grow_buffer(spec.width());
1657 Char fill = static_cast<Char>(spec.fill());
1658 if (spec.align() == ALIGN_RIGHT) {
1659 std::fill_n(out, spec.width() - size, fill);
1660 out += spec.width() - size;
1661 } else if (spec.align() == ALIGN_CENTER) {
1662 out = fill_padding(out, spec.width(), size, fill);
1663 } else {
1664 std::fill_n(out + size, spec.width() - size, fill);
1665 }
1666 } else {
1667 out = grow_buffer(size);
1668 }
1669 std::copy(s, s + size, out);
1670 return out;
1671}
1672
1673template <typename Char>
1674typename BasicWriter<Char>::CharPtr

Callers

nothing calls this directly

Calls 6

CharPtrFunction · 0.50
copyFunction · 0.50
precisionMethod · 0.45
widthMethod · 0.45
fillMethod · 0.45
alignMethod · 0.45

Tested by

no test coverage detected