The Iostreams Library includes six example programs demonstrating the use of filtering streams. The first five depend only on Boost header files. The last depends on the Boost Regular Expression Library, which must be built separately (see here for details.) The examples compile and run correctly on all the platforms listed in Portability.
This example uses an OutputFilter to replace each tab character in a code excerpt with an appropritate number of spaces. It is based on an example by James Kanze (see [Kanze]):
This example uses an OutputFilter to wrap text so that each line is no longer than a specified maximum value. No attention is paid to word boundaries. It is based on an example by James Kanze (see [Kanze]):
This is an example of an OutputFilter which might be useful to U.S. government officials.
This example uses an InputFilter to remove shell-style comments. It is based on an example by James Kanze (see [Kanze]):
This example uses an InputFilter to expand common usenet abbreviations (see The Jargon File):
This example uses a regex_filter to remove C and C++-style comments from a code excerpt. Although somewhat more sophisticated than the Uncommenting InputFilter, above, the Filter in this example is not adequate for use in production code since it is not sensitive to quotation marks or line continuations.
Revised 20 May, 2004
© Copyright Jonathan Turkanis, 2004
Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)