19 lines
616 B
C++
19 lines
616 B
C++
#pragma once
|
|
|
|
#include <cstddef>
|
|
#include <string>
|
|
#include <string_view>
|
|
#include <vector>
|
|
|
|
namespace Echoion::Core::Util
|
|
{
|
|
|
|
// Split `text` into pages no larger than `limit` bytes each, breaking on
|
|
// line boundaries where possible and hard-splitting over-long lines on a
|
|
// UTF-8 code-point boundary. Every returned page is <= `limit` bytes, so a
|
|
// caller can append a short footer and still stay under the transport's
|
|
// single-message cap. Returns a single element when `text` already fits.
|
|
std::vector<std::string> paginate(std::string_view text, std::size_t limit);
|
|
|
|
} // namespace Echoion::Core::Util
|