📄 _portability_8h-source.html
字号:
00087 <span class="preprocessor"># define CPPUNIT_STATIC_CAST( TargetType, pointer ) \</span>00088 <span class="preprocessor"> static_cast<TargetType>( pointer )</span>00089 <span class="preprocessor"></span><span class="preprocessor">#else // defined( CPPUNIT_HAVE_CPP_CAST )</span><a name="l00090"></a><a class="code" href="_portability_8h.html#a4">00090</a> <span class="preprocessor"></span><span class="preprocessor"># define CPPUNIT_CONST_CAST( TargetType, pointer ) \</span>00091 <span class="preprocessor"> ((TargetType)( pointer ))</span><a name="l00092"></a><a class="code" href="_portability_8h.html#a5">00092</a> <span class="preprocessor"></span><span class="preprocessor"># define CPPUNIT_STATIC_CAST( TargetType, pointer ) \</span>00093 <span class="preprocessor"> ((TargetType)( pointer ))</span>00094 <span class="preprocessor"></span><span class="preprocessor">#endif // defined( CPPUNIT_HAVE_CPP_CAST )</span>00095 <span class="preprocessor"></span>00096 <span class="comment">// If CPPUNIT_NO_STD_NAMESPACE is defined then STL are in the global space.</span>00097 <span class="comment">// => Define macro 'std' to nothing</span>00098 <span class="preprocessor">#if defined(CPPUNIT_NO_STD_NAMESPACE)</span>00099 <span class="preprocessor"></span><span class="preprocessor"># undef std</span>00100 <span class="preprocessor"></span><span class="preprocessor"># define std</span>00101 <span class="preprocessor"></span><span class="preprocessor">#endif // defined(CPPUNIT_NO_STD_NAMESPACE)</span>00102 <span class="preprocessor"></span>00103 <span class="comment">// If CPPUNIT_NO_NAMESPACE is defined, then put CppUnit classes in the</span>00104 <span class="comment">// global namespace: the compiler does not support namespace.</span>00105 <span class="preprocessor">#if defined(CPPUNIT_NO_NAMESPACE)</span>00106 <span class="preprocessor"></span><span class="preprocessor"># define CPPUNIT_NS_BEGIN</span>00107 <span class="preprocessor"></span><span class="preprocessor"># define CPPUNIT_NS_END</span>00108 <span class="preprocessor"></span><span class="preprocessor"># define CPPUNIT_NS</span>00109 <span class="preprocessor"></span><span class="preprocessor">#else // defined(CPPUNIT_NO_NAMESPACE)</span><a name="l00110"></a><a class="code" href="_portability_8h.html#a6">00110</a> <span class="preprocessor"></span><span class="preprocessor"># define CPPUNIT_NS_BEGIN namespace CppUnit {</span><a name="l00111"></a><a class="code" href="_portability_8h.html#a7">00111</a> <span class="preprocessor"></span><span class="preprocessor"># define CPPUNIT_NS_END }</span><a name="l00112"></a><a class="code" href="_portability_8h.html#a8">00112</a> <span class="preprocessor"></span><span class="preprocessor"># define CPPUNIT_NS CppUnit</span>00113 <span class="preprocessor"></span><span class="preprocessor">#endif // defined(CPPUNIT_NO_NAMESPACE)</span>00114 <span class="preprocessor"></span><a name="l00125"></a><a class="code" href="_portability_8h.html#a9">00125</a> <span class="preprocessor">#define CPPUNIT_STRINGIZE( symbol ) _CPPUNIT_DO_STRINGIZE( symbol )</span>00126 <span class="preprocessor"></span><a name="l00128"></a><a class="code" href="_portability_8h.html#a10">00128</a> <span class="preprocessor">#define _CPPUNIT_DO_STRINGIZE( symbol ) #symbol</span>00129 <span class="preprocessor"></span><a name="l00148"></a><a class="code" href="_portability_8h.html#a11">00148</a> <span class="preprocessor">#define CPPUNIT_JOIN( symbol1, symbol2 ) _CPPUNIT_DO_JOIN( symbol1, symbol2 )</span>00149 <span class="preprocessor"></span><a name="l00151"></a><a class="code" href="_portability_8h.html#a12">00151</a> <span class="preprocessor">#define _CPPUNIT_DO_JOIN( symbol1, symbol2 ) _CPPUNIT_DO_JOIN2( symbol1, symbol2 )</span>00152 <span class="preprocessor"></span><a name="l00154"></a><a class="code" href="_portability_8h.html#a13">00154</a> <span class="preprocessor">#define _CPPUNIT_DO_JOIN2( symbol1, symbol2 ) symbol1##symbol2</span>00155 <span class="preprocessor"></span><a name="l00160"></a><a class="code" href="_portability_8h.html#a14">00160</a> <span class="preprocessor">#define CPPUNIT_MAKE_UNIQUE_NAME( prefix ) CPPUNIT_JOIN( prefix, __LINE__ )</span>00161 <span class="preprocessor"></span>00164 <span class="preprocessor">#if !defined(CPPUNIT_WRAP_COLUMN)</span><a name="l00165"></a><a class="code" href="_portability_8h.html#a15">00165</a> <span class="preprocessor"></span><span class="preprocessor"># define CPPUNIT_WRAP_COLUMN 79</span>00166 <span class="preprocessor"></span><span class="preprocessor">#endif</span>00167 <span class="preprocessor"></span>00168 00169 <span class="comment">/* perform portability hacks */</span>00170 00171 00172 <span class="comment">/* Define CPPUNIT_SSTREAM as a stream with a "std::string str()"</span>00173 <span class="comment"> * method.</span>00174 <span class="comment"> */</span>00175 <span class="preprocessor">#if CPPUNIT_HAVE_SSTREAM</span>00176 <span class="preprocessor"></span><span class="preprocessor"># include <sstream></span>00177 <a class="code" href="_portability_8h.html#a6">CPPUNIT_NS_BEGIN</a>00178 00179 <span class="keyword">typedef</span> std::ostringstream OStringStream;00180 00181 <a class="code" href="_portability_8h.html#a7">CPPUNIT_NS_END</a>00182 <span class="preprocessor">#elif CPPUNIT_HAVE_CLASS_STRSTREAM</span>00183 <span class="preprocessor"></span><span class="preprocessor"># include <string></span>00184 <span class="preprocessor"># if CPPUNIT_HAVE_STRSTREAM</span>00185 <span class="preprocessor"></span><span class="preprocessor"># include <strstream></span>00186 <span class="preprocessor"># else // CPPUNIT_HAVE_STRSTREAM</span>00187 <span class="preprocessor"></span><span class="preprocessor"># include <strstream.h></span>00188 <span class="preprocessor"># endif // CPPUNIT_HAVE_CLASS_STRSTREAM</span>00189 <span class="preprocessor"></span>00190 <a class="code" href="_portability_8h.html#a6">CPPUNIT_NS_BEGIN</a>00191 00192 <span class="keyword">class </span>OStringStream : <span class="keyword">public</span> std::ostrstream 00193 {00194 <span class="keyword">public</span>:00195 std::string str()00196 {00197 <span class="comment">// (*this) << '\0';</span>00198 <span class="comment">// std::string msg(std::ostrstream::str());</span>00199 <span class="comment">// std::ostrstream::freeze(false);</span>00200 <span class="comment">// return msg;</span>00201 <span class="comment">// Alternative implementation that don't rely on freeze which is not</span>00202 <span class="comment">// available on some platforms:</span>00203 <span class="keywordflow">return</span> std::string( std::ostrstream::str(), pcount() );00204 }00205 };00206 00207 <a class="code" href="_portability_8h.html#a7">CPPUNIT_NS_END</a>00208 <span class="preprocessor">#else // CPPUNIT_HAVE_CLASS_STRSTREAM</span>00209 <span class="preprocessor"></span><span class="preprocessor"># error Cannot define CppUnit::OStringStream.</span>00210 <span class="preprocessor"></span><span class="preprocessor">#endif // CPPUNIT_HAVE_SSTREAM</span>00211 <span class="preprocessor"></span>00212 00213 <span class="preprocessor">#endif // CPPUNIT_PORTABILITY_H</span></div></pre><hr><table width="100%"> <tr> <td width="10%" align="left" valign="center"> <a href="http://sourceforge.net"> <img src="http://sourceforge.net/sflogo.php?group_id=11795" width="88" height="31" border="0" alt="SourceForge Logo"></a> </td> <td width="20%" align="left" valign="center"> hosts this site. </td> <td> </td> <td align="right" valign="center"> Send comments to:<br> <a href="mailto:cppunit-devel@lists.sourceforge.net">CppUnit Developers</a> </td> </tr></table></body> </html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -