| 1648 | template <typename Char> |
| 1649 | template <typename StrChar> |
| 1650 | typename 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 | |
| 1673 | template <typename Char> |
| 1674 | typename BasicWriter<Char>::CharPtr |