Index: boost/iostreams/stream.hpp
===================================================================
--- boost/iostreams/stream.hpp (revision 76927)
+++ boost/iostreams/stream.hpp (working copy)
@@ -31,7 +31,7 @@
typedef Tr traits_type;
typedef typename category_ofbasic_grep_filter
filters a character sequence line by line using a regular expression provided at construction, in a manner similar to the command-line utility grep ([IEEE]). The filter uses regular expressions from the Boost Regular Expression Library ([Maddock]).
- By default, the filtered character sequence consists of those lines of the unfilitered sequence that contain a subsequence matching the regular expression. By specifying appropriate options at construction, basic_grep_filter
can be made to pass through only those lines which exactly match the regular expression (as if the option -x had been passed to the command-line utility) or only those lines that do not contain a match (as if the option -v had been passed to the command-line utility).
+ By default, the filtered character sequence consists of those lines of the unfiltered sequence that contain a subsequence matching the regular expression. By specifying appropriate options at construction, basic_grep_filter
can be made to pass through only those lines which exactly match the regular expression (as if the option -x had been passed to the command-line utility) or only those lines that do not contain a match (as if the option -v had been passed to the command-line utility).
A running count of the lines in the filtered character sequence is available via the member function count
.
Index: libs/iostreams/doc/tutorial/writing_devices.html
===================================================================
--- libs/iostreams/doc/tutorial/writing_devices.html (revision 76927)
+++ libs/iostreams/doc/tutorial/writing_devices.html (working copy)
@@ -41,7 +41,7 @@
Here io::stream_buffer<my_device>
is a derived class of std::basic_streambuf
, and io::stream<my_device>
is a derived class of std::basic_istream
, std::basic_ostream
or std::basic_iostream
depending on the mode of my_device, i.e., depending on which of the fundamental i/o operations read
, write
and seek
it supports.
-
The template io::stream
is provided as a convenience. It's always possibly to avoid io::stream
and simply use io::stream_buffer
together with one of the standard library stream templates. E.g.,
+
The template io::stream
is provided as a convenience. It's always possible to avoid io::stream
and simply use io::stream_buffer
together with one of the standard library stream templates. E.g.,
#include <ostream> #include <boost/iostreams/device/file.hpp> Index: libs/iostreams/doc/tutorial/dictionary_filters.html =================================================================== --- libs/iostreams/doc/tutorial/dictionary_filters.html (revision 76927) +++ libs/iostreams/doc/tutorial/dictionary_filters.html (working copy) @@ -27,11 +27,11 @@2.2.6. Dictionary Filters
- A dictionary filter is a Filter which peforms text substitution in the following manner. It maintains a collection of pairs of strings whose first components are words and whose second components represent replacement text — I'll call such a collection a dictionary, and refer to the pairs it contains as definitions. When a dictionary filter encounters a word which appears as the first component of a definition, it forwards the replacement text instead of the original word. Other words, whitespace and punctuation are forwarded unchanged. + A dictionary filter is a Filter which performs text substitution in the following manner. It maintains a collection of pairs of strings whose first components are words and whose second components represent replacement text — I'll call such a collection a dictionary, and refer to the pairs it contains as definitions. When a dictionary filter encounters a word which appears as the first component of a definition, it forwards the replacement text instead of the original word. Other words, whitespace and punctuation are forwarded unchanged.
- The basic algorithm is as follows.: You examine characters one at a time, appending them to a string which I'll call the current word. When you encounter a non-alphabetic character, you consult the dictionary to determine whether the current word appears as the first component of a definition. If it does, you forward the replacement text followed by the non-alphabetic character. Otherwise, you forward the current word followed by the non-alphabetic character. When the end-of-stream is reached, you consult the dictionary again and forward either the curent word or its replacement, as appropriate. + The basic algorithm is as follows: You examine characters one at a time, appending them to a string which I'll call the current word. When you encounter a non-alphabetic character, you consult the dictionary to determine whether the current word appears as the first component of a definition. If it does, you forward the replacement text followed by the non-alphabetic character. Otherwise, you forward the current word followed by the non-alphabetic character. When the end-of-stream is reached, you consult the dictionary again and forward either the curent word or its replacement, as appropriate.
@@ -59,7 +59,7 @@ } } } // End namespace boost::iostreams:example
- The member function add
converts key
to lower case then added the pair key
, value
to the dictionary. The member function replace
searches for a definition whose first component is equal to the result of converting key
to lower case. If it finds such a definition, it assigns the replacement text to key
, adjusting the case of the first character to match the case of the first character of key
. Otherwise, it does nothing.
+ The member function add
converts key
to lower case and adds the pair key
, value
to the dictionary. The member function replace
searches for a definition whose first component is equal to the result of converting key
to lower case. If it finds such a definition, it assigns the replacement text to key
, adjusting the case of the first character to match the case of the first character of key
. Otherwise, it does nothing.
- Now suppose you want to recoved the original data. If you have appropriate InputFilters decompressor
and base64_decoder
, you can accomplish this as follows as follows:[2]
+ Now suppose you want to recover the original data. If you have appropriate InputFilters decompressor
and base64_decoder
, you can accomplish this as follows:[2]
Index: libs/iostreams/doc/tutorial/writing_filters.html =================================================================== --- libs/iostreams/doc/tutorial/writing_filters.html (revision 76927) +++ libs/iostreams/doc/tutorial/writing_filters.html (working copy) @@ -27,15 +27,15 @@2.2.1. Overview: InputFilters, OutputFilters and Filter Helpers
-Filters are used to modified character sequences. For example, you might use a filter to replace all instances of one word with another, to convert all alphabetic characters to lower case or to encrypt a document. Sometimes the filter is a mere observer; in this case the filtered character sequence if the same as the unfiltered sequence. For example, you might use a filter to count the number of occurences of a given word.
+Filters are used to modify character sequences. For example, you might use a filter to replace all instances of one word with another, to convert all alphabetic characters to lower case or to encrypt a document. Sometimes the filter is a mere observer; in this case the filtered character sequence if the same as the unfiltered sequence. For example, you might use a filter to count the number of occurences of a given word.
InputFilters and OutputFilters
-The Iostreams library supports two basic categories of Filters InputFilters and OutputFilters. InputFilters represent a “pull” model of filtering: a source of unfilitered data is provided — represented as a Source — and the Filter is expected to generate a certain number characters of the filtered sequence. The filtered sequence is generated incrementally, meaning that to filter a given character sequence the Filter typically must be invoked several times. OutputFilters represent a “push” model of filtering: a sequence of unfiltered characters and a Sink are provided, and the Filter is expected to filter the characters and write them to the Sink. Like InputFilters, OutputFilters also process data incrementally.
+The Iostreams library supports two basic categories of Filters, InputFilters and OutputFilters. InputFilters represent a “pull” model of filtering: a source of unfiltered data is provided — represented as a Source — and the Filter is expected to generate a certain number of characters of the filtered sequence. The filtered sequence is generated incrementally, meaning that to filter a given character sequence the Filter typically must be invoked several times. OutputFilters represent a “push” model of filtering: a sequence of unfiltered characters and a Sink are provided, and the Filter is expected to filter the characters and write them to the Sink. Like InputFilters, OutputFilters also process data incrementally.
-The simplest InputFilters and OutputFilters process characters one at a time. This type of Filter is easy to write, but is less efficient than Filters that process several characters at a time. Filters which process several characters at a time are called Multi-Character fiters.
+The simplest InputFilters and OutputFilters process characters one at a time. This type of Filter is easy to write, but is less efficient than Filters that process several characters at a time. Filters which process several characters at a time are called Multi-Character filters.
Filter Helpers
@@ -43,13 +43,13 @@The Iostreams library provides several utilities to make Filter writing easier:
aggregate_filter
allows a programmer to define a Filter by reading unfilitered data from one std::vector
and writing filtered data to another std::vector
.
+ aggregate_filter
allows a programmer to define a Filter by reading unfiltered data from one std::vector
and writing filtered data to another std::vector
.
stdio_filter
allows a programmer to define a Filter by reading unfilitered data from standard input and writing filtered data to standard output.
+ stdio_filter
allows a programmer to define a Filter by reading unfiltered data from standard input and writing filtered data to standard output.
symmetric_filter
allows a programmer to define a Filter by reading unfilitered data from one array and writing filtered data to another array.
+ symmetric_filter
allows a programmer to define a Filter by reading unfiltered data from one array and writing filtered data to another array.
finite_state_filter
allows a programmer to define a Filter as a finite state machine. This component is included with the example filters; it is not currently an official part of the library.
@@ -60,7 +60,7 @@
- Suppose you need to write a Filter to perform a given filtering task. How do you decide whether to write an InputFilters or OutputFilters, or to use one of the Filter helpers? The first two Filter helpers mentioned above, aggregate_filter
and stdio_filter
, have high-memory usage and only work with character sequences that have a well-defined end. They allow filtering algorithms to be expressed in a very straightforward way, however, and so provide a good introduction to filtering. The third Filter helper, symmetric_filter
, is useful for defining filter based on C-language API such as zlib, libbz2 or OpenSSL. If none of the Filter helpers are appropriate, you should generally write an InputFilter if you plan to use the filter for reading and an OutputFilter if you plan to use it for writing. In some cases, however, it is much easier to express an algorithm as an InputFilter than as an OutputFilter, or vice versa. In such cases, you can write the filter whichever way is easier, and use the class template inverse
or the function template invert
to turn an InputFilter into an OutputFilter or vice versa.
+ Suppose you need to write a Filter to perform a given filtering task. How do you decide whether to write an InputFilter or OutputFilter, or to use one of the Filter helpers? The first two Filter helpers mentioned above, aggregate_filter
and stdio_filter
, have high-memory usage and only work with character sequences that have a well-defined end. They allow filtering algorithms to be expressed in a very straightforward way, however, and so provide a good introduction to filtering. The third Filter helper, symmetric_filter
, is useful for defining filter based on C-language API such as zlib, libbz2 or OpenSSL. If none of the Filter helpers are appropriate, you should generally write an InputFilter if you plan to use the filter for reading and an OutputFilter if you plan to use it for writing. In some cases, however, it is much easier to express an algorithm as an InputFilter than as an OutputFilter, or vice versa. In such cases, you can write the filter whichever way is easier, and use the class template inverse
or the function template invert
to turn an InputFilter into an OutputFilter or vice versa.