WvStreams
debian/libwvstreams-dev/usr/include/wvstreams/wvwordwrap.h
1/* -*- Mode: C++ -*-
2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
4 *
5 * A very simple word wrapping encoder.
6 */
7#ifndef __WVWORDWRAP_H
8#define __WVWORDWRAP_H
9
10#include "wvencoder.h"
11
21{
22 const int maxwidth;
23 char *line;
24 int width; // current visual position
25 int curindex; // current index in line array
26 int wordindex; // index of beginning of word in line array
27 bool inword; // if true, we're in a word
28
29public:
30 WvWordWrapEncoder(int maxwidth);
31 virtual ~WvWordWrapEncoder();
32
33protected:
34 // on flush, outputs a partial line with remaining chars
35 virtual bool _encode(WvBuf &inbuf, WvBuf &outbuf, bool flush);
36 virtual bool _reset(); // supported
37
38private:
39 void flushline(WvBuf &outbuf);
40};
41
42#endif // __WVWORDWRAP_H
bool flush(WvBuf &inbuf, WvBuf &outbuf, bool finish=false)
Flushes the encoder and optionally finishes it.
virtual bool _reset()
Template method implementation of reset().
Definition wvwordwrap.cc:23
virtual bool _encode(WvBuf &inbuf, WvBuf &outbuf, bool flush)
Template method implementation of encode().
Definition wvwordwrap.cc:32