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
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>log4cpp: CategoryStream.hh Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.2 -->
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="dirs.html">Directories</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>
<div class="nav">
<a class="el" href="dir_000001.html">include</a> / <a class="el" href="dir_000002.html">log4cpp</a></div>
<h1>CategoryStream.hh</h1><a href="CategoryStream_8hh.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="comment">/*</span>
00002 <span class="comment"> * CategoryStream.hh</span>
00003 <span class="comment"> *</span>
00004 <span class="comment"> * Copyright 2001, LifeLine Networks BV (www.lifeline.nl). All rights reserved.</span>
00005 <span class="comment"> * Copyright 2001, Bastiaan Bakker. All rights reserved.</span>
00006 <span class="comment"> *</span>
00007 <span class="comment"> * See the COPYING file for the terms of usage and distribution.</span>
00008 <span class="comment"> */</span>
00009
00010 <span class="preprocessor">#ifndef _LOG4CPP_CATEGORYSTREAM_HH</span>
00011 <span class="preprocessor"></span><span class="preprocessor">#define _LOG4CPP_CATEGORYSTREAM_HH</span>
00012 <span class="preprocessor"></span>
00013 <span class="preprocessor">#include <<a class="code" href="Portability_8hh.html">log4cpp/Portability.hh</a>></span>
00014 <span class="preprocessor">#include <<a class="code" href="Priority_8hh.html">log4cpp/Priority.hh</a>></span>
00015 <span class="preprocessor">#include <ios></span>
00016 <span class="preprocessor">#ifdef LOG4CPP_HAVE_SSTREAM</span>
00017 <span class="preprocessor"></span><span class="preprocessor">#include <sstream></span>
00018 <span class="preprocessor">#endif</span>
00019 <span class="preprocessor"></span><span class="preprocessor">#include <<a class="code" href="Manipulator_8hh.html">log4cpp/Manipulator.hh</a>></span>
00020
00021 <span class="keyword">namespace </span>log4cpp {
00022
<a name="l00023"></a><a class="code" href="namespacelog4cpp.html#a2">00023</a> <span class="keyword">class </span><a class="code" href="Export_8hh.html#a0">LOG4CPP_EXPORT</a> Category;
00024
<a name="l00029"></a><a class="code" href="classlog4cpp_1_1CategoryStream.html">00029</a> <span class="keyword">class </span><a class="code" href="Export_8hh.html#a0">LOG4CPP_EXPORT</a> CategoryStream {
00030 <span class="keyword">public</span>:
00031
<a name="l00036"></a><a class="code" href="classlog4cpp_1_1CategoryStream.html#w3">00036</a> <span class="keyword">typedef</span> <span class="keyword">enum</span> {
00037 ENDLINE = 0,
00038 EOL = 0
00039 } Separator;
00040
00047 CategoryStream(Category& category, <a class="code" href="classlog4cpp_1_1Priority.html#w0">Priority::Value</a> priority);
00048
00052 ~CategoryStream();
00053
<a name="l00058"></a><a class="code" href="classlog4cpp_1_1CategoryStream.html#a2">00058</a> <span class="keyword">inline</span> Category& getCategory()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> _category; };
00059
<a name="l00064"></a><a class="code" href="classlog4cpp_1_1CategoryStream.html#a3">00064</a> <span class="keyword">inline</span> <a class="code" href="classlog4cpp_1_1Priority.html#w0">Priority::Value</a> getPriority() const throw() {
00065 <span class="keywordflow">return</span> _priority;
00066 };
00067
00075 CategoryStream& <a class="code" href="namespacelog4cpp.html#a7">operator<<</a>(Separator separator);
00076
00081 <span class="keywordtype">void</span> flush();
00082
<a name="l00088"></a><a class="code" href="classlog4cpp_1_1CategoryStream.html#a6">00088</a> <span class="keyword">template</span><<span class="keyword">typename</span> T> CategoryStream& <a class="code" href="namespacelog4cpp.html#a7">operator<<</a>(<span class="keyword">const</span> T& t) {
00089 <span class="keywordflow">if</span> (getPriority() != <a class="code" href="classlog4cpp_1_1Priority.html#w11w10">Priority::NOTSET</a>) {
00090 <span class="keywordflow">if</span> (!_buffer) {
00091 <span class="keywordflow">if</span> (!(_buffer = <span class="keyword">new</span> <a class="code" href="classstd_1_1ostringstream.html">std::ostringstream</a>)) {
00092 <span class="comment">// XXX help help help</span>
00093 }
00094 }
00095 (*_buffer) << t;
00096 }
00097 <span class="keywordflow">return</span> *<span class="keyword">this</span>;
00098 }
<a name="l00099"></a><a class="code" href="classlog4cpp_1_1CategoryStream.html#a7">00099</a> <span class="keyword">template</span><<span class="keyword">typename</span> T> CategoryStream& <a class="code" href="namespacelog4cpp.html#a7">operator<<</a>(<span class="keyword">const</span> std::string& t) {
00100 <span class="keywordflow">if</span> (getPriority() != <a class="code" href="classlog4cpp_1_1Priority.html#w11w10">Priority::NOTSET</a>) {
00101 <span class="keywordflow">if</span> (!_buffer) {
00102 <span class="keywordflow">if</span> (!(_buffer = <span class="keyword">new</span> <a class="code" href="classstd_1_1ostringstream.html">std::ostringstream</a>)) {
00103 <span class="comment">// XXX help help help</span>
00104 }
00105 }
00106 (*_buffer) << t;
00107 }
00108 <span class="keywordflow">return</span> *<span class="keyword">this</span>;
00109 }
<a name="l00110"></a><a class="code" href="classlog4cpp_1_1CategoryStream.html#a8">00110</a> <span class="keyword">template</span><<span class="keyword">typename</span> T> CategoryStream& <a class="code" href="namespacelog4cpp.html#a7">operator<<</a>(<span class="keyword">const</span> std::wstring& t) {
00111 <span class="keywordflow">if</span> (getPriority() != <a class="code" href="classlog4cpp_1_1Priority.html#w11w10">Priority::NOTSET</a>) {
00112 <span class="keywordflow">if</span> (!_wbuffer) {
00113 <span class="keywordflow">if</span> (!(_wbuffer = <span class="keyword">new</span> std::wostringstream)) {
00114 <span class="comment">// XXX help help help</span>
00115 }
00116 }
00117 (*_wbuffer) << t;
00118 }
00119 <span class="keywordflow">return</span> *<span class="keyword">this</span>;
00120 }
00121
00125 std::streamsize <a class="code" href="classlog4cpp_1_1width.html">width</a>(std::streamsize wide );
00126
00127
00128 <span class="keyword">private</span>:
00129 Category& _category;
00130 <a class="code" href="classlog4cpp_1_1Priority.html#w0">Priority::Value</a> _priority;
00131 <span class="keyword">union </span>{
00132 <a class="code" href="classstd_1_1ostringstream.html">std::ostringstream</a>* _buffer;
00133 std::wostringstream* _wbuffer;
00134 };
00135
00136 <span class="keyword">public</span>:
<a name="l00137"></a><a class="code" href="classlog4cpp_1_1CategoryStream.html#w0">00137</a> <span class="keyword">typedef</span> CategoryStream& (*cspf) (CategoryStream&);
00138
00139 CategoryStream& <a class="code" href="namespacelog4cpp.html#a7">operator<< </a>(cspf);
00140
00144 <span class="keyword">friend</span> <a class="code" href="Export_8hh.html#a0">LOG4CPP_EXPORT</a> CategoryStream& <a class="code" href="namespacelog4cpp.html#a5">eol</a> (CategoryStream& os);
00145
00149 <span class="keyword">friend</span> <a class="code" href="Export_8hh.html#a0">LOG4CPP_EXPORT</a> CategoryStream& <a class="code" href="namespacelog4cpp.html#a6">left</a> (CategoryStream& os);
00150 };
00151 }
00152 <span class="preprocessor">#endif // _LOG4CPP_CATEGORYSTREAM_HH</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Fri Jul 29 14:07:33 2005 for log4cpp by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.2 </small></address>
</body>
</html>
|