123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248 |
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
- <title>Class output_test_stream</title>
- <link rel="stylesheet" href="../../boostbook.css" type="text/css">
- <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
- <link rel="home" href="../../index.html" title="Boost.Test">
- <link rel="up" href="../../header/boost/test/tools/output_test_stream_hpp.html" title="Header <boost/test/tools/output_test_stream.hpp>">
- <link rel="prev" href="../../header/boost/test/tools/output_test_stream_hpp.html" title="Header <boost/test/tools/output_test_stream.hpp>">
- <link rel="next" href="../../header/boost/test/tree/observer_hpp.html" title="Header <boost/test/tree/observer.hpp>">
- </head>
- <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
- <table cellpadding="2" width="100%"><tr>
- <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
- <td align="center"><a href="../../../../../../index.html">Home</a></td>
- <td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
- <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
- <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
- <td align="center"><a href="../../../../../../more/index.htm">More</a></td>
- </tr></table>
- <hr>
- <div class="spirit-nav">
- <a accesskey="p" href="../../header/boost/test/tools/output_test_stream_hpp.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../header/boost/test/tools/output_test_stream_hpp.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../../header/boost/test/tree/observer_hpp.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
- </div>
- <div class="refentry">
- <a name="boost.test_tools.output_test_stream"></a><div class="titlepage"></div>
- <div class="refnamediv">
- <h2><span class="refentrytitle">Class output_test_stream</span></h2>
- <p>boost::test_tools::output_test_stream — Class to be used to simplify testing of ostream-based output operations. </p>
- </div>
- <h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
- <div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../header/boost/test/tools/output_test_stream_hpp.html" title="Header <boost/test/tools/output_test_stream.hpp>">boost/test/tools/output_test_stream.hpp</a>>
- </span>
- <span class="keyword">class</span> <a class="link" href="output_test_stream.html" title="Class output_test_stream">output_test_stream</a> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">wrapped_stream</span> <span class="special">{</span>
- <span class="keyword">public</span><span class="special">:</span>
- <span class="comment">// <a class="link" href="output_test_stream.html#boost.test_tools.output_test_streamconstruct-copy-destruct">construct/copy/destruct</a></span>
- <span class="keyword">explicit</span> <a class="link" href="output_test_stream.html#idm46279113082448-bb"><span class="identifier">output_test_stream</span></a><span class="special">(</span><span class="identifier">const_string</span> <span class="special">=</span> <span class="identifier">const_string</span><span class="special">(</span><span class="special">)</span><span class="special">,</span> <span class="keyword">bool</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">,</span>
- <span class="keyword">bool</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">)</span><span class="special">;</span>
- <a class="link" href="output_test_stream.html#idm46279113076704-bb"><span class="special">~</span><span class="identifier">output_test_stream</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
- <span class="comment">// <a class="link" href="output_test_stream.html#idm46279113100192-bb">public member functions</a></span>
- <span class="keyword">virtual</span> <a class="link" href="assertion_result.html" title="Class assertion_result">assertion_result</a> <a class="link" href="output_test_stream.html#idm46279113099632-bb"><span class="identifier">is_empty</span></a><span class="special">(</span><span class="keyword">bool</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">)</span><span class="special">;</span>
- <span class="keyword">virtual</span> <a class="link" href="assertion_result.html" title="Class assertion_result">assertion_result</a> <a class="link" href="output_test_stream.html#idm46279113096240-bb"><span class="identifier">check_length</span></a><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span><span class="special">,</span> <span class="keyword">bool</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">)</span><span class="special">;</span>
- <span class="keyword">virtual</span> <a class="link" href="assertion_result.html" title="Class assertion_result">assertion_result</a> <a class="link" href="output_test_stream.html#idm46279113091680-bb"><span class="identifier">is_equal</span></a><span class="special">(</span><span class="identifier">const_string</span><span class="special">,</span> <span class="keyword">bool</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">)</span><span class="special">;</span>
- <span class="keyword">virtual</span> <a class="link" href="assertion_result.html" title="Class assertion_result">assertion_result</a> <a class="link" href="output_test_stream.html#idm46279113087168-bb"><span class="identifier">match_pattern</span></a><span class="special">(</span><span class="keyword">bool</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">)</span><span class="special">;</span>
- <span class="keyword">void</span> <a class="link" href="output_test_stream.html#idm46279113083744-bb"><span class="identifier">flush</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
- <span class="comment">// <a class="link" href="output_test_stream.html#idm46279113076416-bb">protected member functions</a></span>
- <span class="keyword">virtual</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <a class="link" href="output_test_stream.html#idm46279113075840-bb"><span class="identifier">get_stream_string_representation</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
- <span class="comment">// <a class="link" href="output_test_stream.html#idm46279113073472-bb">private member functions</a></span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <a class="link" href="output_test_stream.html#idm46279113072896-bb"><span class="identifier">length</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
- <span class="keyword">virtual</span> <span class="keyword">void</span> <a class="link" href="output_test_stream.html#idm46279113071760-bb"><span class="identifier">sync</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
- <span class="special">}</span><span class="special">;</span></pre></div>
- <div class="refsect1">
- <a name="idm45313886628048"></a><h2>Description</h2>
- <div class="refsect2">
- <a name="idm45313886627632"></a><h3>
- <a name="boost.test_tools.output_test_streamconstruct-copy-destruct"></a><code class="computeroutput">output_test_stream</code>
- public
- construct/copy/destruct</h3>
- <div class="orderedlist"><ol class="orderedlist" type="1">
- <li class="listitem">
- <pre class="literallayout"><span class="keyword">explicit</span> <a name="idm46279113082448-bb"></a><span class="identifier">output_test_stream</span><span class="special">(</span><span class="identifier">const_string</span> pattern_file_name <span class="special">=</span> <span class="identifier">const_string</span><span class="special">(</span><span class="special">)</span><span class="special">,</span>
- <span class="keyword">bool</span> match_or_save <span class="special">=</span> <span class="keyword">true</span><span class="special">,</span>
- <span class="keyword">bool</span> text_or_binary <span class="special">=</span> <span class="keyword">true</span><span class="special">)</span><span class="special">;</span></pre>Constructor. <p>
- </p>
- <div class="variablelist"><table border="0" class="variablelist compact">
- <colgroup>
- <col align="left" valign="top">
- <col>
- </colgroup>
- <tbody><tr>
- <td><p><span class="term">Parameters:</span></p></td>
- <td><div class="variablelist"><table border="0" class="variablelist compact">
- <colgroup>
- <col align="left" valign="top">
- <col>
- </colgroup>
- <tbody>
- <tr>
- <td><p><span class="term"><code class="computeroutput">match_or_save</code></span></p></td>
- <td><p>if true, the pattern file will be read, otherwise it will be written </p></td>
- </tr>
- <tr>
- <td><p><span class="term"><code class="computeroutput">pattern_file_name</code></span></p></td>
- <td><p>indicates the name of the file for matching. If the string is empty, the standard input or output streams are used instead (depending on match_or_save) </p></td>
- </tr>
- <tr>
- <td><p><span class="term"><code class="computeroutput">text_or_binary</code></span></p></td>
- <td><p>if false, opens the stream in binary mode. Otherwise the stream is opened with default flags and the carriage returns are ignored. </p></td>
- </tr>
- </tbody>
- </table></div></td>
- </tr></tbody>
- </table></div>
- </li>
- <li class="listitem"><pre class="literallayout"><a name="idm46279113076704-bb"></a><span class="special">~</span><span class="identifier">output_test_stream</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre></li>
- </ol></div>
- </div>
- <div class="refsect2">
- <a name="idm45313886602672"></a><h3>
- <a name="idm46279113100192-bb"></a><code class="computeroutput">output_test_stream</code> public member functions</h3>
- <div class="orderedlist"><ol class="orderedlist" type="1">
- <li class="listitem">
- <pre class="literallayout"><span class="keyword">virtual</span> <a class="link" href="assertion_result.html" title="Class assertion_result">assertion_result</a> <a name="idm46279113099632-bb"></a><span class="identifier">is_empty</span><span class="special">(</span><span class="keyword">bool</span> flush_stream <span class="special">=</span> <span class="keyword">true</span><span class="special">)</span><span class="special">;</span></pre>Checks if the stream is empty. <p>
- </p>
- <div class="variablelist"><table border="0" class="variablelist compact">
- <colgroup>
- <col align="left" valign="top">
- <col>
- </colgroup>
- <tbody><tr>
- <td><p><span class="term">Parameters:</span></p></td>
- <td><div class="variablelist"><table border="0" class="variablelist compact">
- <colgroup>
- <col align="left" valign="top">
- <col>
- </colgroup>
- <tbody><tr>
- <td><p><span class="term"><code class="computeroutput">flush_stream</code></span></p></td>
- <td><p>if true, flushes the stream after the call </p></td>
- </tr></tbody>
- </table></div></td>
- </tr></tbody>
- </table></div>
- </li>
- <li class="listitem">
- <pre class="literallayout"><span class="keyword">virtual</span> <a class="link" href="assertion_result.html" title="Class assertion_result">assertion_result</a>
- <a name="idm46279113096240-bb"></a><span class="identifier">check_length</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> length<span class="special">,</span> <span class="keyword">bool</span> flush_stream <span class="special">=</span> <span class="keyword">true</span><span class="special">)</span><span class="special">;</span></pre>Checks the length of the stream. <p>
- </p>
- <div class="variablelist"><table border="0" class="variablelist compact">
- <colgroup>
- <col align="left" valign="top">
- <col>
- </colgroup>
- <tbody><tr>
- <td><p><span class="term">Parameters:</span></p></td>
- <td><div class="variablelist"><table border="0" class="variablelist compact">
- <colgroup>
- <col align="left" valign="top">
- <col>
- </colgroup>
- <tbody>
- <tr>
- <td><p><span class="term"><code class="computeroutput">flush_stream</code></span></p></td>
- <td><p>if true, flushes the stream after the call. Set to false to call additional checks on the same content. </p></td>
- </tr>
- <tr>
- <td><p><span class="term"><code class="computeroutput">length</code></span></p></td>
- <td><p>target length </p></td>
- </tr>
- </tbody>
- </table></div></td>
- </tr></tbody>
- </table></div>
- </li>
- <li class="listitem">
- <pre class="literallayout"><span class="keyword">virtual</span> <a class="link" href="assertion_result.html" title="Class assertion_result">assertion_result</a> <a name="idm46279113091680-bb"></a><span class="identifier">is_equal</span><span class="special">(</span><span class="identifier">const_string</span> arg_<span class="special">,</span> <span class="keyword">bool</span> flush_stream <span class="special">=</span> <span class="keyword">true</span><span class="special">)</span><span class="special">;</span></pre>Checks the content of the stream against a string. <p>
- </p>
- <div class="variablelist"><table border="0" class="variablelist compact">
- <colgroup>
- <col align="left" valign="top">
- <col>
- </colgroup>
- <tbody><tr>
- <td><p><span class="term">Parameters:</span></p></td>
- <td><div class="variablelist"><table border="0" class="variablelist compact">
- <colgroup>
- <col align="left" valign="top">
- <col>
- </colgroup>
- <tbody>
- <tr>
- <td><p><span class="term"><code class="computeroutput">arg_</code></span></p></td>
- <td><p>the target stream </p></td>
- </tr>
- <tr>
- <td><p><span class="term"><code class="computeroutput">flush_stream</code></span></p></td>
- <td><p>if true, flushes the stream after the call. </p></td>
- </tr>
- </tbody>
- </table></div></td>
- </tr></tbody>
- </table></div>
- </li>
- <li class="listitem">
- <pre class="literallayout"><span class="keyword">virtual</span> <a class="link" href="assertion_result.html" title="Class assertion_result">assertion_result</a> <a name="idm46279113087168-bb"></a><span class="identifier">match_pattern</span><span class="special">(</span><span class="keyword">bool</span> flush_stream <span class="special">=</span> <span class="keyword">true</span><span class="special">)</span><span class="special">;</span></pre>Checks the content of the stream against a pattern file. <p>
- </p>
- <div class="variablelist"><table border="0" class="variablelist compact">
- <colgroup>
- <col align="left" valign="top">
- <col>
- </colgroup>
- <tbody><tr>
- <td><p><span class="term">Parameters:</span></p></td>
- <td><div class="variablelist"><table border="0" class="variablelist compact">
- <colgroup>
- <col align="left" valign="top">
- <col>
- </colgroup>
- <tbody><tr>
- <td><p><span class="term"><code class="computeroutput">flush_stream</code></span></p></td>
- <td><p>if true, flushes/resets the stream after the call. </p></td>
- </tr></tbody>
- </table></div></td>
- </tr></tbody>
- </table></div>
- </li>
- <li class="listitem">
- <pre class="literallayout"><span class="keyword">void</span> <a name="idm46279113083744-bb"></a><span class="identifier">flush</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>Flushes the stream. </li>
- </ol></div>
- </div>
- <div class="refsect2">
- <a name="idm45313886547664"></a><h3>
- <a name="idm46279113076416-bb"></a><code class="computeroutput">output_test_stream</code> protected member functions</h3>
- <div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
- <pre class="literallayout"><span class="keyword">virtual</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <a name="idm46279113075840-bb"></a><span class="identifier">get_stream_string_representation</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Returns the string representation of the stream. <p>May be overriden in order to mutate the string before the matching operations. </p>
- </li></ol></div>
- </div>
- <div class="refsect2">
- <a name="idm45313886538128"></a><h3>
- <a name="idm46279113073472-bb"></a><code class="computeroutput">output_test_stream</code> private member functions</h3>
- <div class="orderedlist"><ol class="orderedlist" type="1">
- <li class="listitem">
- <pre class="literallayout"><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <a name="idm46279113072896-bb"></a><span class="identifier">length</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>Length of the stream. </li>
- <li class="listitem">
- <pre class="literallayout"><span class="keyword">virtual</span> <span class="keyword">void</span> <a name="idm46279113071760-bb"></a><span class="identifier">sync</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>Synching the stream into an internal string representation. </li>
- </ol></div>
- </div>
- </div>
- </div>
- <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
- <td align="left"></td>
- <td align="right"><div class="copyright-footer">Copyright © 2001-2019 Boost.Test
- contributors<p>
- 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" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
- </p>
- </div></td>
- </tr></table>
- <hr>
- <div class="spirit-nav">
- <a accesskey="p" href="../../header/boost/test/tools/output_test_stream_hpp.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../header/boost/test/tools/output_test_stream_hpp.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../../header/boost/test/tree/observer_hpp.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
- </div>
- </body>
- </html>
|