This header files includes <strf.hpp>
namespace strf {

template < typename CharT
         , typename Traits = std::char_traits<CharT>
         , typename Allocator = std::allocator<CharT> >
class basic_string_appender final: public basic_outbuff<CharT>
{ /*...*/ };

template < typename CharT
         , typename Traits = std::char_traits<CharT>
         , typename Allocator = std::allocator<CharT> >
class basic_string_maker final: public basic_outbuff<CharT>
{ /*...*/ };

template < typename CharT
         , typename Traits = std::char_traits<CharT>
         , typename Allocator = std::allocator<CharT> >
class basic_sized_string_maker final: public basic_outbuff<CharT>
{ /*...*/ };

using string_appender           = basic_string_appender<char>;
using u8string_appender         = basic_string_appender<char8_t>;
using u16string_appender        = basic_string_appender<char16_t>;
using u32string_appender        = basic_string_appender<char32_t>;
using wstring_appender          = basic_string_appender<wchar_t>;

using string_maker              = basic_string_maker<char>;
using u8string_maker            = basic_string_maker<char8_t>;
using u16string_maker           = basic_string_maker<char16_t>;
using u32string_maker           = basic_string_maker<char32_t>;
using wstring_maker             = basic_string_maker<wchar_t>;

using pre_sized_string_maker    = basic_sized_string_maker<char>;
using pre_sized_u8string_maker  = basic_sized_string_maker<char8_t>;
using pre_sized_u16string_maker = basic_sized_string_maker<char16_t>;
using pre_sized_u32string_maker = basic_sized_string_maker<char32_t>;
using pre_sized_wstring_maker   = basic_sized_string_maker<wchar_t>;

// Destination makers:

template <typename CharT, typename Traits, typename Allocator>
/*...*/ append(std::basic_string<CharT, Traits, Allocator>& str);

template <typename CharT, typename Traits, typename Allocator>
/*...*/ assign(std::basic_string<CharT, Traits, Allocator>& str);

template < typename CharT
         , typename Traits = std::char_traits<CharT>
         , typename Allocator = std::allocator<CharT> >
constexpr /* ... */ to_basic_string {};

constexpr auto to_u8string      = to_basic_string<char8_t>;
constexpr auto to_string        = to_basic_string<char_t>;
constexpr auto to_u16string     = to_basic_string<char16_t>;
constexpr auto to_u32string     = to_basic_string<char32_t>;
constexpr auto to_wstring       = to_basic_string<wchar_t>;

} // namespace strf

1. Class template basic_string_maker

1.1. Synopsis

namespace strf {

template < typename CharT
         , typename Traits = std::char_traits<CharT>
         , typename Allocator = std::allocator<CharT> >
class basic_string_maker final: public {basic_outbuff}<CharT>
{
public:
    basic_string_maker();
    basic_string_maker(const basic_string_maker&) = delete;
    basic_string_maker(basic_string_maker&&) = delete;
    void recycle() override;
    basic_string<CharT, Traits, Allocator> finish();
};

// Global type aliases

using string_maker    = basic_string_maker<char>;
using u16string_maker = basic_string_maker<char16_t>;
using u32string_maker = basic_string_maker<char32_t>;
using wstring_maker   = basic_string_maker<wchar_t>;
using u8string_maker  = basic_string_maker<char8_t>;

} // namespace strf

1.2. Public member functions

void recycle() override;
Effects
  • If good() is true then calls str.append(p0, pointer()), where str is the private string object that is later returned by finish(), and p0 is the value that pointer() would return before any call to advance and advance_to since the last call to recycle(), or since this object’s contruction, whatever happened last.

  • Calls set_pointer and/or set_end.

Postconditions

space() >= min_space_after_recycle<CharT>()

basic_string<CharT, Traits, Allocator> finish()
Effects

Calls recycle() and set_good(false) and return the internal string.

Postconditions

good() == false

2. Class template basic_sized_string_maker

2.1. Synopsis

namespace strf {

template < typename CharT
         , typename Traits = std::char_traits<CharT>
         , typename Allocator = std::allocator<CharT> >
class basic_sized_string_maker final : public {basic_outbuff}<CharT> {
public:
    explicit basic_sized_string_maker(std::size_t capacity);

    basic_sized_string_maker(const basic_sized_string_maker&) = delete;
    basic_sized_string_maker(basic_sized_string_maker&&) = delete;

    void recycle() override;
    std::basic_string<CharT, Traits, Allocator> finish();
};

using pre_sized_string_maker    = basic_sized_string_maker<char>;
using pre_sized_u16string_maker = basic_sized_string_maker<char16_t>;
using pre_sized_u32string_maker = basic_sized_string_maker<char32_t>;
using pre_sized_wstring_maker   = basic_sized_string_maker<wchar_t>;

} // namespace strf
explicit basic_sized_string_maker(std::size_t capacity);
Effect

Causes the capacity of the internal string to be equal to or greater than capacity.

basic_string<CharT, Traits, Allocator> finish()
Return value

A string containing what has been written into this outbuff object ( assuming it’s the the first call ).

Postconditions

good() == false

Note

This function should be called only once. Further calls may return empty strings.

3. Class template basic_string_appender

3.1. Synopsis

namespace strf {

template < typename CharT
         , typename Traits = std::char_traits<CharT>
         , typename Allocator = std::allocator<CharT> >
class basic_string_appender final: public {basic_outbuff}<CharT>
{
public:
    explicit basic_string_appender(basic_string<CharT, Traits, Allocator>& dest);
    basic_string_appender(const basic_string_appender&) = delete;
    basic_string_appender(basic_string_appender&&) = delete;
    void recycle() override;
    void finish();
};

// Global type aliases

using string_appender    = basic_string_appender<char>;
using u16string_appender = basic_string_appender<char16_t>;
using u32string_appender = basic_string_appender<char32_t>;
using wstring_appender   = basic_string_appender<wchar_t>;

} // namespace strf

3.2. Public member functions

void recycle() override;
Effects
  • If good() is true then calls str.append(p0, pointer()), where str is the reference that this object was initialized with, and p0 is the return value of pointer() before any call to advance and advance_to since the last call to recycle() ( all in this object ), or since this object’s contruction, whatever happened last.

  • Calls set_pointer and/or set_end.

Postconditions

space() >= min_space_after_recycle<CharT>()

void finish()
Effects

Calls recycle() and set_good(false).

Postcondition

good() == false

4. Function template append

namespace strf {

template <typename CharT, typename Traits, typename Allocator>
/* see below */ append(std::basic_string<CharT, Traits, Allocator>& str);

} // namespace strf
Return type

destination_no_reserve<OBC>, where OBC is a implementation-defined type that satisfies OutbuffCreator and SizedOutbuffCreator.

Return value

A an object obc such that:

5. Function template assign

namespace strf {

template <typename CharT, typename Traits, typename Allocator>
/* see below */ assign(std::basic_string<CharT, Traits, Allocator>& str)

} // namespace strf
Return type

Same as of assign(str)

Effects

Calls str.clear() and returns assign(str).

6. Variable template to_basic_string

namespace strf {

template < typename CharT
         , typename Traits = std::char_traits<CharT>
         , typename Allocator = std::allocator<CharT> >
constexpr </* see below */>  to_basic_string {};

constexpr auto to_u8string  = to_basic_string<char8_t>;
constexpr auto to_string    = to_basic_string<char_t>;
constexpr auto to_u16string = to_basic_string<char16_t>;
constexpr auto to_u32string = to_basic_string<char32_t>;
constexpr auto to_wstring   = to_basic_string<wchar_t>;

} // namespace strf
Type

destination_no_reserve<OBC>, where OBC is a implementation-defined type that satisfies OutbuffCreator and SizedOutbuffCreator.

Value

A destination object whose internal OutbuffCreator object obc is such that: