E-MailRelay
Static Public Member Functions | List of all members
G::StringWrap Class Reference

A word-wrap class. More...

#include <gstringwrap.h>

Static Public Member Functions

static std::string wrap (const std::string &text, const std::string &prefix_first, const std::string &prefix_other, std::size_t width_first=70U, std::size_t width_other=0U, bool preserve_spaces=false)
 Does word-wrapping of UTF-8 text. More...
 
static std::size_t wordsize (const std::string &)
 Returns the number of characters in UTF-8 text. More...
 

Detailed Description

A word-wrap class.

Definition at line 36 of file gstringwrap.h.

Member Function Documentation

◆ wordsize()

std::size_t G::StringWrap::wordsize ( const std::string &  s)
static

Returns the number of characters in UTF-8 text.

Definition at line 183 of file gstringwrap.cpp.

◆ wrap()

std::string G::StringWrap::wrap ( const std::string &  text,
const std::string &  prefix_first,
const std::string &  prefix_other,
std::size_t  width_first = 70U,
std::size_t  width_other = 0U,
bool  preserve_spaces = false 
)
static

Does word-wrapping of UTF-8 text.

The return value is a string with embedded newlines. If 'preserve_spaces' is true then all space characters between input words that end up in the middle of an output line are preserved. There is no special handling of tabs or carriage returns. The 'first/other' parameters distinguish between the first output line and the rest.

Definition at line 119 of file gstringwrap.cpp.


The documentation for this class was generated from the following files: