File: CategoryStream_8hh-source.html

package info (click to toggle)
log4cpp-doc 1.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,528 kB
  • sloc: makefile: 10
file content (131 lines) | stat: -rw-r--r-- 12,934 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<!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="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.2 -->
<div class="tabs">
  <ul>
    <li><a href="index.html"><span>Main&nbsp;Page</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>
    <li><a href="pages.html"><span>Related&nbsp;Pages</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> Category;
<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> CategoryStream;    
<a name="l00028"></a>00028     <a class="code" href="Export_8hh.html#30f9ff9641fa394781f52398a8312437">LOG4CPP_EXPORT</a> CategoryStream&amp; <a class="code" href="namespacelog4cpp.html#8f652ffff32d18b50c638654ae58f621" title="eol manipulator">eol</a> (CategoryStream&amp; os);
<a name="l00029"></a>00029 
<a name="l00033"></a>00033     <a class="code" href="Export_8hh.html#30f9ff9641fa394781f52398a8312437">LOG4CPP_EXPORT</a> CategoryStream&amp; <a class="code" href="namespacelog4cpp.html#cbf828259e8eeb5d15aa2b5746ef8c23" title="left manipulator">left</a> (CategoryStream&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> CategoryStream {
<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>(Category&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         ~CategoryStream();
<a name="l00054"></a>00054         
<a name="l00059"></a><a class="code" href="classlog4cpp_1_1CategoryStream.html#aa67f18b9e9cb87294d93a65ed8e41e2">00059</a>         <span class="keyword">inline</span> Category&amp; getCategory()<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#fda2c9e96e19121bdc401f27ffc7a82c">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> getPriority() <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; CategoryStream&amp; <a class="code" href="namespacelog4cpp.html#2403179a049464377750492b05c780d2">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>         CategoryStream&amp; <a class="code" href="namespacelog4cpp.html#2403179a049464377750492b05c780d2">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         CategoryStream&amp; <a class="code" href="namespacelog4cpp.html#2403179a049464377750492b05c780d2">operator&lt;&lt;</a>(<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         Category&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#04886609f2214221a12c6b07aed872fb">00135</a>         <span class="keyword">typedef</span> CategoryStream&amp; (*cspf) (CategoryStream&amp;);
<a name="l00136"></a>00136 
<a name="l00137"></a>00137         CategoryStream&amp; <a class="code" href="namespacelog4cpp.html#2403179a049464377750492b05c780d2">operator&lt;&lt; </a>(cspf);
<a name="l00138"></a>00138         <a class="code" href="Export_8hh.html#30f9ff9641fa394781f52398a8312437">LOG4CPP_EXPORT</a> <span class="keyword">friend</span> CategoryStream&amp; <a class="code" href="namespacelog4cpp.html#8f652ffff32d18b50c638654ae58f621" title="eol manipulator">eol</a> (CategoryStream&amp; os);
<a name="l00139"></a>00139         <a class="code" href="Export_8hh.html#30f9ff9641fa394781f52398a8312437">LOG4CPP_EXPORT</a> <span class="keyword">friend</span> CategoryStream&amp; <a class="code" href="namespacelog4cpp.html#cbf828259e8eeb5d15aa2b5746ef8c23" title="left manipulator">left</a> (CategoryStream&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><hr size="1"><address style="text-align: right;"><small>Generated on Mon Sep 3 11:54:29 2007 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.2 </small></address>
</body>
</html>