?? class_compiler_outputter.html
字號:
<html><head><title>CppUnit - The Unit Testing Library</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body bgcolor="#ffffff"> <table width="100%"> <tr> <td width="40%" align="left" valign="center"> <a href="http://sourceforge.net/projects/cppunit"> CppUnit project page </a> </td> <td> <a href="FAQ">FAQ</a> </td> <td width="40%" align="right" valign="center"> <a href="http://cppunit.sourceforge.net">CppUnit home page</a> </td> </tr></table><hr><!-- Generated by Doxygen 1.3.7 --><div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="globals.html">File Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div><h1>CompilerOutputter Class Reference<br><small>[<a class="el" href="group___writing_test_result.html">Writing test result</a>]</small></h1>Outputs a <a class="el" href="class_test_result_collector.html">TestResultCollector</a> in a compiler compatible format. <a href="#_details">More...</a><p><code>#include <<a class="el" href="_compiler_outputter_8h-source.html">CompilerOutputter.h</a>></code><p><p>Inheritance diagram for CompilerOutputter:<p><center><img src="class_compiler_outputter.png" usemap="#CompilerOutputter_map" border="0" alt=""></center><map name="CompilerOutputter_map"><area href="class_outputter.html" alt="Outputter" shape="rect" coords="0,0,114,24"></map><a href="class_compiler_outputter-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0><tr><td></td></tr><tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="class_compiler_outputter.html#a0">CompilerOutputter</a> (<a class="el" href="class_test_result_collector.html">TestResultCollector</a> *result, std::ostream &stream, const std::string &locationFormat=CPPUNIT_COMPILER_LOCATION_FORMAT)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Constructs a CompilerOutputter object. <a href="#a0"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>virtual </td><td class="memItemRight" valign=bottom><a class="el" href="class_compiler_outputter.html#a1">~CompilerOutputter</a> ()</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Destructor. <a href="#a1"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="class_compiler_outputter.html#a2">setLocationFormat</a> (const std::string &locationFormat)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Sets the error location format. <a href="#a2"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="class_compiler_outputter.html#a3">write</a> ()</td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="class_compiler_outputter.html#a4">setNoWrap</a> ()</td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="class_compiler_outputter.html#a5">setWrapColumn</a> (int wrapColumn)</td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="class_compiler_outputter.html#a6">wrapColumn</a> () const</td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>virtual void </td><td class="memItemRight" valign=bottom><a class="el" href="class_compiler_outputter.html#a7">printSuccess</a> ()</td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>virtual void </td><td class="memItemRight" valign=bottom><a class="el" href="class_compiler_outputter.html#a8">printFailureReport</a> ()</td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>virtual void </td><td class="memItemRight" valign=bottom><a class="el" href="class_compiler_outputter.html#a9">printFailuresList</a> ()</td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>virtual void </td><td class="memItemRight" valign=bottom><a class="el" href="class_compiler_outputter.html#a10">printStatistics</a> ()</td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>virtual void </td><td class="memItemRight" valign=bottom><a class="el" href="class_compiler_outputter.html#a11">printFailureDetail</a> (<a class="el" href="class_test_failure.html">TestFailure</a> *failure)</td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>virtual void </td><td class="memItemRight" valign=bottom><a class="el" href="class_compiler_outputter.html#a12">printFailureLocation</a> (<a class="el" href="class_source_line.html">SourceLine</a> sourceLine)</td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>virtual void </td><td class="memItemRight" valign=bottom><a class="el" href="class_compiler_outputter.html#a13">printFailureType</a> (<a class="el" href="class_test_failure.html">TestFailure</a> *failure)</td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>virtual void </td><td class="memItemRight" valign=bottom><a class="el" href="class_compiler_outputter.html#a14">printFailedTestName</a> (<a class="el" href="class_test_failure.html">TestFailure</a> *failure)</td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>virtual void </td><td class="memItemRight" valign=bottom><a class="el" href="class_compiler_outputter.html#a15">printFailureMessage</a> (<a class="el" href="class_test_failure.html">TestFailure</a> *failure)</td></tr><tr><td colspan=2><br><h2>Static Public Member Functions</h2></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="class_compiler_outputter.html">CompilerOutputter</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="class_compiler_outputter.html#e0">defaultOutputter</a> (<a class="el" href="class_test_result_collector.html">TestResultCollector</a> *result, std::ostream &stream)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Creates an instance of an outputter that matches your current compiler. <a href="#e0"></a><br><br></td></tr><tr><td colspan=2><br><h2>Private Member Functions</h2></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="class_compiler_outputter.html#d0">CompilerOutputter</a> (const <a class="el" href="class_compiler_outputter.html">CompilerOutputter</a> &copy)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Prevents the use of the copy constructor. <a href="#d0"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="class_compiler_outputter.html#d1">operator=</a> (const <a class="el" href="class_compiler_outputter.html">CompilerOutputter</a> &copy)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Prevents the use of the copy operator. <a href="#d1"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>virtual bool </td><td class="memItemRight" valign=bottom><a class="el" href="class_compiler_outputter.html#d2">processLocationFormatCommand</a> (char command, const <a class="el" href="class_source_line.html">SourceLine</a> &sourceLine)</td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>virtual std::string </td><td class="memItemRight" valign=bottom><a class="el" href="class_compiler_outputter.html#d3">extractBaseName</a> (const std::string &fileName) const</td></tr><tr><td colspan=2><br><h2>Private Attributes</h2></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="class_test_result_collector.html">TestResultCollector</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="class_compiler_outputter.html#r0">m_result</a></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>std::ostream & </td><td class="memItemRight" valign=bottom><a class="el" href="class_compiler_outputter.html#r1">m_stream</a></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>std::string </td><td class="memItemRight" valign=bottom><a class="el" href="class_compiler_outputter.html#r2">m_locationFormat</a></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="class_compiler_outputter.html#r3">m_wrapColumn</a></td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2>Outputs a <a class="el" href="class_test_result_collector.html">TestResultCollector</a> in a compiler compatible format. <p>Printing the test results in a compiler compatible format (assertion location has the same format as compiler error), allow you to use your IDE to jump to the assertion failure. Location format can be customized (see setLocationFormat() ).<p>For example, when running the test in a post-build with VC++, if an assertion fails, you can jump to the assertion by pressing F4 (jump to next error).<p>Heres is an example of usage (from examples/cppunittest/CppUnitTestMain.cpp): <pre><div class="fragment"> <span class="keywordtype">int</span> main( <span class="keywordtype">int</span> argc, <span class="keywordtype">char</span>* argv[] ) { <span class="comment">// if command line contains "-selftest" then this is the post build check</span> <span class="comment">// => the output must be in the compiler error format.</span> <span class="keywordtype">bool</span> selfTest = (argc > 1) && (std::string(<span class="stringliteral">"-selftest"</span>) == argv[1]); CppUnit::TextUi::TestRunner runner; runner.addTest( CppUnitTest::suite() ); <span class="comment">// Add the top suite to the test runner</span> <span class="keywordflow">if</span> ( selfTest ) { <span class="comment">// Change the default outputter to a compiler error format outputter</span> <span class="comment">// The test runner owns the new outputter.</span> runner.setOutputter( <span class="keyword">new</span> CppUnit::CompilerOutputter( &runner.result(), std::cerr ) ); } <span class="comment">// Run the test and don't wait a key if post build check.</span> <span class="keywordtype">bool</span> wasSuccessful = runner.run( <span class="stringliteral">""</span>, !selfTest ); <span class="comment">// Return error code 1 if the one of test failed.</span> <span class="keywordflow">return</span> wasSuccessful ? 0 : 1; }</div></pre><p><hr><h2>Constructor & Destructor Documentation</h2><a class="anchor" name="a0" doxytag="CompilerOutputter::CompilerOutputter" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> CPPUNIT_NS_BEGIN CompilerOutputter::CompilerOutputter </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="class_test_result_collector.html">TestResultCollector</a> * </td> <td class="mdname" nowrap> <em>result</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap>std::ostream & </td> <td class="mdname" nowrap> <em>stream</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap>const std::string & </td> <td class="mdname" nowrap> <em>locationFormat</em> = <code>CPPUNIT_COMPILER_LOCATION_FORMAT</code></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Constructs a CompilerOutputter object. <p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign=top><em>result</em> </td><td>Result of the test run. </td></tr> <tr><td></td><td valign=top><em>stream</em> </td><td>Stream used to output test result. </td></tr> <tr><td></td><td valign=top><em>locationFormat</em> </td><td>Error location format used by your compiler. Default to <code>CPPUNIT_COMPILER_LOCATION_FORMAT</code> which is defined in the configuration file. See setLocationFormat() for detail. </td></tr> </table></dl><dl compact><dt><b>See also:</b></dt><dd>setLocationFormat(). </dd></dl> </td> </tr></table><a class="anchor" name="a1" doxytag="CompilerOutputter::~CompilerOutputter" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> CompilerOutputter::~<a class="el" href="class_compiler_outputter.html">CompilerOutputter</a> </td> <td class="md" valign="top">( </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap><code> [virtual]</code></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Destructor. <p> </td> </tr></table><a class="anchor" name="d0" doxytag="CompilerOutputter::CompilerOutputter" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> CompilerOutputter::CompilerOutputter </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">const <a class="el" href="class_compiler_outputter.html">CompilerOutputter</a> & </td> <td class="mdname1" valign="top" nowrap> <em>copy</em> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap><code> [private]</code></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Prevents the use of the copy constructor. <p> </td> </tr></table><hr><h2>Member Function Documentation</h2><a class="anchor" name="e0" doxytag="CompilerOutputter::defaultOutputter" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> <a class="el" href="class_compiler_outputter.html">CompilerOutputter</a> * CompilerOutputter::defaultOutputter </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="class_test_result_collector.html">TestResultCollector</a> * </td> <td class="mdname" nowrap> <em>result</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap>std::ostream & </td> <td class="mdname" nowrap> <em>stream</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"><code> [static]</code></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Creates an instance of an outputter that matches your current compiler. <p><dl compact><dt><b><a class="el" href="deprecated.html#_deprecated000008">Deprecated:</a></b></dt><dd>This class is specialized through parameterization instead of subclassing... Use <a class="el" href="class_compiler_outputter.html#a0">CompilerOutputter::CompilerOutputter</a> instead. </dd></dl> </td> </tr></table><a class="anchor" name="d3" doxytag="CompilerOutputter::extractBaseName" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> std::string CompilerOutputter::extractBaseName </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">const std::string & </td> <td class="mdname1" valign="top" nowrap> <em>fileName</em> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap> const<code> [private, virtual]</code></td> </tr>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -