Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
include
log4cpp
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 _LOG4CPP_CATEGORYSTREAM_HH
11
#define _LOG4CPP_CATEGORYSTREAM_HH
12
13
#include <
log4cpp/Portability.hh
>
14
#include <
log4cpp/Priority.hh
>
15
#include <ios>
16
#ifdef LOG4CPP_HAVE_SSTREAM
17
#include <sstream>
18
#endif
19
#include <
log4cpp/Manipulator.hh
>
20
21
namespace
log4cpp
{
22
23
class
LOG4CPP_EXPORT
Category
;
24
class
LOG4CPP_EXPORT
CategoryStream
;
28
LOG4CPP_EXPORT
CategoryStream
&
eol
(
CategoryStream
& os);
29
33
LOG4CPP_EXPORT
CategoryStream
&
left
(
CategoryStream
& os);
34
39
class
LOG4CPP_EXPORT
CategoryStream
{
40
public
:
41
48
CategoryStream
(
Category
& category,
Priority::Value
priority);
49
53
~
CategoryStream
();
54
59
inline
Category
&
getCategory
()
const
{
return
_category; };
60
65
inline
Priority::Value
getPriority
()
const
throw() {
66
return
_priority;
67
};
68
73
void
flush();
74
80
template
<
typename
T>
81
CategoryStream
&
operator<<
(
const
T& t) {
82
if
(getPriority() !=
Priority::NOTSET
) {
83
if
(!_buffer) {
84
if
(!(_buffer =
new
std::ostringstream
)) {
85
// XXX help help help
86
}
87
}
88
(*_buffer) << t;
89
}
90
return
*
this
;
91
}
92
93
CategoryStream
&
operator<<
(
const
char
* t);
94
95
template
<
typename
T>
96
CategoryStream
&
operator<<
(
const
std::string& t) {
97
if
(getPriority() !=
Priority::NOTSET
) {
98
if
(!_buffer) {
99
if
(!(_buffer =
new
std::ostringstream
)) {
100
// XXX help help help
101
}
102
}
103
(*_buffer) << t;
104
}
105
return
*
this
;
106
}
107
#if LOG4CPP_HAS_WCHAR_T != 0
108
template
<
typename
T>
109
CategoryStream
&
operator<<
(
const
std::wstring& t) {
110
if
(getPriority() !=
Priority::NOTSET
) {
111
if
(!_wbuffer) {
112
if
(!(_wbuffer =
new
std::wostringstream)) {
113
// XXX help help help
114
}
115
}
116
(*_wbuffer) << t;
117
}
118
return
*
this
;
119
}
120
#endif
121
124
std::streamsize
width
(std::streamsize wide );
125
126
127
private
:
128
Category
&
_category
;
129
Priority::Value
_priority
;
130
union
{
131
std::ostringstream
*
_buffer
;
132
#if LOG4CPP_HAS_WCHAR_T != 0
133
std::wostringstream* _wbuffer;
134
#endif
135
};
136
137
public
:
138
typedef
CategoryStream
& (*cspf) (
CategoryStream
&);
139
140
CategoryStream
&
operator <<
(cspf);
141
LOG4CPP_EXPORT
friend
CategoryStream
&
eol
(
CategoryStream
& os);
142
LOG4CPP_EXPORT
friend
CategoryStream
&
left
(
CategoryStream
& os);
143
};
144
}
145
146
#endif // _LOG4CPP_CATEGORYSTREAM_HH
log4cpp::Category
Definition:
Category.hh:33
log4cpp::operator<<
ostream & operator<<(ostream &os, const width &w)
Definition:
Manipulator.cpp:10
log4cpp::width
Definition:
Manipulator.hh:15
log4cpp::CategoryStream::_category
Category & _category
Definition:
CategoryStream.hh:128
log4cpp::eol
LOG4CPP_EXPORT CategoryStream & eol(CategoryStream &os)
Definition:
CategoryStream.cpp:65
Portability.hh
log4cpp::Priority::NOTSET
Definition:
Priority.hh:79
log4cpp::CategoryStream
Definition:
CategoryStream.hh:39
log4cpp::CategoryStream
class LOG4CPP_EXPORT CategoryStream
Definition:
CategoryStream.hh:24
log4cpp::CategoryStream::getCategory
Category & getCategory() const
Definition:
CategoryStream.hh:59
LOG4CPP_EXPORT
#define LOG4CPP_EXPORT
Definition:
Export.hh:26
log4cpp::CategoryStream::operator<<
CategoryStream & operator<<(const T &t)
Definition:
CategoryStream.hh:81
log4cpp
Definition:
AbortAppender.hh:16
log4cpp::left
LOG4CPP_EXPORT CategoryStream & left(CategoryStream &os)
Definition:
CategoryStream.cpp:71
log4cpp::Priority::Value
int Value
Definition:
Priority.hh:85
log4cpp::CategoryStream::_buffer
std::ostringstream * _buffer
Definition:
CategoryStream.hh:131
log4cpp::CategoryStream::operator<<
CategoryStream & operator<<(const std::string &t)
Definition:
CategoryStream.hh:96
log4cpp::CategoryStream::getPriority
Priority::Value getPriority() const
Definition:
CategoryStream.hh:65
Manipulator.hh
log4cpp::CategoryStream::_priority
Priority::Value _priority
Definition:
CategoryStream.hh:129
std::ostringstream
Definition:
Portability.hh:45
Priority.hh
log4cpp
Author(s): Stephen Roderick, Bastiaan Bakker, Cedric Le Goater, Steve Ostlind, Marcel Harkema, Walter Stroebel, Glenn Scott and Tony Cheung
autogenerated on Sun Jun 23 2019 19:10:00