27 #ifndef NCWordWrapper_h
28 #define NCWordWrapper_h
70 const std::wstring &
origText()
const {
return _origText; }
111 std::wstring
nextLine( std::wstring & unwrapped );
117 std::wstring _origText;
118 std::wstring _wrappedText;
Helper class to word-wrap text into a specified maximum line width.
static std::wstring normalizeWhitespace(const std::wstring &orig)
Return a string where any sequence of whitespace in the original text is replaced with a single blank...
void setLineWidth(int width)
Set the maximum line width to wrap into.
void setText(const std::wstring &origText)
Set the original text to wrap.
int lines()
Return the number of lines after wrapping the original text.
void wrap()
Do the wrapping.
std::wstring nextLine(std::wstring &unwrapped)
Return the next line that fits into the line width and removed it from 'unwrapped'.
NCWordWrapper()
Constructor.
int lineWidth() const
Return the last used maximum line width.
const std::wstring & wrappedText()
Wrap the original text and return the wrapped text.
void ensureWrapped()
Do the wrapping if necessary.
void clear()
Clear the old content.
const std::wstring & origText() const
Return the original unwrapped text.