symmetric_filter.html 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <HTML>
  3. <HEAD>
  4. <TITLE>SymmetricFilter</TITLE>
  5. <LINK REL="stylesheet" HREF="../../../../boost.css">
  6. <LINK REL="stylesheet" HREF="../theme/iostreams.css">
  7. </HEAD>
  8. <BODY>
  9. <!-- Begin Banner -->
  10. <H1 CLASS="title">SymmetricFilter</H1>
  11. <HR CLASS="banner">
  12. <!-- End Banner -->
  13. <H2>Description</H2>
  14. <P>
  15. A SymmetricFilter processes a character sequence fed to it incrementally in a user-supplied buffer and outputs a filtered sequence incrementally to a second user-supplied buffer. It is useful for defining filters based on C language APIs.
  16. </P>
  17. <P>
  18. SymmetricFilter does not refine <A HREF="filter.html">Filter</A>. Instead, the template <A HREF="../classes/symmetric_filter.html"><CODE>symmetric_filter</CODE></A> can used to generate a Filter from a SymmetricFilter. The Filters generated in this manner are <A HREF="dual_use_filter.html">DualUseFilters</A> and are <A HREF="../../../../doc/html/CopyConstructible.html" TARGET="_top">CopyConstructible</A> regardless of whether the SymmetricFilters on which they are based are <A HREF="../../../../doc/html/CopyConstructible.html">CopyConstructible</A>.
  19. </P>
  20. <P>
  21. The concept SymmetricFilter is notable in that its definition does not involve the concept of a <A HREF="source.html">Source</A> or <A HREF="sink.html">Sink</A>.
  22. </P>
  23. <H2>Associated Types</H2>
  24. <TABLE CELLPADDING="5" BORDER="1">
  25. <TR><TD>Character type</TD><TD>The type of the characters in the filtered sequences</TD></TR>
  26. </TABLE>
  27. <H2>Notation</H2>
  28. <TABLE CELLPADDING="2">
  29. <TR><TD><CODE>F</CODE></TD><TD>- A type which is a model of SymmetricFilter</TD></TR>
  30. <TR><TD><CODE>Ch</CODE></TD><TD>- The character type of <CODE>F</CODE></TD></TR>
  31. <TR><TD><CODE>f</CODE></TD><TD>- Object of type <CODE>F</CODE></TD></TR>
  32. <TR><TD><CODE>i1, i2</CODE></TD><TD>- Objects of type <CODE>const Ch*</CODE></TD></TR>
  33. <TR><TD><CODE>o1, o2</CODE></TD><TD>- Objects of type <CODE>Ch*</CODE></TD></TR>
  34. <TR><TD><CODE>flush</CODE></TD><TD>- Object of type <CODE>bool</CODE></TD></TR>
  35. </TABLE>
  36. <H2>Valid Expressions / Semantics &#8212; Typenames</H2>
  37. <TABLE CELLPADDING="5" BORDER="1">
  38. <TR><TH>Expression</TH><TH>Expression Type</TH></TR>
  39. <TR>
  40. <TD>
  41. <PRE CLASS="plain_code"><CODE>typename <A HREF="../guide/traits.html#char_type_of_ref">char_type_of</A>&lt;F&gt;::type</CODE></PRE>
  42. </TD>
  43. <TD><CODE>typename</CODE> of the character type</TD>
  44. </TR>
  45. </TABLE>
  46. <H2>Valid Expressions / Semantics &#8212; Member Functions</H2>
  47. <TABLE CELLPADDING="5" BORDER="1">
  48. <TR><TH>Expression</TH><TH>Expression Type</TH><TH>Semantics</TH><TH>Postcondition</TH></TR>
  49. <TR>
  50. <TD><PRE CLASS="plain_code"><CODE>f.filter(i1, i2, o1, o2, flush)</CODE></PRE></TD>
  51. <TD><CODE>bool</CODE></TD>
  52. <TD>
  53. Attempts to filter the sequence <CODE>[i1, i2)</CODE>, storing the result in the sequence <CODE>[o1, o2)</CODE>. If <CODE>flush</CODE> is true, writes as much output to <CODE>[o1, o2)</CODE> as possible. If <CODE>flush</CODE> is <CODE>false</CODE>, returns <CODE>false</CODE> to indicate that a &#8220;natural&#8221; end of stream has been detected. Otherwise, returns <CODE>true</CODE> to indicate that additional characters, not yet stored in <CODE>[o1, o2)</CODE>, are available for output.
  54. </TD>
  55. <TD>
  56. <P><CODE>i1</CODE> points to the first unconsumed character in the orginal sequence <CODE>[i1, i2)</CODE>.
  57. <P><CODE>o1</CODE> points to the first unconsumed character in the orginal sequence <CODE>[o1, o2)</CODE>.
  58. <P>Either <CODE>i1 == i2</CODE> or <CODE>o1 == o2</CODE>.
  59. </TD>
  60. </TR>
  61. <TR>
  62. <TD><PRE CLASS="plain_code"><CODE>f.close()</CODE></PRE></TD>
  63. <TD><CODE>void</CODE></TD>
  64. <TD ALIGN="center">-</TD>
  65. <TD>
  66. <CODE></CODE><CODE>f</CODE> is ready to begin filtering a new sequence
  67. </TD>
  68. </TR>
  69. </TABLE>
  70. <H2>Exceptions</H2>
  71. <P>
  72. Errors which occur during the execution of <CODE>filter</CODE> or <CODE>close</CODE> are indicated by throwing exceptions.
  73. </P>
  74. <H2>Models</H2>
  75. <!-- Begin Footer -->
  76. <HR>
  77. <P CLASS="copyright">&copy; Copyright 2008 <a href="http://www.coderage.com/" target="_top">CodeRage, LLC</a><br/>&copy; Copyright 2004-2007 <a href="https://www.boost.org/users/people/jonathan_turkanis.html" target="_top">Jonathan Turkanis</a></P>
  78. <P CLASS="copyright">
  79. 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>)
  80. </P>
  81. <!-- End Footer -->
  82. </BODY>