wibble 1.1
wordwrap.h
Go to the documentation of this file.
1#include <string>
2
3using namespace std;
4
5namespace wibble {
6namespace text {
7
27{
28 std::string s;
29 size_t cursor;
30
31public:
35 WordWrap(const std::string& s) : s(s), cursor(0) {}
36
41 void restart() { cursor = 0; }
42
46 bool hasData() const { return cursor < s.size(); }
47
52 std::string get(unsigned int width);
53};
54
55}
56}
57
58
59// vim:set ts=4 sw=4:
Simple string wrapper.
Definition wordwrap.h:27
void restart()
Rewind the word wrapper, restarting the output from the beginning of the string.
Definition wordwrap.h:41
WordWrap(const std::string &s)
Creates a new word wrapper that takes data from the given string.
Definition wordwrap.h:35
bool hasData() const
Returns true if there is still data to be read in the string.
Definition wordwrap.h:46
std::string get(unsigned int width)
Get a line of text from the string, wrapped to a maximum of width characters.
Definition wordwrap.cpp:9
Definition amorph.h:17
Definition amorph.h:30