2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
5 * A very simple word wrapping encoder.
10 #include "wvencoder.h"
13 * Trivial word wrapper.
14 * Recognizes newlines in input stream as end of line.
15 * Words are output until no more will fit, in which case a newline
16 * is output and the word is presented on the next line. Wrapped
17 * word delimiter characters are discarded such that a wrapped word
18 * will always be placed at the beginning of a line.
20 class WvWordWrapEncoder
: public WvEncoder
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
30 WvWordWrapEncoder(int maxwidth
);
31 virtual ~WvWordWrapEncoder();
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
39 void flushline(WvBuf
&outbuf
);
42 #endif // __WVWORDWRAP_H