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 
22 
29 
34 
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> CategoryStream& operator<<(const T& t) {
81  if (getPriority() != Priority::NOTSET) {
82  if (!_buffer) {
83  if (!(_buffer = new std::ostringstream)) {
84  // XXX help help help
85  }
86  }
87  (*_buffer) << t;
88  }
89  return *this;
90  }
91 
92  CategoryStream& operator<<(const char* t);
93 
94  template<typename T>
95  CategoryStream& operator<<(const std::string& t) {
96  if (getPriority() != Priority::NOTSET) {
97  if (!_buffer) {
98  if (!(_buffer = new std::ostringstream)) {
99  // XXX help help help
100  }
101  }
102  (*_buffer) << t;
103  }
104  return *this;
105  }
106 #if LOG4CPP_HAS_WCHAR_T != 0
107  template<typename T>
108  CategoryStream& operator<<(const std::wstring& t) {
109  if (getPriority() != Priority::NOTSET) {
110  if (!_wbuffer) {
111  if (!(_wbuffer = new std::wostringstream)) {
112  // XXX help help help
113  }
114  }
115  (*_wbuffer) << t;
116  }
117  return *this;
118  }
119 #endif
120 
123  std::streamsize width(std::streamsize wide);
124 
125 
126 private:
129  union {
131 #if LOG4CPP_HAS_WCHAR_T != 0
132  std::wostringstream* _wbuffer;
133 #endif
134  };
135 
136 public:
137  typedef CategoryStream& (*cspf) (CategoryStream&);
138 
142 
143 private:
144  // suppress assignment operator
146 
147 };
149 #endif // _LOG4CPP_CATEGORYSTREAM_HH
#define LOG4CPP_NS_END
Definition: Portability.hh:50
class LOG4CPP_EXPORT CategoryStream
Category & getCategory() const
Returns the destination Category for this stream.
virtual void operator=(bool Value)
Set node value.
Definition: IBoolean.h:64
LOG4CPP_EXPORT CategoryStream & eol(CategoryStream &os)
eol manipulator
std::ostream & operator<<(std::ostream &ostr, const GENICAM_NAMESPACE::gcstring &str)
STL operator out.
Definition: GCString.h:225
LOG4CPP_EXPORT CategoryStream & left(CategoryStream &os)
left manipulator
#define LOG4CPP_EXPORT
Definition: Export.hh:21
Category & _category
This is the central class in the log4j package.
Definition: Category.hh:34
std::ostringstream * _buffer
Priority::Value getPriority() const
Returns the priority for this stream.
Priority::Value _priority
This class enables streaming simple types and objects to a category.
int Value
The type of Priority Values.
Definition: Priority.hh:87
CategoryStream & operator<<(const std::string &t)
CategoryStream & operator<<(const T &t)
Stream in arbitrary types and objects.
#define LOG4CPP_NS_BEGIN
Definition: Portability.hh:49


rc_genicam_api
Author(s): Heiko Hirschmueller
autogenerated on Thu Jun 6 2019 19:10:53