This header file 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 destination<CharT>
{ /*...*/ };
template < typename CharT
, typename Traits = std::char_traits<CharT>
, typename Allocator = std::allocator<CharT> >
class basic_string_maker final: public destination<CharT>
{ /*...*/ };
template < typename CharT
, typename Traits = std::char_traits<CharT>
, typename Allocator = std::allocator<CharT> >
class basic_sized_string_maker final: public destination<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>;
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 {destination}<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 |
|
Postconditions |
|
basic_string<CharT, Traits, Allocator> finish()
Effects |
Calls |
Postconditions |
|
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 {destination}<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 destination object ( assuming it’s the the first call ). |
Postconditions |
|
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 {destination}<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 |
|
Postconditions |
|
void finish()
Effects |
Calls |
Postcondition |
|
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
-
printing_syntax<DestCreator>
, whereDestCreator
is an implementation-defined type that satisfies DestinationCreator and SizedDestinationCreator - Return value
-
An object whose
DestCreator
object_dest_creator
is such that-
_dest_creator.create()
returnsbasic_string_appender<CharT, Traits, Allocator>{str}
-
_dest_creator.create(capacity)
callsstr.reserve(str.size() + capacity)
and returnsbasic_string_appender<CharT, Traits, Allocator>{str}
-
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
Effects |
Calls |
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 {};
} // namespace strf
- Type
-
printing_syntax<DestCreator>
, whereDestCreator
is an implementation-defined type that satisfies DestinationCreator and SizedDestinationCreator. - Value
-
An object whose
DestCreator
object_dest_creator
is such that-
_dest_creator.create()
returnsbasic_string_maker<CharT, Traits, Allocator>{}.
-
_dest_creator.create(capacity)
returnsbasic_sized_string_maker<CharT, Traits, Allocator>{capacity}
-
6.1. Aliases
namespace strf {
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