| globjects 1.0.0.000000000000 Strict OpenGL objects wrapper.

LogMessageBuilder.h
Go to the documentation of this file.
1
2 #pragma once
3
4 #include <iosfwd>
5 #include <string>
6 #include <vector>
7 #include <array>
8 #include <memory>
9 #include <iomanip>
10
11 #include <globjects/globjects_api.h>
12 #include <globjects/base/LogMessageLevel.h>
13
14
15 namespace globjects
16 {
17
18
19 template <typename T>
20 class ref_ptr;
21
22 class AbstractLogHandler;
23
48 class GLOBJECTS_API LogMessageBuilder
49 {
50 public:
51 // These types are unspecified by the C++ standard -> we need to query the compiler specific types
52 using PrecisionManipulator = decltype(std::setprecision(0));
53 using FillManipulator = decltype(std::setfill('0'));
54 using WidthManipulator = decltype(std::setw(0));
55
56 public:
57 LogMessageBuilder(LogMessageLevel level, AbstractLogHandler * handler);
58 LogMessageBuilder(const LogMessageBuilder & builder);
59 virtual ~LogMessageBuilder();
60
61 LogMessageBuilder & operator<<(const char * c);
62 LogMessageBuilder & operator<<(const std::string & str);
63 LogMessageBuilder & operator<<(bool b);
64 LogMessageBuilder & operator<<(char c);
65 LogMessageBuilder & operator<<(int i);
66 LogMessageBuilder & operator<<(float f);
67 LogMessageBuilder & operator<<(double d);
68 LogMessageBuilder & operator<<(long double d);
69 LogMessageBuilder & operator<<(unsigned u);
70 LogMessageBuilder & operator<<(long l);
71 LogMessageBuilder & operator<<(long long l);
72 LogMessageBuilder & operator<<(unsigned long ul);
73 LogMessageBuilder & operator<<(unsigned char uc);
74 LogMessageBuilder & operator<<(const void * pointer);
75
76 // manipulators
77 LogMessageBuilder & operator<<(std::ostream & (*manipulator)(std::ostream&));
78 LogMessageBuilder & operator<<(PrecisionManipulator manipulator);
79 LogMessageBuilder & operator<<(FillManipulator manipulator);
80 #ifndef _MSC_VER
81 // in Windows PrecisionManipulator = WidthManipulator
82 LogMessageBuilder & operator<<(WidthManipulator manipulator);
83 #endif
84
85 // globjects base objects
86 template <typename T>
87 LogMessageBuilder & operator<<(const ref_ptr<T> & ref_pointer);
88
89 // pointers
90 template <typename T>
91 LogMessageBuilder & operator<<(const T * pointer);
92
93 // array types
94 template <typename T>
95 LogMessageBuilder & operator<<(const std::vector<T> & vector);
96 template <typename T, std::size_t Count>
97 LogMessageBuilder & operator<<(const std::array<T, Count> & array);
98
99 protected:
100 LogMessageLevel m_level;
101 AbstractLogHandler * m_handler;
102 std::shared_ptr<std::stringstream> m_stream;
103 };
104
105
106 } // namespace globjects
107
108
109 #include <globjects/base/LogMessageBuilder.inl>
globjects::LogMessageBuilder::m_stream
std::shared_ptr< std::stringstream > m_stream
Definition: LogMessageBuilder.h:102
globjects::ref_ptr
The ref_ptr class provides the interface for a reference pointer.
Definition: LogMessageBuilder.h:20
globjects
Contains all the classes that wrap OpenGL functionality.
globjects::LogMessageLevel
LogMessageLevel
Definition: LogMessageLevel.h:9
globjects::LogMessageBuilder::PrecisionManipulator
decltype(std::setprecision(0)) PrecisionManipulator
Definition: LogMessageBuilder.h:52
LogMessageLevel.h
globjects::LogMessageBuilder::WidthManipulator
decltype(std::setw(0)) WidthManipulator
Definition: LogMessageBuilder.h:54
globjects::LogMessageBuilder
Builds a LogMessage from different kinds of primitive types.
Definition: LogMessageBuilder.h:48
globjects::LogMessageBuilder::FillManipulator
decltype(std::setfill( '0')) FillManipulator
Definition: LogMessageBuilder.h:53
globjects::LogMessageBuilder::m_handler
AbstractLogHandler * m_handler
Definition: LogMessageBuilder.h:101
globjects::operator<<
GLOBJECTS_API LogMessageBuilder operator<<(LogMessageBuilder builder, const glbinding::Version &version)
globjects::LogMessageBuilder::m_level
LogMessageLevel m_level
Definition: LogMessageBuilder.h:100
globjects::AbstractLogHandler
Abstract interface to handle LogMessages.
Definition: AbstractLogHandler.h:23