mirror of
https://github.com/boostorg/iostreams.git
synced 2026-02-22 15:32:20 +00:00
120 lines
5.0 KiB
HTML
Executable File
120 lines
5.0 KiB
HTML
Executable File
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE>Examples</TITLE>
|
|
<LINK REL="stylesheet" HREF="../../../boost.css">
|
|
<LINK REL="stylesheet" HREF="theme/iostreams.css">
|
|
</HEAD>
|
|
<BODY>
|
|
|
|
<!-- Begin Banner -->
|
|
|
|
<H1 CLASS="title">Examples</H1>
|
|
<HR CLASS="banner">
|
|
|
|
<!-- End Banner -->
|
|
|
|
<P>
|
|
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 <A HREF="http://www.boost.org/libs/regex">Boost Regular Expression Library</A>, which must be built separately (<I>see</I> <A HREF="http://www.boost.org/libs/regex/doc/install.html">here</A> for details.) The examples compile and run correctly on all the platforms listed in <A HREF="portability.html">Portability</A>.
|
|
</P>
|
|
|
|
<DL class="page-index">
|
|
<DT><A HREF="#tab_expanding">Tab-expanding OutputFilter</A>.
|
|
<DT><A HREF="#line_wrapping">Line-wrapping OutputFilter</A>.
|
|
<DT><A HREF="#presidential">Presidential OutputFilter</A>.
|
|
<DT><A HREF="#uncommenting">Uncommenting InputFilter</A>.
|
|
<DT><A HREF="#usenet">Usenet InputFilter</A>.
|
|
<DT><A HREF="#regex">Regex OutputFilter</A>.
|
|
</DL>
|
|
|
|
<A NAME="tab_expanding"></A>
|
|
<H2>Tab-expanding OutputFilter</H2>
|
|
|
|
<P>
|
|
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 (<I>see</I> <A CLASS="bib_ref" HREF="bibliography.html#kanze">[Kanze]</A>):
|
|
<UL>
|
|
<LI><A CLASS="code" HREF="../example/tab_expanding_output_filter.hpp">tab_expanding_output_filter.hpp</A>
|
|
<LI><A CLASS="code" HREF="../example/tab_expanding_example.cpp">tab_expanding_example.cpp</A>
|
|
<LI><A HREF="examples/tab_output.html">sample output</A>
|
|
</UL>
|
|
</P>
|
|
|
|
<A NAME="line_wrapping"></A>
|
|
<H2>Line-wrapping OutputFilter</H2>
|
|
|
|
<P>
|
|
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 (<I>see</I> <A CLASS="bib_ref" HREF="bibliography.html#kanze">[Kanze]</A>):
|
|
<UL>
|
|
<LI><A CLASS="code" HREF="../example/line_wrapping_output_filter.hpp">line_wrapping_output_filter.hpp</A>
|
|
<LI><A CLASS="code" HREF="../example/line_wrapping_example.cpp">line_wrapping_example.cpp</A>
|
|
<LI><A HREF="examples/line_wrapping_output.html">sample output</A>
|
|
</UL>
|
|
</P>
|
|
|
|
<A NAME="presidential"></A>
|
|
<H2>Presidential OutputFilter</H2>
|
|
|
|
<P>
|
|
This is an example of an OutputFilter which might be useful to U.S. government officials.</P>
|
|
<UL>
|
|
<LI><A CLASS="code" HREF="../example/presidential_output_filter.hpp">presidential_output_filter.hpp</A>
|
|
<LI><A CLASS="code" HREF="../example/presidential_filter_example.cpp">presidential_filter_example.cpp</A>
|
|
<LI><A HREF="examples/presidential_output.html">sample output</A>
|
|
</UL>
|
|
</P>
|
|
|
|
<A NAME="uncommenting"></A>
|
|
<H2>Uncommenting InputFilter</H2>
|
|
|
|
<P>
|
|
This example uses an InputFilter to remove shell-style comments. It is based on an example by James Kanze (<I>see</I> <A CLASS="bib_ref" HREF="bibliography.html#kanze">[Kanze]</A>):
|
|
<UL>
|
|
<LI><A CLASS="code" HREF="../example/uncommenting_input_filter.hpp">uncommenting_input_filter.hpp</A>
|
|
<LI><A CLASS="code" HREF="../example/uncommenting_example.cpp">uncommenting_example.cpp</A>
|
|
<LI><A HREF="examples/uncommenting_output.html">sample output</A>
|
|
</UL>
|
|
</P>
|
|
|
|
<A NAME="usenet"></A>
|
|
<H2>Usenet InputFilter</H2>
|
|
|
|
<P>
|
|
This example uses an InputFilter to expand common usenet abbreviations (<I>see</I> <A HREF="http://catb.org/~esr/jargon/html/index.html">The Jargon File</A>):
|
|
<UL>
|
|
<LI><A CLASS="code" HREF="../example/usenet_input_filter.hpp">usenet_input_filter.hpp</A>
|
|
<LI><A CLASS="code" HREF="../example/usenet_example.cpp">usenet_example.cpp</A>
|
|
<LI><A HREF="examples/usenet_output.html">sample output</A>
|
|
</UL>
|
|
</P>
|
|
|
|
<A NAME="regex"></A>
|
|
<H2>Regex OutputFilter</H2>
|
|
|
|
<P>
|
|
This example uses a regex_filter to remove C and C++-style comments from a code excerpt. Although somewhat more sophisticated than the <A HREF="#uncommenting">Uncommenting InputFilter</A>, 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.
|
|
</P>
|
|
|
|
<UL>
|
|
<LI><A CLASS="code" HREF="../example/regex_example.cpp">regex_example.cpp</A>
|
|
<LI><A HREF="examples/regex_output.html">sample output</A>
|
|
</UL>
|
|
|
|
<!-- End Footnotes -->
|
|
|
|
<!-- Begin Footer -->
|
|
|
|
<HR>
|
|
<P CLASS="copyright">Revised
|
|
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
|
20 May, 2004
|
|
<!--webbot bot="Timestamp" endspan i-checksum="38504" -->
|
|
</P>
|
|
|
|
<P CLASS="copyright">© Copyright Jonathan Turkanis, 2004</P>
|
|
<P CLASS="copyright">
|
|
Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at <A HREF="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>)
|
|
</P>
|
|
|
|
<!-- End Footer -->
|
|
|
|
</BODY> |