Sophie

Sophie

distrib > Fedora > 14 > i386 > by-pkgid > 5fc82cd2dfd40b1b8acca39dd2860281 > files > 38

log4cpp-1.0-4.fc12.i686.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>log4cpp: CategoryStream.hh Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.9 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
<h1>CategoryStream.hh</h1><a href="CategoryStream_8hh.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * CategoryStream.hh</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright 2001, LifeLine Networks BV (www.lifeline.nl). All rights reserved.</span>
<a name="l00005"></a>00005 <span class="comment"> * Copyright 2001, Bastiaan Bakker. All rights reserved.</span>
<a name="l00006"></a>00006 <span class="comment"> *</span>
<a name="l00007"></a>00007 <span class="comment"> * See the COPYING file for the terms of usage and distribution.</span>
<a name="l00008"></a>00008 <span class="comment"> */</span>
<a name="l00009"></a>00009 
<a name="l00010"></a>00010 <span class="preprocessor">#ifndef _LOG4CPP_CATEGORYSTREAM_HH</span>
<a name="l00011"></a>00011 <span class="preprocessor"></span><span class="preprocessor">#define _LOG4CPP_CATEGORYSTREAM_HH</span>
<a name="l00012"></a>00012 <span class="preprocessor"></span>
<a name="l00013"></a>00013 <span class="preprocessor">#include &lt;<a class="code" href="Portability_8hh.html">log4cpp/Portability.hh</a>&gt;</span>
<a name="l00014"></a>00014 <span class="preprocessor">#include &lt;<a class="code" href="Priority_8hh.html">log4cpp/Priority.hh</a>&gt;</span>
<a name="l00015"></a>00015 <span class="preprocessor">#include &lt;ios&gt;</span>
<a name="l00016"></a>00016 <span class="preprocessor">#ifdef LOG4CPP_HAVE_SSTREAM</span>
<a name="l00017"></a>00017 <span class="preprocessor"></span><span class="preprocessor">#include &lt;sstream&gt;</span>
<a name="l00018"></a>00018 <span class="preprocessor">#endif</span>
<a name="l00019"></a>00019 <span class="preprocessor"></span><span class="preprocessor">#include &lt;<a class="code" href="Manipulator_8hh.html">log4cpp/Manipulator.hh</a>&gt;</span>
<a name="l00020"></a>00020 
<a name="l00021"></a>00021 <span class="keyword">namespace </span>log4cpp {
<a name="l00022"></a>00022 
<a name="l00023"></a><a class="code" href="namespacelog4cpp.html#c1bf97ac55304dbd4f0dd90a689ccae7">00023</a>     <span class="keyword">class </span><a class="code" href="Export_8hh.html#30f9ff9641fa394781f52398a8312437">LOG4CPP_EXPORT</a> <a class="code" href="classlog4cpp_1_1Category.html" title="This is the central class in the log4j package.">Category</a>;
<a name="l00024"></a><a class="code" href="namespacelog4cpp.html#8dc6ac8c1aa59f096ea32cf1229cff0b">00024</a>     <span class="keyword">class </span><a class="code" href="Export_8hh.html#30f9ff9641fa394781f52398a8312437">LOG4CPP_EXPORT</a> <a class="code" href="classlog4cpp_1_1CategoryStream.html" title="This class enables streaming simple types and objects to a category.">CategoryStream</a>;    
<a name="l00028"></a>00028     <a class="code" href="Export_8hh.html#30f9ff9641fa394781f52398a8312437">LOG4CPP_EXPORT</a> <a class="code" href="classlog4cpp_1_1CategoryStream.html" title="This class enables streaming simple types and objects to a category.">CategoryStream</a>&amp; <a class="code" href="namespacelog4cpp.html#8f652ffff32d18b50c638654ae58f621" title="eol manipulator">eol</a> (<a class="code" href="classlog4cpp_1_1CategoryStream.html" title="This class enables streaming simple types and objects to a category.">CategoryStream</a>&amp; os);
<a name="l00029"></a>00029 
<a name="l00033"></a>00033     <a class="code" href="Export_8hh.html#30f9ff9641fa394781f52398a8312437">LOG4CPP_EXPORT</a> <a class="code" href="classlog4cpp_1_1CategoryStream.html" title="This class enables streaming simple types and objects to a category.">CategoryStream</a>&amp; <a class="code" href="namespacelog4cpp.html#cbf828259e8eeb5d15aa2b5746ef8c23" title="left manipulator">left</a> (<a class="code" href="classlog4cpp_1_1CategoryStream.html" title="This class enables streaming simple types and objects to a category.">CategoryStream</a>&amp; os);
<a name="l00034"></a>00034 
<a name="l00039"></a><a class="code" href="classlog4cpp_1_1CategoryStream.html">00039</a>     <span class="keyword">class </span><a class="code" href="Export_8hh.html#30f9ff9641fa394781f52398a8312437">LOG4CPP_EXPORT</a> <a class="code" href="classlog4cpp_1_1CategoryStream.html" title="This class enables streaming simple types and objects to a category.">CategoryStream</a> {
<a name="l00040"></a>00040         <span class="keyword">public</span>:
<a name="l00041"></a>00041 
<a name="l00048"></a>00048         <a class="code" href="namespacelog4cpp.html#8dc6ac8c1aa59f096ea32cf1229cff0b">CategoryStream</a>(<a class="code" href="classlog4cpp_1_1Category.html" title="This is the central class in the log4j package.">Category</a>&amp; category, <a class="code" href="classlog4cpp_1_1Priority.html#19c2e47a94a531d3028f7c545671ff72" title="The type of Priority Values.">Priority::Value</a> priority);
<a name="l00049"></a>00049 
<a name="l00053"></a>00053         ~<a class="code" href="classlog4cpp_1_1CategoryStream.html" title="This class enables streaming simple types and objects to a category.">CategoryStream</a>();
<a name="l00054"></a>00054         
<a name="l00059"></a><a class="code" href="classlog4cpp_1_1CategoryStream.html#8f6a60a93b3d359bc13fd3427a832be8">00059</a>         <span class="keyword">inline</span> <a class="code" href="classlog4cpp_1_1Category.html" title="This is the central class in the log4j package.">Category</a>&amp; <a class="code" href="classlog4cpp_1_1CategoryStream.html#8f6a60a93b3d359bc13fd3427a832be8" title="Returns the destination Category for this stream.">getCategory</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> _category; };
<a name="l00060"></a>00060 
<a name="l00065"></a><a class="code" href="classlog4cpp_1_1CategoryStream.html#7ef550ca8278a00b7d10f88886445613">00065</a>         <span class="keyword">inline</span> <a class="code" href="classlog4cpp_1_1Priority.html#19c2e47a94a531d3028f7c545671ff72" title="The type of Priority Values.">Priority::Value</a> <a class="code" href="classlog4cpp_1_1CategoryStream.html#7ef550ca8278a00b7d10f88886445613" title="Returns the priority for this stream.">getPriority</a>() <span class="keyword">const</span> throw() { 
<a name="l00066"></a>00066             <span class="keywordflow">return</span> _priority; 
<a name="l00067"></a>00067         };
<a name="l00068"></a>00068 
<a name="l00073"></a>00073         <span class="keywordtype">void</span> flush();
<a name="l00074"></a>00074 
<a name="l00080"></a><a class="code" href="classlog4cpp_1_1CategoryStream.html#19a62e6ea2e093a36eca048b7ff1ccdb">00080</a>                 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt; <a class="code" href="classlog4cpp_1_1CategoryStream.html" title="This class enables streaming simple types and objects to a category.">CategoryStream</a>&amp; <a class="code" href="classlog4cpp_1_1CategoryStream.html#19a62e6ea2e093a36eca048b7ff1ccdb" title="Stream in arbitrary types and objects.">operator&lt;&lt;</a>(<span class="keyword">const</span> T&amp; t) {
<a name="l00081"></a>00081             <span class="keywordflow">if</span> (getPriority() != <a class="code" href="classlog4cpp_1_1Priority.html#e1b1901a7b2bea8190b286684eecc1afebdf006bbefb65f1d654594992ac4e4f">Priority::NOTSET</a>) {
<a name="l00082"></a>00082                 <span class="keywordflow">if</span> (!_buffer) {
<a name="l00083"></a>00083                                         <span class="keywordflow">if</span> (!(_buffer = <span class="keyword">new</span> <a class="code" href="classstd_1_1ostringstream.html">std::ostringstream</a>)) {
<a name="l00084"></a>00084                         <span class="comment">// XXX help help help</span>
<a name="l00085"></a>00085                     }
<a name="l00086"></a>00086                 }
<a name="l00087"></a>00087                 (*_buffer) &lt;&lt; t;
<a name="l00088"></a>00088             }
<a name="l00089"></a>00089             <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00090"></a>00090         }
<a name="l00091"></a>00091         
<a name="l00092"></a>00092         <span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt; 
<a name="l00093"></a><a class="code" href="classlog4cpp_1_1CategoryStream.html#e71d59232d13a30fa971a48eb17c3d6b">00093</a>         <a class="code" href="classlog4cpp_1_1CategoryStream.html" title="This class enables streaming simple types and objects to a category.">CategoryStream</a>&amp; <a class="code" href="classlog4cpp_1_1CategoryStream.html#e71d59232d13a30fa971a48eb17c3d6b">operator&lt;&lt;</a>(<span class="keyword">const</span> std::string&amp; t) {
<a name="l00094"></a>00094             <span class="keywordflow">if</span> (getPriority() != <a class="code" href="classlog4cpp_1_1Priority.html#e1b1901a7b2bea8190b286684eecc1afebdf006bbefb65f1d654594992ac4e4f">Priority::NOTSET</a>) {
<a name="l00095"></a>00095                 <span class="keywordflow">if</span> (!_buffer) {
<a name="l00096"></a>00096                     <span class="keywordflow">if</span> (!(_buffer = <span class="keyword">new</span> <a class="code" href="classstd_1_1ostringstream.html">std::ostringstream</a>)) {
<a name="l00097"></a>00097                         <span class="comment">// XXX help help help</span>
<a name="l00098"></a>00098                     }
<a name="l00099"></a>00099                 }
<a name="l00100"></a>00100                 (*_buffer) &lt;&lt; t;
<a name="l00101"></a>00101             }
<a name="l00102"></a>00102             <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00103"></a>00103         }
<a name="l00104"></a>00104 <span class="preprocessor">#if LOG4CPP_HAS_WCHAR_T != 0</span>
<a name="l00105"></a>00105 <span class="preprocessor"></span>        <span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt; 
<a name="l00106"></a>00106         <a class="code" href="classlog4cpp_1_1CategoryStream.html" title="This class enables streaming simple types and objects to a category.">CategoryStream</a>&amp; operator&lt;&lt;(<span class="keyword">const</span> std::wstring&amp; t) {
<a name="l00107"></a>00107             <span class="keywordflow">if</span> (getPriority() != <a class="code" href="classlog4cpp_1_1Priority.html#e1b1901a7b2bea8190b286684eecc1afebdf006bbefb65f1d654594992ac4e4f">Priority::NOTSET</a>) {
<a name="l00108"></a>00108                 <span class="keywordflow">if</span> (!_wbuffer) {
<a name="l00109"></a>00109                     <span class="keywordflow">if</span> (!(_wbuffer = <span class="keyword">new</span> std::wostringstream)) {
<a name="l00110"></a>00110                         <span class="comment">// XXX help help help</span>
<a name="l00111"></a>00111                     }
<a name="l00112"></a>00112                 }
<a name="l00113"></a>00113                 (*_wbuffer) &lt;&lt; t;
<a name="l00114"></a>00114             }
<a name="l00115"></a>00115             <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00116"></a>00116         }
<a name="l00117"></a>00117 <span class="preprocessor">#endif</span>
<a name="l00118"></a>00118 <span class="preprocessor"></span>
<a name="l00121"></a>00121                 std::streamsize width(std::streamsize wide );
<a name="l00122"></a>00122 
<a name="l00123"></a>00123 
<a name="l00124"></a>00124         <span class="keyword">private</span>:
<a name="l00125"></a>00125         <a class="code" href="namespacelog4cpp.html#c1bf97ac55304dbd4f0dd90a689ccae7">Category</a>&amp; _category;
<a name="l00126"></a>00126         <a class="code" href="classlog4cpp_1_1Priority.html#19c2e47a94a531d3028f7c545671ff72" title="The type of Priority Values.">Priority::Value</a> _priority;
<a name="l00127"></a>00127         <span class="keyword">union </span>{
<a name="l00128"></a><a class="code" href="classlog4cpp_1_1CategoryStream.html#1015703b021c3e5114d46242d2adfa68">00128</a>             <a class="code" href="classstd_1_1ostringstream.html">std::ostringstream</a>* _buffer;
<a name="l00129"></a>00129 <span class="preprocessor">#if LOG4CPP_HAS_WCHAR_T != 0</span>
<a name="l00130"></a>00130 <span class="preprocessor"></span>            std::wostringstream* _wbuffer;
<a name="l00131"></a>00131 <span class="preprocessor">#endif</span>
<a name="l00132"></a>00132 <span class="preprocessor"></span>        };
<a name="l00133"></a>00133 
<a name="l00134"></a>00134         <span class="keyword">public</span>:
<a name="l00135"></a><a class="code" href="classlog4cpp_1_1CategoryStream.html#7f916b3d34c0c20d0238efc70b8bd4fe">00135</a>         <span class="keyword">typedef</span> <a class="code" href="classlog4cpp_1_1CategoryStream.html" title="This class enables streaming simple types and objects to a category.">CategoryStream</a>&amp; (*cspf) (<a class="code" href="classlog4cpp_1_1CategoryStream.html" title="This class enables streaming simple types and objects to a category.">CategoryStream</a>&amp;);
<a name="l00136"></a>00136 
<a name="l00137"></a>00137         <a class="code" href="classlog4cpp_1_1CategoryStream.html" title="This class enables streaming simple types and objects to a category.">CategoryStream</a>&amp; operator&lt;&lt; (cspf);
<a name="l00138"></a>00138         <a class="code" href="Export_8hh.html#30f9ff9641fa394781f52398a8312437">LOG4CPP_EXPORT</a> <span class="keyword">friend</span> <a class="code" href="classlog4cpp_1_1CategoryStream.html" title="This class enables streaming simple types and objects to a category.">CategoryStream</a>&amp; <a class="code" href="namespacelog4cpp.html#8f652ffff32d18b50c638654ae58f621" title="eol manipulator">eol</a> (<a class="code" href="classlog4cpp_1_1CategoryStream.html" title="This class enables streaming simple types and objects to a category.">CategoryStream</a>&amp; os);
<a name="l00139"></a>00139         <a class="code" href="Export_8hh.html#30f9ff9641fa394781f52398a8312437">LOG4CPP_EXPORT</a> <span class="keyword">friend</span> <a class="code" href="classlog4cpp_1_1CategoryStream.html" title="This class enables streaming simple types and objects to a category.">CategoryStream</a>&amp; <a class="code" href="namespacelog4cpp.html#cbf828259e8eeb5d15aa2b5746ef8c23" title="left manipulator">left</a> (<a class="code" href="classlog4cpp_1_1CategoryStream.html" title="This class enables streaming simple types and objects to a category.">CategoryStream</a>&amp; os);
<a name="l00140"></a>00140    };
<a name="l00141"></a>00141 }
<a name="l00142"></a>00142 <span class="preprocessor">#endif // _LOG4CPP_CATEGORYSTREAM_HH</span>
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Jul 26 19:34:50 2009 for log4cpp by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.9 </small></address>
</body>
</html>