log4shib
1.0.9
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
include
log4shib
CategoryStream.hh
Go to the documentation of this file.
1
/*
2
* CategoryStream.hh
3
*
4
* Copyright 2001, LifeLine Networks BV (www.lifeline.nl). All rights reserved.
5
* Copyright 2001, Bastiaan Bakker. All rights reserved.
6
*
7
* See the COPYING file for the terms of usage and distribution.
8
*/
9
10
#ifndef _LOG4SHIB_CATEGORYSTREAM_HH
11
#define _LOG4SHIB_CATEGORYSTREAM_HH
12
13
#include <
log4shib/Portability.hh
>
14
#include <
log4shib/Priority.hh
>
15
#ifdef LOG4SHIB_HAVE_SSTREAM
16
#include <sstream>
17
#endif
18
19
namespace
log4shib {
20
21
class
LOG4SHIB_EXPORT
Category
;
22
class
LOG4SHIB_EXPORT
CategoryStream
;
23
27
LOG4SHIB_EXPORT
CategoryStream
&
eol
(
CategoryStream
& os);
28
33
class
LOG4SHIB_EXPORT
CategoryStream
{
34
public
:
35
42
CategoryStream
(
Category
& category,
Priority::Value
priority);
43
47
~
CategoryStream
();
48
53
inline
Category
&
getCategory
()
const
{
return
_category; };
54
59
inline
Priority::Value
getPriority
()
const
throw() {
60
return
_priority;
61
};
62
67
void
flush();
68
74
template
<
typename
T>
CategoryStream
&
operator<<
(
const
T& t) {
75
if
(getPriority() !=
Priority::NOTSET
) {
76
if
(!_buffer) {
77
if
(!(_buffer =
new
std::ostringstream
)) {
78
// XXX help help help
79
}
80
}
81
(*_buffer) << t;
82
}
83
return
*
this
;
84
}
85
86
private
:
87
Category
& _category;
88
Priority::Value
_priority;
89
std::ostringstream
* _buffer;
90
91
public
:
92
typedef
CategoryStream
& (*cspf) (
CategoryStream
&);
93
CategoryStream
& operator << (cspf);
94
LOG4SHIB_EXPORT
friend
CategoryStream
&
eol
(
CategoryStream
& os);
95
};
96
97
}
98
#endif // _LOG4SHIB_CATEGORYSTREAM_HH
Generated on Thu Aug 18 2016 15:48:04 for log4shib by
1.8.1.2